(do not use "import pubsub" or "from pubsub import *"). """ import pubsubconf # indicate that package has been loaded: pubsubconf.packageLoaded = True __all__ = [] def _notify(output, version): if output is not None: output.write('Importing version %s of pubsub\n' % version) _output = pubsubconf.getVersionOutput() _version = pubsubconf.getVersion() if _version <= 1: msg = 'BUG: Should not be loaded for version (%s) <= 1' % _version raise NotImplementedError(msg) if _version <= 2: _notify(_output, 2) from core.pubsub2 import * from core import pubsub2 as _pubsubMod elif _version <= 3: _notify(_output, 3) from core.pubsub3 import * from core import pubsub3 as _pubsubMod
from pubsub import pub help(pub) pub.sendMessage(topic, ...) from pubsub import utils as pubutils pubutils.... Do not use Publisher in new code, it is deprecated (see below). DEPRECATED use: old code can still use from pubsub import Publisher help(Publisher.__class__) Publisher.sendMessage(topic) # OR: Publisher().sendMessage(topic) but should be converted to new format. ''' __all__ = ['pub', 'utils'] # if user wants old pubsub, main API is a singleton Publisher instance # ie no way to fake via module so must import here; but that's ok since # for version 1 there are no utilities etc. import pubsubconf if pubsubconf.getVersion() <= 1: from core.pubsub1 import Publisher as pub Publisher = pub __all__.append('Publisher')