rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
print "e.g. \"( true & false | ( true & !true ) )\"" | print "e.g. \"( true & false | ( true & ! true ) )\"" | def infix_to_prefix(expr): """converts the infix expression to prefix using the shunting yard algorithm""" ops = [] results = [] for token in tokenize(expr): #print ops, results if is_op(token): #If the token is an operator, o1, then: #while there is an operator token, o2, at the top of the stack, and #either o1 is lef... | e767b12033e64b5042fe38b01fa3dd7f6b9765d9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14576/e767b12033e64b5042fe38b01fa3dd7f6b9765d9/shuntingyard.py |
v = obj.Schema().getField(field).get(obj, mimetype="text/plain") | v = obj.Schema().getField(field).getRaw(obj) | def get(self, obj, field, context=None): """ """ v = obj.Schema().getField(field).get(obj, mimetype="text/plain") return v | 17ab13941f03c72a692c09805275c64163d96d17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/17ab13941f03c72a692c09805275c64163d96d17/base.py |
f = str(f.data) full_path = os.path.join(parent_path, filename) try: full_path = full_path.encode('ascii') except: try: full_path = full_path.decode('utf-8').encode('ascii') except: pass zip.writestr(full_path, f) | fdata = str(f.data) full_path = os.path.join(parent_path, zip_filename) zip.writestr(full_path, fdata) | def get(self, obj, field, context=None, zip=None, parent_path=''): """ """ f = obj.Schema().getField(field).get(obj) if not f : return '' else: filename = f.filename if zip is not None: #logger.error(obj.Schema().getField(field).getType()) if obj.Schema().getField(field).getType() in \ ("plone.app.blob.subtypes.file.Ex... | 40041ba04503cafee99b4c2bb76a7457a842b91a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/40041ba04503cafee99b4c2bb76a7457a842b91a/file.py |
obj = getattr(container.aq_explicit, id, None) if obj is None: | oids = container.objectIds() if not id in oids: | def importObject(self, row, specific_fields, type, conflict_winner, export_date, wf_transition, zip, encoding='utf-8', ignore_content_errors=False, plain_format=False): """ """ modified = False is_new_object = False protected = True parent_path = row[0] id = row[1] type_class = row[2] if parent_path == "": container = ... | 46dc04825b3abad9211bd86f96a3401a73c44f6b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/46dc04825b3abad9211bd86f96a3401a73c44f6b/replicator.py |
obj = getattr(container.aq_explicit, id) | def importObject(self, row, specific_fields, type, conflict_winner, export_date, wf_transition, zip, encoding='utf-8', ignore_content_errors=False, plain_format=False): """ """ modified = False is_new_object = False protected = True parent_path = row[0] id = row[1] type_class = row[2] if parent_path == "": container = ... | 46dc04825b3abad9211bd86f96a3401a73c44f6b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/46dc04825b3abad9211bd86f96a3401a73c44f6b/replicator.py | |
def importObject(self, row, specific_fields, type, conflict_winner, export_date, wf_transition, zip, encoding='utf-8', ignore_content_errors=False, plain_format=False): """ """ modified = False is_new_object = False protected = True parent_path = row[0] id = row[1] type_class = row[2] if parent_path == "": container = ... | 7b3f44a7192a2b3d019b344d69aa6f88161972ce /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/7b3f44a7192a2b3d019b344d69aa6f88161972ce/replicator.py | ||
else: | obj = getattr(container.aq_explicit, id, None) if not is_new_object: | def importObject(self, row, specific_fields, type, conflict_winner, export_date, wf_transition, zip, encoding='utf-8', ignore_content_errors=False, plain_format=False): """ """ modified = False is_new_object = False protected = True parent_path = row[0] id = row[1] type_class = row[2] if parent_path == "": container = ... | 7b3f44a7192a2b3d019b344d69aa6f88161972ce /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/7b3f44a7192a2b3d019b344d69aa6f88161972ce/replicator.py |
obj = getattr(container.aq_explicit, id, None) | def importObject(self, row, specific_fields, type, conflict_winner, export_date, wf_transition, zip, encoding='utf-8', ignore_content_errors=False, plain_format=False): """ """ modified = False is_new_object = False protected = True parent_path = row[0] id = row[1] type_class = row[2] if parent_path == "": container = ... | 7b3f44a7192a2b3d019b344d69aa6f88161972ce /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/7b3f44a7192a2b3d019b344d69aa6f88161972ce/replicator.py | |
zip.writestr(os.path.join(parent_path, filename), f) | full_path = os.path.join(parent_path, filename) try: full_path = full_path.encode('ascii') except: try: full_path = full_path.decode('utf-8').encode('ascii') except: pass zip.writestr(full_path, f) | def get(self, obj, field, context=None, zip=None, parent_path=''): """ """ f = obj.Schema().getField(field).get(obj) if not f : return '' else: filename = f.filename if zip is not None: #logger.error(obj.Schema().getField(field).getType()) if obj.Schema().getField(field).getType() in \ ("plone.app.blob.subtypes.file.Ex... | 7405b193fcff1eee7ce5c52a04579d29315bcb33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11226/7405b193fcff1eee7ce5c52a04579d29315bcb33/file.py |
query = """INSERT INTO cmtSUBSCRIPTION (id_bibrec, id_user, creation_time) | query = """INSERT INTO cmtSUBSCRIPTION (id_bibrec, id_user, creation_time) | def subscribe_user_to_discussion(recID, uid): """ Subscribe a user to a discussion, so the she receives by emails all new new comments for this record. @param recID: record ID corresponding to the discussion we want to subscribe the user @param uid: user id """ query = """INSERT INTO cmtSUBSCRIPTION (id_bibrec, id_use... | 0a1e261095ef1900914b1aa5807b70e51080d1f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3302/0a1e261095ef1900914b1aa5807b70e51080d1f1/webcomment.py |
res = run_sql(query, params) | run_sql(query, params) | def subscribe_user_to_discussion(recID, uid): """ Subscribe a user to a discussion, so the she receives by emails all new new comments for this record. @param recID: record ID corresponding to the discussion we want to subscribe the user @param uid: user id """ query = """INSERT INTO cmtSUBSCRIPTION (id_bibrec, id_use... | 0a1e261095ef1900914b1aa5807b70e51080d1f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3302/0a1e261095ef1900914b1aa5807b70e51080d1f1/webcomment.py |
def calculate_start_date(display_since): """ Private function Returns the datetime of display_since argument in MYSQL datetime format calculated according to the local time. @param display_since: = all= no filtering nd = n days ago nw = n weeks ago nm = n months ago ny = n years ago where n is a single digit number @r... | b3331e5a9c1da552c6ace8d0804aa3e4e7916f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3302/b3331e5a9c1da552c6ace8d0804aa3e4e7916f01/webcomment.py | ||
if nb > today.month-1: | if nb > today.month-1: | def calculate_start_date(display_since): """ Private function Returns the datetime of display_since argument in MYSQL datetime format calculated according to the local time. @param display_since: = all= no filtering nd = n days ago nw = n weeks ago nm = n months ago ny = n years ago where n is a single digit number @r... | b3331e5a9c1da552c6ace8d0804aa3e4e7916f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3302/b3331e5a9c1da552c6ace8d0804aa3e4e7916f01/webcomment.py |
d = dict(zip(s, [1234]*len(s))) self.assertEqual(rencode.loads(rencode.dumps(d)), d) | d = dict(zip(s, ["foo"*120]*len(s))) d2 = {"foo": d, "bar": d, "baz": d} self.assertEqual(rencode.loads(rencode.dumps(d2)), d2) | def test_decode_dict(self): s = "abcdefghijklmnopqrstuvwxyz1234567890" d = dict(zip(s, [1234]*len(s))) self.assertEqual(rencode.loads(rencode.dumps(d)), d) | 01ec9f169ee1736935a252f0b029cdaf51bb1dba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5961/01ec9f169ee1736935a252f0b029cdaf51bb1dba/test_rencode.py |
log.info( "Instance '%s' found alive." % reservation.instances[0].id ) | log.info( "Instance '%s' found alive. Restarting instance so it can register with the master." % reservation.instances[0].id ) ec2_conn.reboot_instances([reservation.instances[0].id]) | def get_worker_instances( self ): instances = [] if self.app.TESTFLAG is True: # for i in range(5): # instance = Instance( self.app, inst=None, m_state="Pending" ) # instance.id = "WorkerInstance" # instances.append(instance) return instances log.debug("Trying to discover any worker instances associated wit... | d943af084217bc17559783cb9d670cf3afc6a237 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/d943af084217bc17559783cb9d670cf3afc6a237/master.py |
log.info( "Setting up Galaxy" ) | log.info( "Setting up Galaxy application" ) | def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy... | 0b22386a42579657e2d68650b928181fb4bb4eee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/0b22386a42579657e2d68650b928181fb4bb4eee/galaxy.py |
if os.path.exists('/mnt/galaxyIndices/locfiles/sam_fa_indices.loc'): shutil.copy('/mnt/galaxyIndices/locfiles/sam_fa_indices.loc', '/mnt/galaxyTools/galaxy-central/tool-data/sam_fa_indices.loc') | def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy... | 0b22386a42579657e2d68650b928181fb4bb4eee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/0b22386a42579657e2d68650b928181fb4bb4eee/galaxy.py | |
try: misc.run("cd %s; sed 's/pyhton/python -ES/g' setup.sh > setup.sh.custom" % self.galaxy_home, "Failed to edit setup.sh", "Successfully adjusted setup.sh") shutil.copy( self.galaxy_home + '/setup.sh.custom', self.galaxy_home + '/setup.sh' ) os.chown( self.galaxy_home + '/setup.sh', pwd.getpwnam( "galaxy" )[2], grp.g... | def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy... | 0b22386a42579657e2d68650b928181fb4bb4eee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/0b22386a42579657e2d68650b928181fb4bb4eee/galaxy.py | |
with open('/etc/profile', 'a') as f: f.write('export PATH=/mnt/galaxyTools/tools/bin:/mnt/galaxyTools/tools/pkg/fastx_toolkit_0.0.13:/mnt/galaxyTools/tools/pkg/bowtie-0.12.5:/mnt/galaxyTools/tools/pkg/samtools-0.1.7_x86_64-linux:/mnt/galaxyTools/tools/pkg/gnuplot-4.4.0/bin:/opt/PostgreSQL/8.4/bin:$PATH\n') os.chown(sel... | def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy... | 0b22386a42579657e2d68650b928181fb4bb4eee /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/0b22386a42579657e2d68650b928181fb4bb4eee/galaxy.py | |
'snapshot' : {'progress' : str(self.app.manager.snapshot_progress), 'status' : str(self.app.manager.snapshot_status)}, | 'snapshot' : {'progress' : str(ss_progress), 'status' : str(ss_status)}, | def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d... | b092e742642def3940eb5e198e3e5499ba9b8cf5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/b092e742642def3940eb5e198e3e5499ba9b8cf5/root.py |
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): | def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/galaxy-central"): | def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository... | 78a047bc5efd72a9276af90a4f65e67acf0949a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/78a047bc5efd72a9276af90a4f65e67acf0949a8/root.py |
misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository)) misc.run('su galaxy -c "cd %s; sh setup.sh; sh manage_db.sh upgrade"' % (paths.P_GALAXY_HOME)) | cmd = '%s - galaxy -c "cd %s; hg --config ui.merge=internal:local pull %s --update"' % (paths.P_SU, paths.P_GALAXY_HOME, repository) retval = os.system(cmd) log.debug("Galaxy update cmd '%s'; return value %s" % (cmd, retval)) cmd = '%s - galaxy -c "cd %s; sh manage_db.sh upgrade"' % (paths.P_SU, paths.P_GALAXY_HOME) re... | def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository... | 78a047bc5efd72a9276af90a4f65e67acf0949a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/78a047bc5efd72a9276af90a4f65e67acf0949a8/root.py |
service.add() | service.start() log.debug("Done updating Galaxy") | def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository... | 78a047bc5efd72a9276af90a4f65e67acf0949a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/78a047bc5efd72a9276af90a4f65e67acf0949a8/root.py |
<input type="text" value="http://bitbucket.org/galaxy/cloudman" name="repository"> | <input type="text" value="http://bitbucket.org/galaxy/galaxy-central" name="repository"> | def admin(self, trans): return """ <ul> <li>This admin panel is only a very temporary way to control galaxy services. Use with caution.</li> <li><strong>Service Control</strong></li> <li><a href='manage_galaxy'>Start Galaxy</a></li> <li><a href='manage_galaxy?to_be_started=False'>Stop Galaxy</a></li> <form action="upd... | 78a047bc5efd72a9276af90a4f65e67acf0949a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/78a047bc5efd72a9276af90a4f65e67acf0949a8/root.py |
worker_ud['password'] = self.app.ud['password'] | if self.app.ud.has_key('password'): worker_ud['password'] = self.app.ud['password'] | def add_instances( self, num_nodes, instance_type=''): num_nodes = int( num_nodes ) ec2_conn = self.app.cloud_interface.get_ec2_connection() log.info( "Adding %s instance(s)..." % num_nodes ) # Compose worker instance user data worker_ud = {} worker_ud['access_key'] = self.app.ud['access_key'] worker_ud['secret_key'] =... | b5a8fb4b17a65058e4bce4310dac3d156b9dafc6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/b5a8fb4b17a65058e4bce4310dac3d156b9dafc6/master.py |
self.app.manager.update_users_CM() return trans.fill_template('index.mako') | return to_json_string({'updated':self.app.manager.update_users_CM()}) | def update_users_CM(self, trans): self.app.manager.update_users_CM() return trans.fill_template('index.mako') | 157057b13f5380edd7fc3e58057f038ada42bdbd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/157057b13f5380edd7fc3e58057f038ada42bdbd/root.py |
CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" ) | def get_CM_url(self, trans): CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" ) changesets = self.app.manager.check_for_new_version_of_CM() if changesets.has_key('default_CM_rev') and changesets.has_key('user_CM_rev'): try: num_changes = int(changesets['default_CM_rev']) - int... | f91170760a7e8b495377486bc187299e52c2b543 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/f91170760a7e8b495377486bc187299e52c2b543/root.py | |
return CM_url | return None | def get_CM_url(self, trans): CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" ) changesets = self.app.manager.check_for_new_version_of_CM() if changesets.has_key('default_CM_rev') and changesets.has_key('user_CM_rev'): try: num_changes = int(changesets['default_CM_rev']) - int... | f91170760a7e8b495377486bc187299e52c2b543 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/f91170760a7e8b495377486bc187299e52c2b543/root.py |
import time if time.gmtime().tm_sec < 20 or time.gmtime().tm_sec > 40: ss_status = "Working" ss_progress = (time.gmtime().tm_sec % 20) * 5 else: ss_progress = None ss_status = None | def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d... | ae4e0df8e2176479c03ed851987eb5a12a9836e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/ae4e0df8e2176479c03ed851987eb5a12a9836e1/root.py | |
'snapshot' : {'progress' : str(ss_progress), 'status' : str(ss_status)}, | 'snapshot' : {'progress' : str(self.app.manager.snapshot_progress), 'status' : str(self.app.manager.snapshot_status)}, | def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d... | ae4e0df8e2176479c03ed851987eb5a12a9836e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11241/ae4e0df8e2176479c03ed851987eb5a12a9836e1/root.py |
self.reconnecting = False | def __init__(self, owner_bot, xmpp_room_jid, irc_room, irc_server, mode, say_level, irc_port=6667, irc_connection_interval=None, irc_charsets=None): """Create a new bridge.""" self.bot = owner_bot self.irc_server = irc_server self.irc_port = irc_port self.irc_room = irc_room.lower() self.irc_connection_interval = irc_c... | c452eafaa4502bd655de3d0dd9d7fef0daa19247 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/c452eafaa4502bd655de3d0dd9d7fef0daa19247/bridge.py | |
except ServerNotConnectedError: | except irclib.ServerNotConnectedError: | def _say_on_irc(self, message): try: self.irc_connection.privmsg(self.irc_room, message) except ServerNotConnectedError: bridges = self.bot.iter_bridges(irc_server=self.irc_server) self.bot.restart_bridges_delayed(bridges, 0, say_levels.error, 'Lost bot IRC connection', protocol='irc') | 6d1b546fd869783fb1fb175db6562a88a674cc5c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/6d1b546fd869783fb1fb175db6562a88a674cc5c/bridge.py |
except ServerNotConnectedError: c = e.args[1] | except ServerNotConnectedError as e: if len(e.args) > 0: c = e.args[0] else: self.bot.error(say_levels.error, 'Unkonwn exception on IRC thread:\n'+str(e.args)) continue | def process_forever(self, timeout=0.2): """Run an infinite loop, processing data from connections. | 3b8fce5d1026baa024494243f1b3178ac3c79c67 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/3b8fce5d1026baa024494243f1b3178ac3c79c67/irclib.py |
self.irc_id = prefix if DEBUG: print "irc_id: %s" % (prefix) | if self.irc_id != prefix: self.irc_id = prefix if DEBUG: print "irc_id: %s" % (prefix) | def process_data(self): """[Internal]""" | 29f0268dfee4fc0977650ea17c594b7a7db4c172 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/29f0268dfee4fc0977650ea17c594b7a7db4c172/irclib.py |
if command in ["nick", "welcome"]: self.logged_in = True self.real_nickname = arguments[0] if self.new_nickname != arguments[0]: if len(self.new_nickname) > len(arguments[0]): self._handle_event(Event('nicknametoolong', None, None, None)) else: self._handle_event(Event('erroneusnickname', None, None, None)) else: self.... | def process_data(self): """[Internal]""" | 129d2ef4b8971c2d1bed3c6006a3b5ffcc9e52ab /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/129d2ef4b8971c2d1bed3c6006a3b5ffcc9e52ab/irclib.py | |
elif self.socket: | elif self.socket and hasattr(self.socket, 'recv'): | def process_data(self): """[Internal]""" | 833c88a06c7ad5b6080ab3800aa7127dcbe98dda /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/833c88a06c7ad5b6080ab3800aa7127dcbe98dda/irclib.py |
leave_message = 'kicked by '+nickname | leave_message = 'kicked by '+source_nickname | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 5b31c83aeeeacecbc60b62e840741ce8f9d005cf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/5b31c83aeeeacecbc60b62e840741ce8f9d005cf/bot.py |
if not self.mode: | if self.stopped: | def _irc_nick_callback(self, error, arguments=None): if not error: if not self.mode: return self.irc_connection.join(self.irc_room, callback=self._irc_join_callback) else: self.mode = None self.say(say_levels.error, 'failed to connect to the IRC chan, leaving ...', on_irc=False) if error in ['nicknameinuse', 'nickcoll... | 1c428761fad5529b2fa3940d261d3286f3d1fd2e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/1c428761fad5529b2fa3940d261d3286f3d1fd2e/bridge.py |
self.mode = None | self.stopped = True | def _irc_nick_callback(self, error, arguments=None): if not error: if not self.mode: return self.irc_connection.join(self.irc_room, callback=self._irc_join_callback) else: self.mode = None self.say(say_levels.error, 'failed to connect to the IRC chan, leaving ...', on_irc=False) if error in ['nicknameinuse', 'nickcoll... | 1c428761fad5529b2fa3940d261d3286f3d1fd2e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/1c428761fad5529b2fa3940d261d3286f3d1fd2e/bridge.py |
if not self.mode: | if self.stopped: | def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: self.reconnecting = False if not self.mode: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'+str(self)+'" is running in '+self... | 1c428761fad5529b2fa3940d261d3286f3d1fd2e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/1c428761fad5529b2fa3940d261d3286f3d1fd2e/bridge.py |
self.mode = None | self.stopped = True | def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: self.reconnecting = False if not self.mode: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'+str(self)+'" is running in '+self... | 1c428761fad5529b2fa3940d261d3286f3d1fd2e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/1c428761fad5529b2fa3940d261d3286f3d1fd2e/bridge.py |
self.error('==> Debug: Received XMPP message of unknown type "'+message.getType()+'".', debug=True) | self.error('==> Debug: Received XMPP message of unknown type "'+str(message.getType())+'".', debug=True) | def _xmpp_message_handler(self, dispatcher, message): """[Internal] Manage XMPP messages.""" xmpp_c = dispatcher._owner if message.getBody() == None: return if message.getType() == 'chat': from_bare_jid = unicode(message.getFrom().getNode()+'@'+message.getFrom().getDomain()) for bridge in self.bridges: if from_bare_... | 0b470413dd5d970912c875ad51d84d2d99c7c36d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/0b470413dd5d970912c875ad51d84d2d99c7c36d/bot.py |
raise Exception('[Error] unknown error for "'+self.bot.nickname+'" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0])) | raise Exception('[Error] unknown error for "'+self.bot.nickname+'" on bridge "'+str(self)+'"') | def _irc_nick_callback(self, error, arguments=[]): if error == None: if self.mode == None: return self.irc_connection.join(self.irc_room) self.bot.error('===> Debug: successfully connected on IRC side of bridge "'+str(self)+'"', debug=True) self.say('[Notice] bridge "'+str(self)+'" is running in '+self.mode+' mode', on... | ce50101a01b0559af8845fa4c4bfbc1432c29caf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/ce50101a01b0559af8845fa4c4bfbc1432c29caf/bridge.py |
ret += ' - say_level='+bridge._say_levels[b.say_level] | ret += ' - say_level='+Bridge._say_levels[b.say_level] | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | 275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e/bot.py |
parser.add_argument('--mode', choices=bridge._modes, default='normal') parser.add_argument('--say-level', choices=bridge._say_levels, default='all') | parser.add_argument('--mode', choices=Bridge._modes, default='normal') parser.add_argument('--say-level', choices=Bridge._say_levels, default='all') | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | 275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e/bot.py |
bridges = self.findBridges(args_array) | bridges = self.findBridges(args_array[0]) | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | 275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e/bot.py |
return 'No bridge found matching "'+' '.join(args_array)+'". '+self.respond('bridges') | return 'No bridge found matching "'+args_array[0]+'". '+self.respond('bridges') | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | 275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e/bot.py |
return 'More than one bridge matches "'+' '.join(args_array)+'", please be more specific. '+self.respond('bridges') | return 'More than one bridge matches "'+args_array[0]+'", please be more specific. '+self.respond('bridges') | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | 275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/275ec36042aca0f6bbdba8a20d1dc9ac7d0bf12e/bot.py |
if isinstance(self.xmpp_c, xmpp.client.Client): self.bridge.bot.close_xmpp_connection(self.nickname) self.xmpp_c = None | self._close_xmpp_connection() | def _xmpp_join_callback(self, errors): if len(errors) == 0: m = '"'+self.nickname+'" duplicate succesfully created on XMPP side of bridge "'+str(self.bridge)+'"' if self.nickname != self.duplicate_nickname: m += ' using nickname "'+self.duplicate_nickname+'"' self.bridge.say(say_levels.info, '"'+self.nickname+'" will a... | 165527f248716d349e5a71d2c46d0acb7618f09d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/165527f248716d349e5a71d2c46d0acb7618f09d/participant.py |
if event.eventtype() == 'quit' and ( bridge.mode != 'normal' or isinstance(from_.irc_connection, irclib.ServerConnection) ): continue | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | e03914fb70c84a5cbb53ca2fda4efa26003363d9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/e03914fb70c84a5cbb53ca2fda4efa26003363d9/bot.py | |
self.disconnect("Connection reset by peer.") | self.disconnect("Connection reset by peer") | def send_raw(self, string): """Send raw string to the server. | 30d79e85854b7dc034c00c4ae9de3eb9fcf959b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/30d79e85854b7dc034c00c4ae9de3eb9fcf959b0/irclib.py |
self.disconnect("Connection reset by peer.") | self.disconnect("Connection reset by peer") | def privmsg(self, string): """Send data to DCC peer. | 30d79e85854b7dc034c00c4ae9de3eb9fcf959b0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/30d79e85854b7dc034c00c4ae9de3eb9fcf959b0/irclib.py |
for bridge in [b for b in bridges]: | for bridge in self.bridges: | def findBridges(self, str_array): # TODO: lock self.bridges for thread safety bridges = [b for b in self.bridges] for bridge in [b for b in bridges]: for s in str_array: if not s in str(bridge): bridges.remove(bridge) break return bridges | c93a7ccdc6c9b4ab53659246a60b0508a00f7633 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/c93a7ccdc6c9b4ab53659246a60b0508a00f7633/bot.py |
self.error(say_levels.debug, 'a source is needed for a '+event.eventtype()+' event', no_debug_add=event_str) return if event.eventtype() == 'kick' and len(event.arguments()) == 0: self.error(say_levels.debug, 'at least 1 argument is needed for a '+event.eventtype()+' event', no_debug_add=event_str) return if event.ev... | self.error(say_levels.debug, 'a source is needed for a '+event.eventtype()+' event'+event_str) return if event.eventtype() in ['kick', 'mode'] and len(event.arguments()) == 0: self.error(say_levels.debug, 'at least 1 argument is needed for a '+event.eventtype()+' event'+event_str) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 63ac797d46d708b05ad3e73b81c316969f231103 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/63ac797d46d708b05ad3e73b81c316969f231103/bot.py |
self.error(2, debug_str, debug=True) self.error(say_levels.debug, 'a participant that was not here has been kicked ? WTF ?', no_debug_add=event_str) | self.error(say_levels.debug, 'a participant that was not here has been kicked ? WTF ?'+event_str) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 63ac797d46d708b05ad3e73b81c316969f231103 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/63ac797d46d708b05ad3e73b81c316969f231103/bot.py |
if event.arguments()[1] != self.nickname or not 'o' in event.arguments()[0]: self.error(1, 'ignoring IRC mode "'+event.arguments()[0]+'" for "'+event.arguments()[1]+'"', debug=True) return if re.search('\+[^\-]*o', event.arguments()[0]): bridge.irc_op = True self.error(say_levels.notice, 'bot has IRC operator privileg... | if len(event.arguments()) == 1: self.error(1, 'ignoring IRC mode "'+event.arguments()[0]+'" for chan "'+event.target()+'"', debug=True) elif len(event.arguments()) == 2: if event.arguments()[1] != self.nickname or not 'o' in event.arguments()[0]: self.error(1, 'ignoring IRC mode "'+event.arguments()[0]+'" for "'+even... | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 63ac797d46d708b05ad3e73b81c316969f231103 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/63ac797d46d708b05ad3e73b81c316969f231103/bot.py |
sockets = filter(lambda x: x != None, sockets) | sockets = filter(lambda x: x and not isinstance(x, basestring), sockets) | def process_once(self, timeout=0): """Process data from connections once. | 694949c3a9e94b59a3dfa01ca888716363ea23bc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/694949c3a9e94b59a3dfa01ca888716363ea23bc/irclib.py |
if not self.socket or self.socket == 'closed': | if not self.socket or isinstance(self.socket, basestring): | def send_raw(self, string): """Send raw string to the server. | 694949c3a9e94b59a3dfa01ca888716363ea23bc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/694949c3a9e94b59a3dfa01ca888716363ea23bc/irclib.py |
elif self.socket and self.socket != 'closed': | else: | def send_raw(self, string): """Send raw string to the server. | 694949c3a9e94b59a3dfa01ca888716363ea23bc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/694949c3a9e94b59a3dfa01ca888716363ea23bc/irclib.py |
if event.eventtype() in ['pubmsg', 'action', 'part', 'kick'] and not source_nickname: | if event.eventtype() in ['pubmsg', 'action', 'part', 'kick', 'join'] and not source_nickname: | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py |
bridge = self.get_bridge(irc_room=event.target().lower(), irc_server=connection.server) | if event.eventtype() == 'mode' and len(event.arguments()) < 2: self.error(say_levels.debug, '2 arguments are needed for a '+event.eventtype()+' event'+event_str) return chan = event.target().lower() bridge = self.get_bridge(irc_room=chan, irc_server=connection.server) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py |
self.error(say_levels.debug, 'a participant that wasn\'t here left:\n'+event_str) | self.error(say_levels.debug, 'a participant that wasn\'t here left:'+event_str) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py |
if len(event.arguments()) < 2: self.error(say_levels.debug, '2 arguments are needed for a '+event.eventtype()+' event\n'+event_str) return | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py | |
bridge = self.get_bridge(irc_room=event.target(), irc_server=connection.server) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py | |
self.error(say_levels.notice, 'bot has IRC operator privileges in '+event.target()) | self.error(say_levels.notice, 'bot has IRC operator privileges in '+chan) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py |
self.error(say_levels.notice, 'bot lost IRC operator privileges in '+event.target(), send_to_admins=True) | self.error(say_levels.notice, 'bot lost IRC operator privileges in '+chan, send_to_admins=True) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | f0063ab3776d327f4aa7ceb4013e4a2618f25b63 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f0063ab3776d327f4aa7ceb4013e4a2618f25b63/bot.py |
self.lock.acquire() | def addParticipant(self, from_protocol, nickname, real_jid=None, irc_id=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(... | 89bce1c8246e864b1a5a5de9c0335cb6e347e81d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/89bce1c8246e864b1a5a5de9c0335cb6e347e81d/bridge.py | |
except IOError: self.bot.error(3, 'IOError while adding participant "'+nickname+'" from "'+from_protocol+'" to bridge "'+str(self)+'", reconnectiong ...', debug=True) p.xmpp_c.reconnectAndReauth() | def addParticipant(self, from_protocol, nickname, real_jid=None, irc_id=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): self.bot.error(3, 'not adding self ('+self.bot.nickname+') to bridge "'+str(... | 89bce1c8246e864b1a5a5de9c0335cb6e347e81d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/89bce1c8246e864b1a5a5de9c0335cb6e347e81d/bridge.py | |
if hasattr(self, 'reconnecting'): del self.reconnecting | self.reconnecting = False | def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: if hasattr(self, 'reconnecting'): del self.reconnecting if self.mode == None: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'... | 2b146a80a7fc30f39c66b987530d6d9f418ec31f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/2b146a80a7fc30f39c66b987530d6d9f418ec31f/bridge.py |
if (from_protocol == 'irc' and nickname == self.irc_connection.get_nickname()) or (from_protocol == 'xmpp' and nickname == self.xmpp_room.nickname): | if (from_protocol == 'irc' and nickname == self.bot.nickname) or (from_protocol == 'xmpp' and nickname == self.bot.nickname): | def addParticipant(self, from_protocol, nickname, real_jid=None, irc_id=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.irc_connection.get_nickname()) or (from_protocol == 'xmpp' and nickname == self.xmpp_room.nickname): self.bot.error('===> Debug: not adding self ('+self.b... | 1640f287d8442c92907cfdb505ab3bfeae99b8c1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/1640f287d8442c92907cfdb505ab3bfeae99b8c1/bridge.py |
def restart(self, log=True): | def restart(self, message='Restarting bridge', log=True): | def restart(self, log=True): """Restart the bridge""" # Stop the bridge self.stop(message='Restarting bridge', log=log) # Recreate the bridge self.init2() | bee65239670c15723df88d30d2482975d45821af /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/bee65239670c15723df88d30d2482975d45821af/bridge.py |
self.stop(message='Restarting bridge', log=log) | self.stop(message=message, log=log) | def restart(self, log=True): """Restart the bridge""" # Stop the bridge self.stop(message='Restarting bridge', log=log) # Recreate the bridge self.init2() | bee65239670c15723df88d30d2482975d45821af /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/bee65239670c15723df88d30d2482975d45821af/bridge.py |
try: bot_say = False if message[:4] == '/me ': action = True message = message[4:] else: action = False if isinstance(self.irc_connection, ServerConnection): try: if action: self.irc_connection.action(self.bridge.irc_room, message) else: self.irc_connection.privmsg(self.bridge.irc_room, message) except ServerNotConnect... | bot_say = False if message[:4] == '/me ': action = True message = message[4:] else: action = False if isinstance(self.irc_connection, ServerConnection): try: if action: self.irc_connection.action(self.bridge.irc_room, message) else: self.irc_connection.privmsg(self.bridge.irc_room, message) except ServerNotConnectedErr... | def sayOnIRC(self, message): try: bot_say = False if message[:4] == '/me ': action = True message = message[4:] else: action = False if isinstance(self.irc_connection, ServerConnection): try: if action: self.irc_connection.action(self.bridge.irc_room, message) else: self.irc_connection.privmsg(self.bridge.irc_room, mes... | f927b30ff1c23546422090e563886a9083bb5bd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f927b30ff1c23546422090e563886a9083bb5bd3/participant.py |
if bot_say: if action: self.bridge.irc_connection.privmsg(self.bridge.irc_room, '* '+self.nickname+' '+message) else: self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) except EncodingException: self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an u... | elif not isinstance(self.xmpp_c, xmpp.client.Client): bot_say = True if bot_say: if action: self.bridge.irc_connection.privmsg(self.bridge.irc_room, '* '+self.nickname+' '+message) else: self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) | def sayOnIRC(self, message): try: bot_say = False if message[:4] == '/me ': action = True message = message[4:] else: action = False if isinstance(self.irc_connection, ServerConnection): try: if action: self.irc_connection.action(self.bridge.irc_room, message) else: self.irc_connection.privmsg(self.bridge.irc_room, mes... | f927b30ff1c23546422090e563886a9083bb5bd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f927b30ff1c23546422090e563886a9083bb5bd3/participant.py |
try: self.irc_connection.privmsg(to, message) except EncodingException: self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) | self.irc_connection.privmsg(to, message) | def sayOnIRCTo(self, to, message): if isinstance(self.irc_connection, ServerConnection): try: self.irc_connection.privmsg(to, message) except EncodingException: self.bridge.say(say_levels.warning, '"'+self.nickname+'" is sending messages using an unknown encoding', log=True) elif not isinstance(self.xmpp_c, xmpp.client... | f927b30ff1c23546422090e563886a9083bb5bd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f927b30ff1c23546422090e563886a9083bb5bd3/participant.py |
try: if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say(message) elif not isinstance(self.irc_connection, ServerConnection): if message[:4] == '/me ': self.bridge.xmpp_room.say('* '+self.nickname+' '+message[4:]) else: self.bridge.xmpp_room.say('<'+self.nickname+'> '+message) except EncodingException: self.br... | if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say(message) elif not isinstance(self.irc_connection, ServerConnection): if message[:4] == '/me ': self.bridge.xmpp_room.say('* '+self.nickname+' '+message[4:]) else: self.bridge.xmpp_room.say('<'+self.nickname+'> '+message) | def sayOnXMPP(self, message): try: if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.say(message) elif not isinstance(self.irc_connection, ServerConnection): if message[:4] == '/me ': self.bridge.xmpp_room.say('* '+self.nickname+' '+message[4:]) else: self.bridge.xmpp_room.say('<'+self.nickname+'> '+message) exc... | f927b30ff1c23546422090e563886a9083bb5bd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f927b30ff1c23546422090e563886a9083bb5bd3/participant.py |
try: if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.sayTo(to, message) elif not isinstance(self.irc_connection, ServerConnection): if self.bridge.mode != 'normal': self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') ... | if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.sayTo(to, message) elif not isinstance(self.irc_connection, ServerConnection): if self.bridge.mode != 'normal': self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') else:... | def sayOnXMPPTo(self, to, message): try: if isinstance(self.xmpp_c, xmpp.client.Client): self.muc.sayTo(to, message) elif not isinstance(self.irc_connection, ServerConnection): if self.bridge.mode != 'normal': self.bridge.getParticipant(to).sayOnXMPPTo(self.nickname, 'Sorry but cross-protocol private messages are disab... | f927b30ff1c23546422090e563886a9083bb5bd3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/f927b30ff1c23546422090e563886a9083bb5bd3/participant.py |
if not self.connected: return | def disconnect(self, message="", volontary=False): """Hang up the connection. | 8445c04d75ea5033ea75d46637922a54ab654cec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/8445c04d75ea5033ea75d46637922a54ab654cec/irclib.py | |
self.connected = False self.quit(message) try: self.socket.close() except socket.error, x: pass self.socket = 'closed' | if self.connected: self.connected = False if self.socket and self.socket != 'closed': self.quit(message) try: self.socket.close() except socket.error, x: pass self.socket = 'closed' | def disconnect(self, message="", volontary=False): """Hang up the connection. | 8445c04d75ea5033ea75d46637922a54ab654cec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/8445c04d75ea5033ea75d46637922a54ab654cec/irclib.py |
try: from_ = bridge.get_participant(source_nickname) except Bridge.NoSuchParticipantException: from_ = None | from_ = None if source_nickname: try: from_ = bridge.get_participant(source_nickname) except Bridge.NoSuchParticipantException: pass | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 30d7feb5a6be6812c77dd1e07ccddf08475194df /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/30d7feb5a6be6812c77dd1e07ccddf08475194df/bot.py |
for i in range(math.ceil(l_size/available_size)): | for i in range(int(math.ceil(l_size/available_size))): | def privmsg(self, target, text): """Send a PRIVMSG command.""" for l in text.split('\n'): l_size = len(l.encode('utf-8')) available_size = float(510-len('%s PRIVMSG %s :' % (self.irc_id, target))) # 510 is the size limit for IRC messages defined in RFC 2812 e = 0 for i in range(math.ceil(l_size/available_size)): s = e... | 7e500174f42994e7a52e2491e62bd70bd6d3d40b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7e500174f42994e7a52e2491e62bd70bd6d3d40b/irclib.py |
self.stop(message='Failed to connect to the XMPP room, stopping bridge') | self.stop(message='Failed to connect to the XMPP room, stopping bridge', log=False) | def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: self.reconnecting = False if not self.mode: return self.bot.error(3, 'succesfully connected on XMPP side of bridge "'+str(self)+'"', debug=True) self.say(say_levels.notice, 'bridge "'+str(self)+'" is running in '+self... | c37b0c993335b7c98725bd3326e8df2a04f31a71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/c37b0c993335b7c98725bd3326e8df2a04f31a71/bridge.py |
raise UnknownChannel, (channels, message, self) | raise UnknownChannel, (channels, message, str(self)) | def part(self, channels, message=""): """Send a PART command.""" try: if isinstance(channels, basestring): try: self.channels[channels].part(message=message) except KeyError: raise UnknownChannel, (channels, message, self) else: for channel in channels: try: self.channels[channel].part(message=message) except KeyError:... | a3cda9bc31f3340020d142fee0ea79a6475137c7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/a3cda9bc31f3340020d142fee0ea79a6475137c7/irclib.py |
nickname = None | source_nickname = None | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
nickname = event.source().split('!')[0] | source_nickname = event.source().split('!')[0] | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
printed_event = False if event.eventtype() in ['pubmsg', 'action', 'privmsg', 'quit', 'part', 'nick', 'kick']: if nickname == None: return handled = False if event.eventtype() in ['quit', 'part'] and nickname == self.nickname: return if event.eventtype() in ['quit', 'part', 'nick', 'kick']: if connection.real_nick... | handled = False if event.eventtype() in ['privmsg', 'action']: if event.target() == self.nickname: connection.privmsg(source_nickname, self.respond(event.arguments()[0])) return elif not irclib.is_channel(event.target()[0]): for bridge in self.iter_bridges(irc_server=connection.server): | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
to_ = bridge.get_participant(event.target().split('!')[0]) self.error(2, debug_str, debug=True) from_.say_on_xmpp_to(to_.nickname, event.arguments()[0]) return except Bridge.NoSuchParticipantException: if event.target().split('!')[0] == self.nickname: self.error(2, debug_str, debug=True) connection.privmsg(from_.nick... | from_ = bridge.get_participant(source_nickname) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
from_.say_on_xmpp(message, action=action) | from_.say_on_xmpp_to(connection.nickname, event.arguments()[0], action=action) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
continue | leave_message = 'Left server.' bridge.remove_participant('irc', from_.nickname, leave_message) continue if event.eventtype() == 'nick': from_.change_nickname(event.target(), 'xmpp') continue | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
if event.eventtype() in ['namreply', 'join']: if event.eventtype() == 'namreply': bridge = self.get_bridge(irc_room=event.arguments()[1].lower(), irc_server=connection.server) for nickname in re.split('(?:^[&@\+%]?|(?: [&@\+%]?)*)', event.arguments()[2].strip()): if nickname == '' or nickname == self.nickname: continu... | if event.eventtype() in ['pubmsg', 'action', 'part', 'kick', 'mode', 'join']: if event.eventtype() in ['pubmsg', 'action', 'part', 'kick'] and not source_nickname: self.error(say_levels.debug, 'a source is needed for a '+event.eventtype()+' event', no_debug_add=event_str) return if event.eventtype() == 'kick' and le... | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
return if event.eventtype() == 'mode': if len(event.arguments()) < 2: self.error(2, debug_str, debug=True) self.error(1, '2 arguments are needed for a '+event.eventtype()+' event', debug=True) return if event.arguments()[1] != self.nickname or not 'o' in event.arguments()[0]: self.error(1, 'ignoring IRC mode "'+even... | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py | |
if not printed_event: self.error(say_levels.debug, 'The following IRC event was not handled:'+event_str+'\n', send_to_admins=True) else: self.error(1, 'event not handled', debug=True) self._send_message_to_admins(say_levels.debug, 'The following IRC event was not handled:'+event_str) | self.error(1, 'event not handled', debug=True) self._send_message_to_admins(say_levels.debug, 'The following IRC event was not handled:'+event_str) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 7af2a8a810665cc96ac01e14451dec4dfa2e27ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/7af2a8a810665cc96ac01e14451dec4dfa2e27ba/bot.py |
self.error(2, debug_str, debug=True) self.error(say_levels.debug, '2 arguments are needed for a '+event.eventtype()+' event', no_debug_add=event_str) | self.error(say_levels.debug, '2 arguments are needed for a '+event.eventtype()+' event\n'+event_str) | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | bad2287ee12b303a17c9ab800f27ee646429bea3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/bad2287ee12b303a17c9ab800f27ee646429bea3/bot.py |
if from_protocol == 'irc' and isinstance(p.irc_connection, ServerConnection) and p.irc_connection.really_connected == True or from_protocol == 'xmpp' and isinstance(p.xmpp_c, xmpp.client.Client) and isinstance(p.muc, xmpp.muc): | if from_protocol == 'irc' and isinstance(p.irc_connection, ServerConnection) and p.irc_connection.really_connected == True and p.irc_connection.real_nickname == nickname or from_protocol == 'xmpp' and isinstance(p.xmpp_c, xmpp.client.Client) and isinstance(p.muc, xmpp.muc) and p.xmpp_c.nickname == nickname: | def addParticipant(self, from_protocol, nickname, real_jid=None, irc_id=None): """Add a participant to the bridge.""" if (from_protocol == 'irc' and nickname == self.irc_connection.get_nickname()) or (from_protocol == 'xmpp' and nickname == self.xmpp_room.nickname): self.bot.error('===> Debug: not adding self ('+self.b... | 0023f60cc5e80478b03a81c89bc07b82063e5a81 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/0023f60cc5e80478b03a81c89bc07b82063e5a81/bridge.py |
self.__del__() | self.stop() | def respond(self, message, participant=None, bot_admin=False): ret = '' command = shlex.split(message) args_array = [] if len(command) > 1: args_array = command[1:] command = command[0] if isinstance(participant, Participant) and bot_admin != participant.bot_admin: bot_admin = participant.bot_admin if command == 'xmp... | ead98574fc85e384856a1d04c90bd2af70a4c033 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/ead98574fc85e384856a1d04c90bd2af70a4c033/bot.py |
return 'Bot stopped.' | return | def stop_bot(bot, command, args_array, bridge): bot.stop() return 'Bot stopped.' | ce133313147381e12ba00a2885ef8c76a052f1a8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/ce133313147381e12ba00a2885ef8c76a052f1a8/commands.py |
self.really_connected = False | self.really_connected = False | def disconnect(self, message="", volontary=False): """Hang up the connection. | 3803587fd9f33e482af7f2a20088ccdd46d9319f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/3803587fd9f33e482af7f2a20088ccdd46d9319f/irclib.py |
self.quit(message) | if message and message != 'Connection reset by peer': self.quit(message) | def disconnect(self, message="", volontary=False): """Hang up the connection. | 3803587fd9f33e482af7f2a20088ccdd46d9319f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/3803587fd9f33e482af7f2a20088ccdd46d9319f/irclib.py |
if isinstance(p.muc, xmpp.muc) and not xmpp.muc.connected: | if isinstance(p.muc, xmpp.muc) and not p.muc.connected: | def remove_participant(self, left_protocol, nickname, leave_message): """Remove the participant using nickname from the bridge. Raises a NoSuchParticipantException if nickname is not used in the bridge.""" was_on_both = None p = self.get_participant(nickname) if p.left: self.lock.acquire() self.participants.remove(p)... | e43ff656b06abdb9e5bbeaae1d9e2ddd1838239b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/e43ff656b06abdb9e5bbeaae1d9e2ddd1838239b/bridge.py |
p.irc_connection = error | p.irc_connection = event.eventtype() | def _irc_event_handler(self, connection, event): """[Internal] Manage IRC events""" # Answer ping if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return # Events we always want to ignore if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse... | 5172b50a28e7e1475dba3d9fb04300bc088ffe7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9915/5172b50a28e7e1475dba3d9fb04300bc088ffe7b/bot.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.