def __init__(self, help='', supplyDefault=False, orderAlphabetically=False, private=False): self._help = utils.str.normalizeWhitespace(help) self._name = 'unset' self._added = [] self._children = utils.InsensitivePreservingDict() self._lastModified = 0 self._private = private self._supplyDefault = supplyDefault self._orderAlphabetically = orderAlphabetically OriginalClass = self.__class__ class X(OriginalClass): """This class exists to differentiate those values that have been changed from their default from those that haven't.""" def set(self, *args): self.__class__ = OriginalClass self.set(*args) def setValue(self, *args): self.__class__ = OriginalClass self.setValue(*args) self.X = X
def get_dependency_translations(): return utils.InsensitivePreservingDict({ 'Breaks': _('Breaks'), 'Conflicts': _('Conflicts'), 'Depends': _('Depends'), 'Enhances': _('Enhances'), 'PreDepends': _('PreDepends'), 'Recommends': _('Recommends'), 'Replaces': _('Replaces'), 'Suggests': _('Suggests'), })
def get_dependency_translations(): """Returns a map from English names to locale names of dependency types. """ return utils.InsensitivePreservingDict({ 'Breaks': _('Breaks'), 'Conflicts': _('Conflicts'), 'Depends': _('Depends'), 'Enhances': _('Enhances'), 'PreDepends': _('PreDepends'), 'Recommends': _('Recommends'), 'Replaces': _('Replaces'), 'Suggests': _('Suggests'), })
def fetch_dict(self): if self._lock.acquire(blocking=False): try: data = json.loads(utils.web.getUrl(SOURCE).decode()) self._dict = utils.InsensitivePreservingDict() for d in data: self._dict[d['anglais'].split(' (')[0]] = d['français'] \ .lower() self._re = re.compile( r'(\b%ss?\b)' % (r's?\b|\b'.join(map(re.escape, self._dict)))) finally: self._lock.release() return True else: return False
repositories = utils.InsensitivePreservingDict({ 'ProgVal': GithubRepository('ProgVal', 'Supybot-plugins'), 'quantumlemur': GithubRepository( 'quantumlemur', 'Supybot-plugins', ), 'stepnem': GithubRepository( 'stepnem', 'supybot-plugins', ), 'code4lib-snapshot': GithubRepository( 'code4lib', 'supybot-plugins', 'Supybot-plugins-20060723', ), 'code4lib-edsu': GithubRepository( 'code4lib', 'supybot-plugins', 'edsu-plugins', ), 'code4lib': GithubRepository( 'code4lib', 'supybot-plugins', 'plugins', ), 'nanotube-bitcoin': GithubRepository( 'nanotube', 'supybot-bitcoin-' 'marketmonitor', ), 'mtughan-weather': GithubRepository( 'mtughan', 'Supybot-Weather', ), 'SpiderDave': GithubRepository( 'SpiderDave', 'spidey-supybot-plugins', 'Plugins', ), 'doorbot': GithubRepository( 'hacklab', 'doorbot', ), 'boombot': GithubRepository( 'nod', 'boombot', 'plugins', ), 'mailed-notifier': GithubRepository( 'tbielawa', 'supybot-mailed-notifier', ), 'pingdom': GithubRepository( 'rynop', 'supyPingdom', 'plugins', ), 'scrum': GithubRepository( 'amscanne', 'supybot-scrum', ), 'Hoaas': GithubRepository('Hoaas', 'Supybot-plugins'), 'nyuszika7h': GithubRepository('nyuszika7h', 'limnoria-plugins'), 'nyuszika7h-old': GithubRepository('nyuszika7h', 'Supybot-plugins'), 'resistivecorpse': GithubRepository('resistivecorpse', 'supybot-plugins'), 'frumious': GithubRepository( 'frumiousbandersnatch', 'sobrieti-plugins', 'plugins', ), 'jonimoose': GithubRepository( 'Jonimoose', 'Supybot-plugins', ), 'skgsergio': GithubRepository( 'skgsergio', 'Limnoria-plugins', ), 'GLolol': GithubRepository( 'GLolol', 'SupyPlugins', ), 'Iota': GithubRepository( 'ZeeCrazyAtheist', 'supyplugins', ), 'waratte': GithubRepository( 'waratte', 'supybot', ), 't3chguy': GithubRepository( 't3chguy', 'Limnoria-Plugins', ), 'prgmrbill': GithubRepository( 'prgmrbill', 'limnoria-plugins', ), })
pass class InvalidRegistryValue(RegistryException): pass class NonExistentRegistryEntry(RegistryException, AttributeError): # If we use hasattr() on a configuration group/value, Python 3 calls # __getattr__ and looks for an AttributeError, so __getattr__ has to # raise an AttributeError if a registry entry does not exist. pass ENCODING = 'string_escape' if sys.version_info[0] < 3 else 'unicode_escape' decoder = codecs.getdecoder(ENCODING) encoder = codecs.getencoder(ENCODING) _cache = utils.InsensitivePreservingDict() _lastModified = 0 def open_registry(filename, clear=False): """Initializes the module by loading the registry file into memory.""" global _lastModified if clear: _cache.clear() _fd = open(filename) fd = utils.file.nonCommentNonEmptyLines(_fd) acc = '' slashEnd = re.compile(r'\\*$') for line in fd: line = line.rstrip('\r\n') # XXX There should be some way to determine whether or not we're # starting a new variable or not. As it is, if there's a backslash # at the end of every line in a variable, it won't be read, and
def get_dependency_reverse_translations(): return utils.InsensitivePreservingDict( {v: k for (k, v) in get_dependency_translations().items()})
repositories = utils.InsensitivePreservingDict({ 'progval': GithubRepository('progval', 'Supybot-plugins'), 'SpiderDave': GithubRepository( 'SpiderDave', 'spidey-supybot-plugins', 'Plugins', ), 'Hoaas': GithubRepository('Hoaas', 'Supybot-plugins'), 'nyuszika7h': GithubRepository('nyuszika7h', 'limnoria-plugins'), 'frumious': GithubRepository( 'frumiousbandersnatch', 'sobrieti-plugins', 'plugins', ), 'skgsergio': GithubRepository( 'skgsergio', 'Limnoria-plugins', ), 'jlu5': GithubRepository( 'jlu5', 'SupyPlugins', ), 'Iota': GithubRepository( 'IotaSpencer', 'supyplugins', ), 'waratte': GithubRepository( 'waratte', 'supybot', ), 't3chguy': GithubRepository( 't3chguy', 'Limnoria-Plugins', ), 'prgmrbill': GithubRepository( 'prgmrbill', 'limnoria-plugins', ), 'fudster': GithubRepository( 'fudster', 'supybot-plugins', ), 'oddluck': GithubRepository( 'oddluck', 'limnoria-plugins', ), })
filename = plugins.makeChannelFilename(self.filename, channel) if filename in self.dbs: pass elif os.path.exists(filename): fd = file(filename) try: (Is, Are) = pickle.load(fd) self.dbs[filename] = (Is, Are) self.changes[filename] = 0 self.responses[filename] = 0 except cPickle.UnpicklingError, e: fd.close() raise dbi.InvalidDBError, str(e) fd.close() else: self.dbs[filename] = (utils.InsensitivePreservingDict(), utils.InsensitivePreservingDict()) for (k, v) in initialIs.iteritems(): self.setIs(channel, k, v) for (k, v) in initialAre.iteritems(): self.setAre(channel, k, v) self.changes[filename] = 0 self.responses[filename] = 0 return (self.dbs[filename], filename) def flush(self, db=None, filename=None): if db is None and filename is None: for (filename, db) in self.dbs.iteritems(): fd = utils.file.AtomicFile(filename, 'wb') pickle.dump(db, fd) fd.close()