rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def isDisabled(self, irc): | def disabled(self, irc): | def isDisabled(self, irc): disabled = self.registryValue('disabledNetworks') if irc.network in disabled or \ irc.state.supported.get('NETWORK', '') in disabled: return True return False |
if self.isDisabled(irc): | if self.disabled(irc): | def _doIdentify(self, irc, nick=None): if self.isDisabled(irc): return if nick is None: nick = self._getNick() if nick not in self.registryValue('nicks'): return nickserv = self.registryValue('NickServ') password = self._getNickServPassword(nick) if not nickserv or not password: s = 'Tried to identify without a NickSer... |
if self.isDisabled(irc): | if self.disabled(irc): | def _doGhost(self, irc, nick=None): if self.isDisabled(irc): return if nick is None: nick = self._getNick() if nick not in self.registryValue('nicks'): return nickserv = self.registryValue('NickServ') password = self._getNickServPassword(nick) ghostDelay = self.registryValue('ghostDelay') if not nickserv or not passwor... |
if self.isDisabled(irc): | if self.disabled(irc): | def __call__(self, irc, msg): self.__parent.__call__(irc, msg) if self.isDisabled(irc): return nick = self._getNick() if nick not in self.registryValue('nicks'): return nickserv = self.registryValue('NickServ') password = self._getNickServPassword(nick) ghostDelay = self.registryValue('ghostDelay') if nick and nickserv... |
if self.isDisabled(irc): | if self.disabled(irc): | def do376(self, irc, msg): if self.isDisabled(irc): return nick = self._getNick() if nick not in self.registryValue('nicks'): return nickserv = self.registryValue('NickServ') if not nickserv: self.log.warning('NickServ is unset, cannot identify.') return password = self._getNickServPassword(nick) if not password: self.... |
if self.isDisabled(irc): | if self.disabled(irc): | def do433(self, irc, msg): if self.isDisabled(irc): return nick = self._getNick() if nick not in self.registryValue('nicks'): return if nick and irc.afterConnect: password = self._getNickServPassword(nick) if not password: return self._doGhost(irc) |
if self.isDisabled(irc): | if self.disabled(irc): | def doChanservNotice(self, irc, msg): if self.isDisabled(irc): return s = msg.args[1].lower() channel = None m = self._chanRe.search(s) networkGroup = conf.supybot.networks.get(irc.network) on = 'on %s' % irc.network if m is not None: channel = m.group(1) if 'all bans' in s or 'unbanned from' in s: # All bans removed (... |
if self.isDisabled(irc): | if self.disabled(irc): | def doNickservNotice(self, irc, msg): if self.isDisabled(irc): return nick = self._getNick() s = ircutils.stripFormatting(msg.args[1].lower()) on = 'on %s' % irc.network networkGroup = conf.supybot.networks.get(irc.network) if 'incorrect' in s or 'denied' in s: log = 'Received "Password Incorrect" from NickServ %s. ' ... |
if self.isDisabled(irc): | if self.disabled(irc): | def checkPrivileges(self, irc, channel): if self.isDisabled(irc): return chanserv = self.registryValue('ChanServ') on = 'on %s' % irc.network if chanserv and self.registryValue('ChanServ.op', channel): if irc.nick not in irc.state.channels[channel].ops: self.log.info('Requesting op from %s in %s %s.', chanserv, channel... |
if self.isDisabled(irc): | if self.disabled(irc): | def doMode(self, irc, msg): if self.isDisabled(irc): return chanserv = self.registryValue('ChanServ') on = 'on %s' % irc.network if ircutils.strEqual(msg.nick, chanserv): channel = msg.args[0] if len(msg.args) == 3: if ircutils.strEqual(msg.args[2], irc.nick): mode = msg.args[1] info = self.log.info if mode == '+o': in... |
if self.isDisabled(irc): | if self.disabled(irc): | def callCommand(self, command, irc, msg, *args, **kwargs): if self.isDisabled(irc): irc.error('Services plugin is disabled on this network', Raise=True) self.__parent.callCommand(command, irc, msg, *args, **kwargs) |
if self.isDisabled(irc): | if self.disabled(irc): | def do474(self, irc, msg): if self.isDisabled(irc): return channel = msg.args[1] on = 'on %s' % irc.network self.log.info('Banned from %s, attempting ChanServ unban %s.', channel, on) self._chanservCommand(irc, channel, 'unban', log=True) # Success log in doChanservNotice. |
if self.isDisabled(irc): | if self.disabled(irc): | def do473(self, irc, msg): if self.isDisabled(irc): return channel = msg.args[1] on = 'on %s' % irc.network self.log.info('%s is +i, attempting ChanServ invite %s.', channel, on) self._chanservCommand(irc, channel, 'invite', log=True) |
directory = get_plugin_dir(self.name) + 'locale' | if self.name != 'supybot': directory = get_plugin_dir(self.name) + 'locale' filename = '%s/%s.po' % (directory, localeName) else: filename = 'locale/%s.po' % localeName | def loadLocale(self, localeName=None): |
translationFile = open('%s/%s.po' % (directory, localeName), 'ru') | translationFile = open(filename, 'ru') | def loadLocale(self, localeName=None): |
allowedLength = 450 - len(self.irc.prefix) | allowedLength = 470 - len(self.irc.prefix) | def reply(self, s, noLengthCheck=False, prefixNick=None, action=None, private=None, notice=None, to=None, msg=None): """reply(s) -> replies to msg with s |
s = s[:allowedLength+20] | s = s[:allowedLength+len(_('(XX more messages)'))] | def reply(self, s, noLengthCheck=False, prefixNick=None, action=None, private=None, notice=None, to=None, msg=None): """reply(s) -> replies to msg with s |
r = f(*args, **kwargs) q.put(r) | try: r = f(*args, **kwargs) q.put(r) except Exception as e: q.put(e) | def newf(f, q, *args, **kwargs): r = f(*args, **kwargs) q.put(r) |
detected_language = json['responseData']['detectedSourceLanguage'] | detected_language = json['responseData']['detectedSourceLanguage'].encode('utf-8') translation = json['responseData']['translatedText'].encode('utf-8') | def translate(self, irc, msg, args, fromLang, toLang, text): """<from-language> [to] <to-language> <text> |
(long_lang_name, json['responseData']['translatedText'].encode('utf-8')) | (long_lang_name, translation) | def translate(self, irc, msg, args, fromLang, toLang, text): """<from-language> [to] <to-language> <text> |
url = data['responseData']['results'][0]['unescapedUrl'] | url = data['responseData']['results'][0]['unescapedUrl'].encode('utf-8') | def lucky(self, irc, msg, args, opts, text): """[--snippet] <search> |
snippet = data['responseData']['results'][0]['content'] | snippet = data['responseData']['results'][0]['content'].encode('utf-8') | def lucky(self, irc, msg, args, opts, text): """[--snippet] <search> |
irc.reply(result.encode('utf-8')) | irc.reply(result) | def lucky(self, irc, msg, args, opts, text): """[--snippet] <search> |
def error(self): if self.__doc__: | def error(self, message=None): if message: s = message elif self.__doc__: | def error(self): if self.__doc__: s = self.__doc__ else: s = """%s has no docstring. If you're getting this message, report it, because we forgot to put a proper help string here."""%\ self._name e = InvalidRegistryValue(utils.str.normalizeWhitespace(s)) e.value = self raise e |
self.__parent.error('Value must be a regexp of the form %s' % e) | self.__parent.error('%s' % e) | def error(self, e): self.__parent.error('Value must be a regexp of the form %s' % e) |
except ssl.SSLError, e: | except SSLError, e: | def run(self): now = time.time() if self.nextReconnectTime is not None and now > self.nextReconnectTime: self.reconnect() elif self.writeCheckTime is not None and now > self.writeCheckTime: self._checkAndWriteOrReconnect() if not self.connected: # We sleep here because otherwise, if we're the only driver, we'll # spin ... |
error(str(n)) | error(args[0]) | def error(s): state.errorInvalid('topic number', s) |
self.assertRegexp('spell Strike', 'correctly') | self.assertRegexp('spell Strike', '(correctly|Possible spellings)') | def testSpell(self): self.assertRegexp('spell Strike', 'correctly') # ispell won't find any results. aspell will make some # suggestions. self.assertRegexp('spell z0opadfnaf83nflafl230kasdf023hflasdf', 'not find|Possible spellings') self.assertNotError('spell Strizzike') self.assertError('spell foo bar baz') self.asse... |
reply(response) | reply(response, prefixNick=False) | def _response(self, msg, prb, reply): if random.randint(0, 100) < prb: response = megahal.doreply(msg) if self._translations.has_key(response): response = self._translations[response] reply(response) else: megahal.learn(msg) |
print sql | def p(s, r=arg): return int(bool(r.search(s))) | |
print sql print formats | def p(s, r=arg): return int(bool(r.search(s))) | |
list = wrap(list, [optional('channel')]) | list = wrap(list, ['channel',]) | def list(self, irc, msg, args, channel): """[<channel>] |
ctime = time.ctime() | ctime = time.strftime("%a %b %d %H:%M:%S %Y") | def randNick(): if channel != 'somewhere': L = list(irc.state.channels[channel].users) if len(L) > 1: n = msg.nick while n == msg.nick: n = utils.iter.choice(L) return n else: return msg.nick else: return 'someone' |
'tz': time.tzname[time.daylight], | 'tz': time.strftime('%Z', localtime), | def randNick(): if channel != 'somewhere': L = list(irc.state.channels[channel].users) if len(L) > 1: n = msg.nick while n == msg.nick: n = utils.iter.choice(L) return n else: return msg.nick else: return 'someone' |
untranslated = self._unescape(untranslated, True) | escapedUntranslated = self._unescape(untranslated, True) untranslated = self._unescape(untranslated, False) | def __call__(self, untranslated): """Main function. |
string = self._translate(untranslated) | string = self._translate(escapedUntranslated) | def __call__(self, untranslated): """Main function. |
return utils.timeElapsed(diff, seconds=False) + _(' ago') | return _('%s ago') % utils.timeElapsed(diff, seconds=False) | def _timestamp(self, when): #format = conf.supybot.reply.format.time() diff = time.time() - when try: return utils.timeElapsed(diff, seconds=False) + _(' ago') except ValueError: return _('just now') |
self._reply(irc, msg, _('FINGER Supybot, the best Python IRC bot in existence!')) | self._reply(irc, msg, 'FINGER ' + _('Supybot, the best Python IRC bot in existence!')) | def ctcpFinger(self, irc, msg, match): "\x01FINGER\x01" self.log.info('Received CTCP FINGER from %s', msg.prefix) self._reply(irc, msg, _('FINGER Supybot, the best Python IRC bot in existence!')) |
irc.error('That trigger is locked.') | irc.reply('That trigger is locked.') return | def add(self, irc, msg, args, channel, regexp, action): """[<channel>] <regexp> <action> |
irc.error('There is no such regexp trigger.') | irc.reply('There is no such regexp trigger.') return | def remove(self, irc, msg, args, channel, regexp): """[<channel>] <regexp>] |
irc.error('This regexp trigger is locked.') | irc.reply('This regexp trigger is locked.') return | def remove(self, irc, msg, args, channel, regexp): """[<channel>] <regexp>] |
irc.error('There is no such regexp trigger.') | irc.reply('There is no such regexp trigger.') return | def show(self, irc, msg, args, channel, regexp): """[<channel>] <regexp> |
irc.error('There is no available regexp triggers.') | irc.reply('There are no regexp triggers in the database.') return | def listall(self, irc, msg, args, channel): """[<channel>] |
print name | def __init__(self, name='supybot'): | |
inst = subprocess.Popen([pingCmd,'-c','1', host], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=file(os.devnull)) | def ping(self, irc, msg, args, host): """<host or ip> Sends an ICMP echo request to the specified host """ pingCmd = self.registryValue('ping.command') if not pingCmd: irc.error('The ping command is not configured. If one ' 'is installed, reconfigure ' 'supybot.plugins.Unix.ping.command appropriately.', Raise=True) el... | |
irc.reply("The trigger for regexp '%s' is '%s'" % (regexp, action)) | irc.reply("The action for regexp trigger '%s' is '%s'" % (regexp, action)) | def show(self, irc, msg, args, channel, regexp): """[<channel>] <regexp> |
print repr({self._parse(untranslated): self._parse(translated)}) | def _translate(self, untranslated, translated): | |
flexargs, (biggestDollar, 'argument'), alias) | flexargs, (biggestDollar, _('argument')), alias) | def everythingReplace(tokens): for (i, token) in enumerate(tokens): if isinstance(token, list): if everythingReplace(token): return if token == '$*': tokens[i:i+1] = args return True elif '$*' in token: tokens[i] = token.replace('$*', ' '.join(args)) return True return False |
print " --- " + name | def testDocumentation(self): if self.__class__ in (PluginTestCase, ChannelPluginTestCase): return for cb in self.irc.callbacks: name = cb.name() print " --- " + name if ((name in self._noTestDoc) and \ not name.lower() in self.__class__.__name__.lower()): continue self.failUnless(sys.modules[cb.__class... | |
filename = sys.modules[plugin_name].__file__ | filename = None try: filename = sys.modules[plugin_name].__file__ except KeyError: pass if filename == None: try: filename = sys.modules['supybot.plugins.' + plugin_name].__file__ except KeyError: return | def get_plugin_dir(plugin_name): filename = sys.modules[plugin_name].__file__ if filename.endswith(".pyc"): filename = filename[0:-1] allowed_files = ['__init__.py', 'config.py', 'plugin.py', 'test.py'] for allowed_file in allowed_files: if filename.endswith(allowed_file): return filename[0:-len(allowed_file)] return |
directory = get_plugin_dir(name) + 'locale' | try: directory = get_plugin_dir(name) + 'locale' except TypeError: return '' | def getLocalePath(name, localeName, extension): if name != 'supybot': directory = get_plugin_dir(name) + 'locale' else: import ansi # Any Supybot plugin could fit directory = ansi.__file__[0:-len('ansi.pyc')] + 'locale' return '%s/%s.%s' % (directory, localeName, extension) |
global i18nSupybot if name != 'supybot': | if i18nClasses.has_key(name): return i18nClasses[name] else: | def PluginInternationalization(name='supybot'): # This is a proxy, that prevent Supybot against having more than one # internationalizer global i18nSupybot if name != 'supybot': return _PluginInternationalization(name) elif i18nSupybot == None: i18nSupybot = _PluginInternationalization('supybot') return i18nSupybot |
elif i18nSupybot == None: i18nSupybot = _PluginInternationalization('supybot') return i18nSupybot | def PluginInternationalization(name='supybot'): # This is a proxy, that prevent Supybot against having more than one # internationalizer global i18nSupybot if name != 'supybot': return _PluginInternationalization(name) elif i18nSupybot == None: i18nSupybot = _PluginInternationalization('supybot') return i18nSupybot | |
return | def loadLocale(self, localeName=None): | |
Locks the topic (sets the mode +t) in <channel>. <channel> is only | Unlocks the topic (sets the mode +t) in <channel>. <channel> is only | def unlock(self, irc, msg, args, channel): """[<channel>] |
probability = self.registryValue('answer.probability') answer = False learn = False | def doPrivmsg(self, irc, msg): message = msg.args[1] probability = self.registryValue('answer.probability') answer = False learn = False if message.startswith(irc.nick) or re.match('\W.*', message): # Managed by invalidCommand return print repr(message) if answer: self._response(message, self.registryValue('answer.p... | |
print repr(message) if answer: self._response(message, self.registryValue('answer.probability'), irc.reply) elif learn: megahal.learn(message) | probability = self.registryValue('answer.probability', msg.args[0]) self._response(message, probability, irc.reply) | def doPrivmsg(self, irc, msg): message = msg.args[1] probability = self.registryValue('answer.probability') answer = False learn = False if message.startswith(irc.nick) or re.match('\W.*', message): # Managed by invalidCommand return print repr(message) if answer: self._response(message, self.registryValue('answer.p... |
self.registryValue('answer.probabilityWhenAdressed'), | self.registryValue('answer.probabilityWhenAddressed', msg.args[0]), | def invalidCommand(self, irc, msg, tokens): message = msg.args[1] usedToStartWithNick = False if message.startswith(message): parsed = re.match('(.+ |\W)?(?P<message>\w.*)', message) message = parsed.group('message') usedToStartWithNick = True if self.registryValue('answer.commands') or usedToStartWithNick: self._respo... |
elif lowered.endwith('al') and \ | elif lowered.endswith('al') and \ | def pluralize(s): """Returns the plural of s. """ lowered = s.lower() if lowered.endswith('ou') and \ lowered in ['bijou', 'caillou', 'chou', 'genou', 'hibou', 'joujou', 'pou']: return s + 'x' elif lowered.endwith('al') and \ lowered not in ['bal', 'carnaval', 'chacal', 'festival', 'récital', 'régal', 'cal', 'étal', 'a... |
elif lowered.endwith('eu') and \ | elif lowered.endswith('eu') and \ | def pluralize(s): """Returns the plural of s. """ lowered = s.lower() if lowered.endswith('ou') and \ lowered in ['bijou', 'caillou', 'chou', 'genou', 'hibou', 'joujou', 'pou']: return s + 'x' elif lowered.endwith('al') and \ lowered not in ['bal', 'carnaval', 'chacal', 'festival', 'récital', 'régal', 'cal', 'étal', 'a... |
for (name, _) in conf.supybot.getValues(getChildren=True): | for (name, x) in conf.supybot.getValues(getChildren=True): | def search(self, irc, msg, args, word): """<word> |
def print_buffer(header, content): | def print_buffer(nodeset, content, regroup, groupsource): | def print_buffer(header, content): """Display a dshbak-like header block and content.""" sep = "-" * 15 sys.stdout.write("%s\n%s\n%s\n%s\n" % (sep, header, sep, content)) |
def print_lines(header, msg): | def print_lines(nodeset, msg, regroup, groupsource): | def print_lines(header, msg): """Display a MsgTree buffer by line with prefixed header.""" for line in msg: sys.stdout.write("%s: %s\n" % (header, line)) |
def display(tree, line_mode, gather): | def display(tree, line_mode, gather, regroup, groupsource): | def display(tree, line_mode, gather): """Display results""" try: if gather: # lambda to create a NodeSet from keys list returned by walk() ns_getter = lambda x: NodeSet.fromlist(x[1]) for nodeset in sorted(imap(ns_getter, tree.walk()), cmp=nodeset_cmp): if line_mode: print_lines(nodeset, tree[nodeset[0]]) else: print_... |
print_lines(nodeset, tree[nodeset[0]]) | print_lines(nodeset, tree[nodeset[0]], regroup, groupsource) | def display(tree, line_mode, gather): """Display results""" try: if gather: # lambda to create a NodeSet from keys list returned by walk() ns_getter = lambda x: NodeSet.fromlist(x[1]) for nodeset in sorted(imap(ns_getter, tree.walk()), cmp=nodeset_cmp): if line_mode: print_lines(nodeset, tree[nodeset[0]]) else: print_... |
print_buffer(NodeSet.fromlist(nodeset), tree[nodeset[0]]) | print_buffer(NodeSet.fromlist(nodeset), tree[nodeset[0]], regroup, groupsource) | def display(tree, line_mode, gather): """Display results""" try: if gather: # lambda to create a NodeSet from keys list returned by walk() ns_getter = lambda x: NodeSet.fromlist(x[1]) for nodeset in sorted(imap(ns_getter, tree.walk()), cmp=nodeset_cmp): if line_mode: print_lines(nodeset, tree[nodeset[0]]) else: print_... |
print_lines(node, tree[node]) | print_lines(node, tree[node], regroup, groupsource) | def display(tree, line_mode, gather): """Display results""" try: if gather: # lambda to create a NodeSet from keys list returned by walk() ns_getter = lambda x: NodeSet.fromlist(x[1]) for nodeset in sorted(imap(ns_getter, tree.walk()), cmp=nodeset_cmp): if line_mode: print_lines(nodeset, tree[nodeset[0]]) else: print_... |
print_buffer(node, tree[node]) | print_buffer(node, tree[node], regroup, groupsource) | def display(tree, line_mode, gather): """Display results""" try: if gather: # lambda to create a NodeSet from keys list returned by walk() ns_getter = lambda x: NodeSet.fromlist(x[1]) for nodeset in sorted(imap(ns_getter, tree.walk()), cmp=nodeset_cmp): if line_mode: print_lines(nodeset, tree[nodeset[0]]) else: print_... |
help="gather nodes with same output (-c is provided for " \ "dshbak compatibility)") | help="gather nodes with same output (-c is provided " \ "for dshbak compatibility)") | def clubak(): """Main clubak script function""" # # Argument management # usage = "%prog [-bcdL]" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) # Set parsing to stop on the first non-option parser.disable_interspersed_args() parser.add_option("-b", "-c", action="store_true", dest="gather", ... |
display(tree, options.line_mode, options.gather) | display(tree, options.line_mode, options.gather, options.regroup, options.groupsource) sys.exit(0) | def clubak(): """Main clubak script function""" # # Argument management # usage = "%prog [-bcdL]" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) # Set parsing to stop on the first non-option parser.disable_interspersed_args() parser.add_option("-b", "-c", action="store_true", dest="gather", ... |
sys.exit(0) | except NodeSetExternalError, e: print >> sys.stderr, "clubak: external error:", e sys.exit(1) | def clubak(): """Main clubak script function""" # # Argument management # usage = "%prog [-bcdL]" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) # Set parsing to stop on the first non-option parser.disable_interspersed_args() parser.add_option("-b", "-c", action="store_true", dest="gather", ... |
user_interaction = not options.nostdin and sys.stdin.isatty() and \ sys.stdout.isatty() | user_interaction = False if not options.nostdin: stdin_isafgtty = sys.stdin.isatty() and \ os.tcgetpgrp(sys.stdin.fileno()) == os.getpgrp() stdout_isafgtty = sys.stdout.isatty() and \ os.tcgetpgrp(sys.stdout.fileno()) == os.getpgrp() user_interaction = stdin_isafgtty and stdout_isafgtty | def main(args=sys.argv): """clush script entry point""" sys.excepthook = clush_excepthook # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = OptionParser(usage) parser.add_option("--nostdin", action="store_true", dest="nostdin",... |
task.set_default("USER_stdin_worker", not (sys.stdin.isatty() or | task.set_default("USER_stdin_worker", not (sys.stdin.isatty() or \ | def main(args=sys.argv): """clush script entry point""" sys.excepthook = clush_excepthook # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = OptionParser(usage) parser.add_option("--nostdin", action="store_true", dest="nostdin",... |
print "Keyboard interrupt (%s did not complete)." % u_nodes else: print "Keyboard interrupt." | print >>sys.stderr, "Keyboard interrupt (%s did not complete)." % u_nodes else: print >>sys.stderr, "Keyboard interrupt." | def clush_main(args): """Main clush script function""" # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) parser.disable_interspersed_args() # Node selections optgr... |
def __str__(self): return "current task already running" | def __str__(self): return "current task already running" | |
raise AlreadyRunningError() | raise AlreadyRunningError("task engine is already running") | def _resume(self): assert self.thread == threading.currentThread() try: try: self._reset() self._run(self.timeout) except EngineTimeoutException: raise TimeoutError() except EngineAbortException, e: self._terminate(e.kill) except EngineAlreadyRunningError: raise AlreadyRunningError() except: raise finally: # task becom... |
self.display.vprint(VERB_STD, \ | display.vprint(VERB_STD, \ | def ttyloop(task, nodeset, timeout, display): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass self.display.vprint(VERB_STD, \ "Enter 'quit' to lea... |
self.display.vprint(VERB_QUIET, \ "Working with nodes: %s" % ns) | display.vprint(VERB_QUIET, \ "Working with nodes: %s" % ns) | def ttyloop(task, nodeset, timeout, display): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass self.display.vprint(VERB_STD, \ "Enter 'quit' to lea... |
self.display.vprint_err(VERB_STD, \ | display.vprint_err(VERB_STD, \ | def ttyloop(task, nodeset, timeout, display): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass self.display.vprint(VERB_STD, \ "Enter 'quit' to lea... |
self.display.vprint_err(VERB_QUIET, \ | display.vprint_err(VERB_QUIET, \ | def ttyloop(task, nodeset, timeout, display): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass self.display.vprint(VERB_STD, \ "Enter 'quit' to lea... |
self.display.vprint_err(VERB_QUIET, "clush: interrupt (^C to " \ | display.vprint_err(VERB_QUIET, "clush: interrupt (^C to " \ | def ttyloop(task, nodeset, timeout, display): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass self.display.vprint(VERB_STD, \ "Enter 'quit' to lea... |
self._set_reading() | self._set_reading_error() | def _readerr(self, size=-1): """ Read error from process. """ result = self.file_error.read(size) if not len(result): raise EngineClientEOF() self._set_reading() return result |
rc = 0 | def clush_main(args): """Main clush script function""" # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) parser.disable_interspersed_args() # Node selections optgr... | |
clush_exit(task.max_retcode()) else: clush_exit(0) | rc = task.max_retcode() if task.num_timeout() > 0: rc = 255 clush_exit(rc) | def clush_main(args): """Main clush script function""" # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) parser.disable_interspersed_args() # Node selections optgr... |
clients = self.task._engine.clients() cnt = len(clients) | cnt = len(self.task._engine.clients()) | def update(self): clients = self.task._engine.clients() cnt = len(clients) if cnt != self.cnt_last: self.cnt_last = cnt # display completed/total clients towrite = 'clush: %*d/%*d\r' % (self.tslen, self.total - cnt, self.tslen, self.total) self.wholelen = len(towrite) sys.stderr.write(towrite) |
verbosity, gather_info) | verbosity, (gather_print, regroup, namespace)) | def ttyloop(task, nodeset, gather, timeout, label, verbosity, (gather_print, regroup, namespace)): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass... |
gather_info) | (gather_print, regroup, namespace)) | def ttyloop(task, nodeset, gather, timeout, label, verbosity, (gather_print, regroup, namespace)): """Manage the interactive prompt to run command""" readline_avail = False if task.default("USER_interactive"): assert sys.stdin.isatty() try: import readline readline_setup() readline_avail = True except ImportError: pass... |
worker.task.set_info("USER_running", False) if worker.task.info("USER_handle_SIGHUP"): os.kill(os.getpid(), signal.SIGHUP) | worker.task.set_default("USER_running", False) if worker.task.default("USER_handle_SIGUSR1"): os.kill(os.getpid(), signal.SIGUSR1) | def ev_close(self, worker): # Notify main thread to update its prompt worker.task.set_info("USER_running", False) if worker.task.info("USER_handle_SIGHUP"): os.kill(os.getpid(), signal.SIGHUP) |
self._runtimer.eh.finalize(worker.task.info("USER_interactive")) | self._runtimer.eh.finalize(worker.task.default("USER_interactive")) | def ev_close(self, worker): # Worker is closing -- it's time to gather results... if self._runtimer: self._runtimer.eh.finalize(worker.task.info("USER_interactive")) |
worker.task.set_info("USER_running", False) if worker.task.info("USER_handle_SIGHUP"): os.kill(os.getpid(), signal.SIGHUP) | worker.task.set_default("USER_running", False) if worker.task.default("USER_handle_SIGUSR1"): os.kill(os.getpid(), signal.SIGUSR1) | def ev_close(self, worker): # Worker is closing -- it's time to gather results... if self._runtimer: self._runtimer.eh.finalize(worker.task.info("USER_interactive")) |
if signum == signal.SIGHUP: | if signum == signal.SIGUSR1: | def signal_handler(signum, frame): """Signal handler used for main thread notification""" if signum == signal.SIGHUP: raise UpdatePromptException() |
if task.info("USER_interactive"): | if task.default("USER_interactive"): | def ttyloop(task, nodeset, gather, timeout, label, verbosity): """Manage the interactive prompt to run command""" has_readline = False if task.info("USER_interactive"): assert sys.stdin.isatty() readline_avail = False try: import readline readline_setup() readline_avail = True except ImportError: pass if verbosity >= V... |
while task.info("USER_running") or cmd.lower() != 'quit': | while task.default("USER_running") or cmd.lower() != 'quit': | def ttyloop(task, nodeset, gather, timeout, label, verbosity): """Manage the interactive prompt to run command""" has_readline = False if task.info("USER_interactive"): assert sys.stdin.isatty() readline_avail = False try: import readline readline_setup() readline_avail = True except ImportError: pass if verbosity >= V... |
if task.info("USER_interactive") and not task.info("USER_running"): | if task.default("USER_interactive") and not task.default("USER_running"): | def ttyloop(task, nodeset, gather, timeout, label, verbosity): """Manage the interactive prompt to run command""" has_readline = False if task.info("USER_interactive"): assert sys.stdin.isatty() readline_avail = False try: import readline readline_setup() readline_avail = True except ImportError: pass if verbosity >= V... |
signal.signal(signal.SIGHUP, signal.SIG_IGN) | signal.signal(signal.SIGUSR1, signal.SIG_IGN) | def ttyloop(task, nodeset, gather, timeout, label, verbosity): """Manage the interactive prompt to run command""" has_readline = False if task.info("USER_interactive"): assert sys.stdin.isatty() readline_avail = False try: import readline readline_setup() readline_avail = True except ImportError: pass if verbosity >= V... |
if task.info("USER_running"): | if task.default("USER_running"): | def ttyloop(task, nodeset, gather, timeout, label, verbosity): """Manage the interactive prompt to run command""" has_readline = False if task.info("USER_interactive"): assert sys.stdin.isatty() readline_avail = False try: import readline readline_setup() readline_avail = True except ImportError: pass if verbosity >= V... |
task.set_info("USER_running", True) | task.set_default("USER_running", True) | def run_command(task, cmd, ns, gather, timeout, label, verbosity): """ Create and run the specified command line, displaying results in a dshbak way when gathering is used. """ task.set_info("USER_running", True) if gather: runtimer = None if verbosity == VERB_STD or verbosity == VERB_VERB: # Create a ClusterShell tim... |
task.set_info("USER_running", True) | task.set_default("USER_running", True) | def run_copy(task, source, dest, ns, timeout, preserve_flag): """ run copy command """ task.set_info("USER_running", True) # Source check if not os.path.exists(source): print >>sys.stderr, "ERROR: file \"%s\" not found" % source clush_exit(1) worker = task.copy(source, dest, ns, handler=DirectOutputHandler(), timeout... |
for line in buf.splitlines(): | for line in buf: | def clush_main(args): """Main clush script function""" # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) parser.disable_interspersed_args() # Node selections optgr... |
signal.signal(signal.SIGHUP, signal_handler) task.set_info("USER_handle_SIGHUP", True) | signal.signal(signal.SIGUSR1, signal_handler) task.set_default("USER_handle_SIGUSR1", True) | def clush_main(args): """Main clush script function""" # Default values nodeset_base, nodeset_exclude = NodeSet(), NodeSet() # # Argument management # usage = "%prog [options] command" parser = optparse.OptionParser(usage, version="%%prog %s" % __version__) parser.disable_interspersed_args() # Node selections optgr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.