rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
res=hardcoded_lib_dir_regex.search(line) | if configure: if configure_cmdline[-1] == "\\": configure_cmdline=configure_cmdline[:-1] + string.strip(line) else: configure=0 res=configure_libdir_spec_regex.search(configure_cmdline) if not res: printError(pkg, "configure-without-libdir-spec") else: res=re.match(hardcoded_library_paths, res.group(1)) if res: printEr... | def check(self, pkg): if not pkg.isSource(): return |
printError(pkg, "harcoded-library-path", "in " + string.lstrip(res.group(1))) | configure=1 configure_cmdline=string.strip(line) res=hardcoded_library_path_regex.search(line) if not changelog and res: printError(pkg, "hardcoded-library-path", "in", string.lstrip(res.group(1))) | def check(self, pkg): if not pkg.isSource(): return |
'harcoded-library-path', | 'hardcoded-library-path', | def check(self, pkg): if not pkg.isSource(): return |
addFilter("W: glibc shared-lib-without-dependency-information /lib/ld-2.1.3.so") addFilter("W: glibc library-not-linked-against-libc /lib/libc-2.1.3.so") | addFilter("W: glibc shared-lib-without-dependency-information /lib/ld-2.*.so") addFilter("W: glibc library-not-linked-against-libc /lib/libc-2.*.so") | def isFiltered(s): global _filters for f in _filters: if f.search(s): return 1 return 0 |
print link, base, link != base | def check(self, pkg, verbose): | |
addFilter('(hack)?kernel-pcmcia-cs no-dependency-on locales-cs') | addFilter('(hack)?(kernel-)?pcmcia-cs no-dependency-on locales-cs') | def isFiltered(s): global _filters global _filters_re if _filters_re == None: # no filter if len(_filters) == 0: return 0 _filters_re = '(?:' + _filters[0] + ')' for idx in range(1, len(_filters)): _filters_re = _filters_re + '|(?:' + _filters[idx] +')' _filters_re = re.compile(_filters_re) if not no_exception: if _... |
addFilter('W: (binutils|dev86|compat-glibc|alsa|alsa-sourcecompat-libs|gcc|gcc-c\+\+|egcs|egcs-c\+\+|gcc-chill|gcc-f77|egcs-g77|gcc-libgcj|gcc-objc|hackkernel-source|hackkernel-headers|kernel-source|kernel-headers|octave|ghc|mercury|ocaml|gprolog|ruby-extensions|ruby|XFree86-static-libs|libwmf|doxygen|swi-prolog|ghc-pr... | addFilter('W: (binutils|dev86|compat-glibc|alsa|alsa-sourcecompat-libs|gcc|gcc-c\+\+|egcs|egcs-c\+\+|gcc-chill|gcc-f77|egcs-g77|gcc-libgcj|gcc-objc|hackkernel-source|hackkernel-headers|kernel-source|kernel-headers|octave|ghc|mercury|ocaml|ocaml-lablgtk|camlp4|gprolog|ruby-extensions|ruby|XFree86-static-libs|libwmf|doxy... | def isFiltered(s): global _filters if not no_exception: for f in _filters: if f.search(s): return 1 return 0 |
addFilter('E: perl-base setuid-binary /usr/bin/sperl5.6.0 root 04711') | addFilter('E: perl-base setuid-binary /usr/bin/sperl5\.\d+\.\d+ root 04711') | def isFiltered(s): global _filters if not no_exception: for f in _filters: if f.search(s): return 1 return 0 |
is given, an empty, valid element "()" is created. Throws | is given, an empty, valid element "()" is created. Raises | def __init__(self, string = None): """Create using an optional string of code. If no string is given, an empty, valid element "()" is created. Throws ValueError if there is a problem with the passed string.""" if string == None: return |
self.children = [] | self.__children = [] | def __init__(self, string = None): """Create using an optional string of code. If no string is given, an empty, valid element "()" is created. Throws ValueError if there is a problem with the passed string.""" if string == None: return |
self.children.append(current) | self.__children.append(current) | def __init__(self, string = None): """Create using an optional string of code. If no string is given, an empty, valid element "()" is created. Throws ValueError if there is a problem with the passed string.""" if string == None: return |
self.children = None | self.__children = None | def __init__(self, string = None): """Create using an optional string of code. If no string is given, an empty, valid element "()" is created. Throws ValueError if there is a problem with the passed string.""" if string == None: return |
self.children.append(ElementGGP(string[start:x+1])) | self.__children.append(ElementGGP(string[start:x+1])) | def __init__(self, string = None): """Create using an optional string of code. If no string is given, an empty, valid element "()" is created. Throws ValueError if there is a problem with the passed string.""" if string == None: return |
if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): | if self.__children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.__children): | def get(self, index): if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): raise IndexError return self.children[index] |
return self.children[index] | return self.__children[index] | def get(self, index): if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): raise IndexError return self.children[index] |
if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): | if self.__children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.__children): | def remove(self, index): if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): raise IndexError |
self.children[index:1] = [] | self.__children[index:1] = [] | def remove(self, index): if self.children == None: raise ValueError("Invalid element") if index < 0 or index >= len(self.children): raise IndexError |
if self.children == None: raise ValueError("Invalid element") return len(self.children) | if self.__children == None: raise ValueError("Invalid element") return len(self.__children) | def num_children(self): if self.children == None: raise ValueError("Invalid element") |
if self.children == None: raise ValueError("Invalid element") if len(self.children) < 1: | if self.__children == None: raise ValueError("Invalid element") if len(self.__children) < 1: | def __str__(self): if self.children == None: raise ValueError("Invalid element") if len(self.children) < 1: return "()" str = "(" for element in self.children: if isinstance(element, ElementGGP): str = str + element.__str__() + " " else: str = str + element + " " str = str[:-1] str = str + ")" return str |
for element in self.children: | for element in self.__children: | def __str__(self): if self.children == None: raise ValueError("Invalid element") if len(self.children) < 1: return "()" str = "(" for element in self.children: if isinstance(element, ElementGGP): str = str + element.__str__() + " " else: str = str + element + " " str = str[:-1] str = str + ")" return str |
def handle_play(self, matchid, moves_element): if moves_element == None: moves_element.self.bad_request("Malformed PLAY command (no moves)") | def handle_play_stop(self, matchid, play, rest_element): command = None if play: command = "PLAY" else: command = "STOP" if rest_element == None: self.bad_request("Malformed %s command (no rest)" % command) return moves_element = None try: moves_element = rest_element.get(0) except IndexError: self.bad_request("Malfo... | def handle_play(self, matchid, moves_element): if moves_element == None: moves_element.self.bad_request("Malformed PLAY command (no moves)") return print "moves_element:", moves_element # Scripted responses if Responder.move_count < len(self.move_responses): this_move = self.move_responses[Responder.move_count] Respo... |
if Responder.move_count < len(self.move_responses): this_move = self.move_responses[Responder.move_count] Responder.move_count = Responder.move_count + 1 self.reply(200, this_move) else: self.reply(200, 'NOOP') def handle_stop(self, matchid, moves_element): if moves_element == None: moves_element.self.bad_request("Mal... | if not isinstance(moves_element, ElementGGP): if moves_element == "NIL": moves_element = ElementGGP("()") else: self.bad_request("Malformed %s command (moves string and not NIL)" % command) return if play: if Responder.move_count < len(self.move_responses): this_move = self.move_responses[Responder.move_count] Respon... | def handle_play(self, matchid, moves_element): if moves_element == None: moves_element.self.bad_request("Malformed PLAY command (no moves)") return print "moves_element:", moves_element # Scripted responses if Responder.move_count < len(self.move_responses): this_move = self.move_responses[Responder.move_count] Respo... |
self.handle_play(matchid, message_element) | self.handle_play_stop(matchid, True, message_element) | def do_POST(self): if self.headers.has_key('receiver'): receiver = self.headers.get('receiver') if receiver.lower() != self.player_name: self.bad_request('receiver name mismatch') return if not self.headers.has_key('content-length'): self.bad_request('no content-length') return |
self.handle_stop(matchid, message_element) | self.handle_play_stop(matchid, False, message_element) | def do_POST(self): if self.headers.has_key('receiver'): receiver = self.headers.get('receiver') if receiver.lower() != self.player_name: self.bad_request('receiver name mismatch') return if not self.headers.has_key('content-length'): self.bad_request('no content-length') return |
self.dirs_to_delete.append("$INSTDIR%s\\%s" % (outputdir, f)) | self.files_to_delete.append("$INSTDIR%s\\%s" % (outputdir, f)) | def do_files(self, top, nsioutput): for root, dirs, files in os.walk(top): outputdir = root.replace(top, "") nsioutput.write("\n\tSetOutPath \"$INSTDIR%s\"\n" % outputdir) self.dirs_to_delete.append("$INSTDIR%s" % outputdir) for f in files: nsioutput.write("\tFile \"%s\"\n" % os.path.join(root, f)) self.dirs_to_delete... |
for n, ref in vertrefs: | for n, ref in self.vertrefs: | def Load(self, fileName): self.dm = None self.prods = {} self.vertrefs = [] |
os.makedirs(os.path.join(self.config['core'], 'SoarLibrary\\bin\\tcl_sml_clientinterface')) | def source(self): if os.path.exists(self.config['source']): logging.debug('Removing old source tree: %s' % self.config['source']) shutil.rmtree(self.config['source']) logging.info('Checking out source tree.') os.system('svn export -q %s %s' % (self.config['soarurl'], self.config['source'])) logging.info('Removing glo... | |
sendmailme(email, msg, config['email_subject'], email, html=False) | sendmailme(email, msg, config['email_subject'], config['adminmail'], html=False) | def donewlogin(theform, userdir, thisscript, action=None): """Process the results from new login form submissions.""" loginaction = theform['login'].value if not loginaction == 'donewloginnojs': # only type of newlogin supported so far sys.exit() # check that new logins are enabled on this setup checknewlogin(userdir) ... |
agent.RunSelfTilOutput() self.reply(200, 'NOOP') | def handle_play_stop(self, matchid, play, rest_element): command = None if play: command = "PLAY" else: command = "STOP" if rest_element == None: self.bad_request("Malformed %s command (no rest)" % command) return | |
print "soar>", message | print message def shutdown(): global kernel global agent if agent != None: kernel.DestroyAgent(agent) agent = None kernel.Shutdown() del kernel | def print_callback(id, userData, agent, message): print "soar>", message |
agent.LoadProductions('blocksworld_noframe.soar') | print agent.ExecuteCommandLine("source blocksworld_noframe.soar") if not agent.GetLastCommandLineResult(): print "Production load failed" shutdown() sys.exit(1) | def print_callback(id, userData, agent, message): print "soar>", message |
kernel.DestroyAgent(agent) agent = None kernel.Shutdown() del kernel | shutdown() | def print_callback(id, userData, agent, message): print "soar>", message |
o.write("To: %s\r\n" % ','.join(to_email)) | o.write("To: %s\n" % ','.join(to_email)) | def sendmailme(to_email, msg, email_subject=None, from_email=None, html=True, sendmail=SENDMAIL): """ Quick and dirty, pipe a message to sendmail. Can only work on UNIX type systems with sendmail. Will need the path to sendmail - defaults to the 'SENDMAIL' constant. ``to_email`` can be a single email address, *or* a ... |
o.write("From: %s\r\n" % from_email) | o.write("From: %s\n" % from_email) | def sendmailme(to_email, msg, email_subject=None, from_email=None, html=True, sendmail=SENDMAIL): """ Quick and dirty, pipe a message to sendmail. Can only work on UNIX type systems with sendmail. Will need the path to sendmail - defaults to the 'SENDMAIL' constant. ``to_email`` can be a single email address, *or* a ... |
o.write("Subject: %s\r\n" % email_subject) o.write("\r\n") o.write("%s\r\n" % msg) | o.write("Subject: %s\n" % email_subject) o.write("\n") o.write("%s" % msg) | def sendmailme(to_email, msg, email_subject=None, from_email=None, html=True, sendmail=SENDMAIL): """ Quick and dirty, pipe a message to sendmail. Can only work on UNIX type systems with sendmail. Will need the path to sendmail - defaults to the 'SENDMAIL' constant. ``to_email`` can be a single email address, *or* a ... |
agent.RunSelfTilOutput() | num_commands = 0 while num_commands == 0: agent.RunSelfTilOutput() num_commands = agent.GetNumberCommands() | def handle_play_stop(self, matchid, play, rest_element): command = None if play: command = "PLAY" else: command = "STOP" if rest_element == None: self.bad_request("Malformed %s command (no rest)" % command) return |
for x in range(agent.GetNumberCommands()): | for x in range(num_commands): | def handle_play_stop(self, matchid, play, rest_element): command = None if play: command = "PLAY" else: command = "STOP" if rest_element == None: self.bad_request("Malformed %s command (no rest)" % command) return |
self.reply(200, "(%s)" % command_string) | if len(command_string) > 0: self.reply(200, "(%s)" % command_string) | def handle_play_stop(self, matchid, play, rest_element): command = None if play: command = "PLAY" else: command = "STOP" if rest_element == None: self.bad_request("Malformed %s command (no rest)" % command) return |
print agent.ExecuteCommandLine("source blocksworld_noframe.soar") | print agent.ExecuteCommandLine("source blocksworld_sel.soar") | def shutdown(): global kernel global agent if agent != None: kernel.DestroyAgent(agent) agent = None kernel.Shutdown() del kernel |
o = os.popen("%s -t" % sendmail,"w") | o = os.popen("%(a)s -t -f %(b)s" % {'a':sendmail, 'b':from_email},"w") | def sendmailme(to_email, msg, email_subject=None, from_email=None, html=True, sendmail=SENDMAIL): """ Quick and dirty, pipe a message to sendmail. Can only work on UNIX type systems with sendmail. Will need the path to sendmail - defaults to the 'SENDMAIL' constant. ``to_email`` can be a single email address, *or* a ... |
print lastinquiry | def remoteInquiry(call,userdir,curr_user,config): import time,fcntl,errno,os # acquire lock lockfile=open(userdir+"received/inquiry_lock","w") try: try: # read directory contents fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) # only one inquiry at a time! messages=os.listdir(userdir+"received/") messages=filter (... | |
print "messages",messages print "oldmessages",oldmessages | def remoteInquiry(call,userdir,curr_user,config): import time,fcntl,errno,os # acquire lock lockfile=open(userdir+"received/inquiry_lock","w") try: try: # read directory contents fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) # only one inquiry at a time! messages=os.listdir(userdir+"received/") messages=filter (... | |
os.mkdir(udir) | os.mkdir(udir,0700) | def callIncoming(call,service,call_from,call_to): # read config file and search for call_to in the user sections try: config=cs_helpers.readConfig() userlist=config.sections() userlist.remove('GLOBAL') curr_user="" for u in userlist: if config.has_option(u,'voice_numbers'): numbers=config.get(u,'voice_numbers') if (ca... |
os.mkdir(udir+"received/") | os.mkdir(udir+"received/",0700) | def callIncoming(call,service,call_from,call_to): # read config file and search for call_to in the user sections try: config=cs_helpers.readConfig() userlist=config.sections() userlist.remove('GLOBAL') curr_user="" for u in userlist: if config.has_option(u,'voice_numbers'): numbers=config.get(u,'voice_numbers') if (ca... |
+"See attached file.\nThe original file was saved to "+filename+"\n\n", filename) | +"See attached file.\nThe original file was saved to file://"+filename+"\n\n", filename) | def faxIncoming(call,call_from,call_to,curr_user,config): filename=cs_helpers.uniqueName(config.get("GLOBAL","fax_user_dir")+curr_user+"/received/","fax","sff") try: capisuite.fax_receive(call,filename) (cause,causeB3)=capisuite.disconnect(call) capisuite.log("connection finished with cause 0x%x,0x%x" % (cause,causeB3)... |
+"See attached file.\nThe original file was saved to "+filename+"\n\n", filename) | +"See attached file.\nThe original file was saved to file://"+filename+"\n\n", filename) | def voiceIncoming(call,call_from,call_to,curr_user,config): userdir=config.get("GLOBAL","voice_user_dir")+curr_user+"/" filename=cs_helpers.uniqueName(userdir+"received/","voice","la") try: capisuite.enable_DTMF(call) userannouncement=userdir+cs_helpers.getOption(config,curr_user,"announcement") pin=cs_helpers.getOptio... |
try: fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) messages=os.listdir(userdir+"received/") messages=filter (lambda s: re.match("voice-.*\.la",s),messages) messages=map(lambda s: int(re.match("voice-([0-9]+)\.la",s).group(1)),messages) messages.sort() lastinquiry=-1 if (os.access(userdir+"received/last_inquir... | fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError,err: if (err.errno in (errno.EACCES,errno.EAGAIN)): capisuite.audio_send(call,cs_helpers.getAudio(config,curr_user,"fernabfrage-aktiv.la")) lockfile.close() return try: messages=os.listdir(userdir+"received/") messages=filter (lambda s: re.match("voi... | def remoteInquiry(call,userdir,curr_user,config): import time,fcntl,errno,os # acquire lock lockfile=open(userdir+"received/inquiry_lock","w") try: try: # read directory contents fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) # only one inquiry at a time! messages=os.listdir(userdir+"received/") messages=filter (... |
while (i<len(messages)): oldmessages.append(messages[i]) if (messages[i]<=lastinquiry): del messages[i] else: | while (i<len(curr_msgs)): filename=userdir+"received/voice-"+str(curr_msgs[i])+".la" descr=cs_helpers.readConfig(filename[:-2]+"txt") capisuite.audio_send(call,cs_helpers.getAudio(config,curr_user,"nachricht.la"),1) cs_helpers.sayNumber(call,str(i+1),curr_user,config) if (descr.get('GLOBAL','call_from')!="??"): capisui... | def remoteInquiry(call,userdir,curr_user,config): import time,fcntl,errno,os # acquire lock lockfile=open(userdir+"received/inquiry_lock","w") try: try: # read directory contents fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) # only one inquiry at a time! messages=os.listdir(userdir+"received/") messages=filter (... |
cs_helpers.sayNumber(call,str(len(messages)),curr_user,config) if (len(messages)==1): capisuite.audio_send(call,cs_helpers.getAudio(config,curr_user,"neue-nachricht.la"),1) else: capisuite.audio_send(call,cs_helpers.getAudio(config,curr_user,"neue-nachrichten.la"),1) cmd="" while (cmd not in ("1","9")): if (len(oldme... | elif (cmd=="5"): i-=1 capisuite.audio_send(call,cs_helpers.getAudio(config,curr_user,"keine-weiteren-nachrichten.la")) | def remoteInquiry(call,userdir,curr_user,config): import time,fcntl,errno,os # acquire lock lockfile=open(userdir+"received/inquiry_lock","w") try: try: # read directory contents fcntl.lockf(lockfile,fcntl.LOCK_EX | fcntl.LOCK_NB) # only one inquiry at a time! messages=os.listdir(userdir+"received/") messages=filter (... |
starttime=time.mktime(time.strptime(control.get("GLOBAL","starttime"))) | starttime=(time.strptime(control.get("GLOBAL","starttime")))[0:8]+(-1,) starttime=time.mktime(starttime) | def idle(capi): config=cs_helpers.readConfig() spool=cs_helpers.getOption(config,"","spool_dir") if (spool==None): capisuite.error("global option spool_dir not found.") return done=os.path.join(spool,"done")+"/" failed=os.path.join(spool,"failed")+"/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)):... |
if (not config.has_option(user,"fax_numbers")): continue | outgoing_nr=cs_helpers.getOption(config,user,"outgoing_MSN","") if (outgoing_nr==""): incoming_nrs=config.get(user,"fax_numbers","") if (incoming_nrs==""): continue else: outgoing_nr=(incoming_nrs.split(','))[0] | def idle(capi): config=cs_helpers.readConfig() spool=cs_helpers.getOption(config,"","spool_dir") if (spool==None): capisuite.error("global option spool_dir not found.") return done=os.path.join(spool,"done")+"/" failed=os.path.join(spool,"failed")+"/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)):... |
result,resultB3 = sendfax(capi,sendq+job_fax,dialstring,user,config) | result,resultB3 = sendfax(capi,sendq+job_fax,outgoing_nr,dialstring,user,config) tries+=1 | def idle(capi): config=cs_helpers.readConfig() spool=cs_helpers.getOption(config,"","spool_dir") if (spool==None): capisuite.error("global option spool_dir not found.") return done=os.path.join(spool,"done")+"/" failed=os.path.join(spool,"failed")+"/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)):... |
if (tries<len(delays)): next_delay=delays[tries] | if ((tries-1)<len(delays)): next_delay=delays[tries-1] | def idle(capi): config=cs_helpers.readConfig() spool=cs_helpers.getOption(config,"","spool_dir") if (spool==None): capisuite.error("global option spool_dir not found.") return done=os.path.join(spool,"done")+"/" failed=os.path.join(spool,"failed")+"/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)):... |
tries+=1 | def idle(capi): config=cs_helpers.readConfig() spool=cs_helpers.getOption(config,"","spool_dir") if (spool==None): capisuite.error("global option spool_dir not found.") return done=os.path.join(spool,"done")+"/" failed=os.path.join(spool,"failed")+"/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)):... | |
def sendfax(capi,job,dialstring,user,config): | def sendfax(capi,job,outgoing_nr,dialstring,user,config): | def sendfax(capi,job,dialstring,user,config): try: outgoing_nr=cs_helpers.getOption(config,user,"outgoing_MSN","") if (outgoing_nr==""): outgoing_nr=(config.get(user,'fax_numbers').split(','))[0] # it's guaranteed that we have fax_numbers defined controller=int(cs_helpers.getOption(config,"","send_controller","1")) ti... |
outgoing_nr=cs_helpers.getOption(config,user,"outgoing_MSN","") if (outgoing_nr==""): outgoing_nr=(config.get(user,'fax_numbers').split(','))[0] | def sendfax(capi,job,dialstring,user,config): try: outgoing_nr=cs_helpers.getOption(config,user,"outgoing_MSN","") if (outgoing_nr==""): outgoing_nr=(config.get(user,'fax_numbers').split(','))[0] # it's guaranteed that we have fax_numbers defined controller=int(cs_helpers.getOption(config,"","send_controller","1")) ti... | |
os.mkdir(udir) | os.mkdir(udir,0700) | def idle(capi): config=cs_helpers.readConfig() done=config.get('GLOBAL','spool_dir')+"done/" failed=config.get('GLOBAL','spool_dir')+"failed/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)): raise "Can't read/write to the necessary spool dirs" userlist=config.sections() userlist.remove('GLOBAL') fo... |
os.mkdir(sendq) | os.mkdir(sendq,0700) | def idle(capi): config=cs_helpers.readConfig() done=config.get('GLOBAL','spool_dir')+"done/" failed=config.get('GLOBAL','spool_dir')+"failed/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)): raise "Can't read/write to the necessary spool dirs" userlist=config.sections() userlist.remove('GLOBAL') fo... |
+"\n\nIt was moved to "+done+user+"-"+job_fax) | +"\n\nIt was moved to file://"+done+user+"-"+job_fax) | def idle(capi): config=cs_helpers.readConfig() done=config.get('GLOBAL','spool_dir')+"done/" failed=config.get('GLOBAL','spool_dir')+"failed/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)): raise "Can't read/write to the necessary spool dirs" userlist=config.sections() userlist.remove('GLOBAL') fo... |
+"\n\nIt was moved to "+failed+user+"-"+job_fax) | +"\n\nIt was moved to file://"+failed+user+"-"+job_fax) | def idle(capi): config=cs_helpers.readConfig() done=config.get('GLOBAL','spool_dir')+"done/" failed=config.get('GLOBAL','spool_dir')+"failed/" if (not os.access(done,os.W_OK) or not os.access(failed,os.W_OK)): raise "Can't read/write to the necessary spool dirs" userlist=config.sections() userlist.remove('GLOBAL') fo... |
userdata=pwd.getpwnam(curr_user) | def callIncoming(call,service,call_from,call_to): # read config file and search for call_to in the user sections try: config=cs_helpers.readConfig() userlist=config.sections() userlist.remove('GLOBAL') curr_user="" for u in userlist: if config.has_option(u,'voice_numbers'): numbers=config.get(u,'voice_numbers') if (ca... | |
os.setuid(userdata[2]) | def callIncoming(call,service,call_from,call_to): # read config file and search for call_to in the user sections try: config=cs_helpers.readConfig() userlist=config.sections() userlist.remove('GLOBAL') curr_user="" for u in userlist: if config.has_option(u,'voice_numbers'): numbers=config.get(u,'voice_numbers') if (ca... | |
+" on host \""+os.uname()[1]+"\"" | +" on host \""+os.uname()[1]+"\"." | def faxIncoming(call,call_from,call_to,curr_user,config,already_connected): try: udir=cs_helpers.getOption(config,"","fax_user_dir") if (udir==None): capisuite.error("global option fax_user_dir not found! -> rejecting call") capisuite.reject(call,0x34A9) return udir=os.path.join(udir,curr_user)+"/" if (not os.access(ud... |
capisuite.audio_receive(call,filename,int(length), int(silence_timeout),1) | msg_length=capisuite.audio_receive(call,filename,int(length), int(silence_timeout),1) | def voiceIncoming(call,call_from,call_to,curr_user,config): try: udir=cs_helpers.getOption(config,"","voice_user_dir") if (udir==None): capisuite.error("global option voice_user_dir not found! -> rejecting call") capisuite.reject(call,0x34A9) return udir=os.path.join(udir,curr_user)+"/" if (not os.access(udir,os.F_OK))... |
cs_helpers.sendMIMEMail(fromaddress, mailaddress, "Voice call received from "+call_from+" to "+call_to, "la", "You got a voice call from "+call_from+" to "+call_to+"\nDate: "+time.ctime()+"\n\n" +"See attached file.\nThe original file was saved to file://"+filename+"\n\n", filename) | mailText="You got a voice call from "+call_from+" to " \ +call_to+"\nDate: "+time.ctime()+"\nLength: " \ +str(msg_length)+" s\n\nSee attached file.\n" \ +"The original file was saved to file://"+filename \ +" on host \""+os.uname()[1]+"\".\n\n" subject="Voice call received from "+call_from+" to "+call_to cs_helpers.sen... | def voiceIncoming(call,call_from,call_to,curr_user,config): try: udir=cs_helpers.getOption(config,"","voice_user_dir") if (udir==None): capisuite.error("global option voice_user_dir not found! -> rejecting call") capisuite.reject(call,0x34A9) return udir=os.path.join(udir,curr_user)+"/" if (not os.access(udir,os.F_OK))... |
def outputMessage(self, text, lineno = 0, comment = None, spacepreserve = 0): | def outputMessage(self, text, lineno = 0, comment = None, spacepreserve = 0, tag = None): | def outputMessage(self, text, lineno = 0, comment = None, spacepreserve = 0): """Adds a string to the list of messages.""" if (text.strip() != ''): t = escapePoString(normalizeString(text, not spacepreserve)) if self.output_msgstr: self.translations.append(t) return if self.do_translations or (not t in self.messages):... |
self.linenos[t].append((self.filename, lineno)) | self.linenos[t].append((self.filename, tag, lineno)) | def outputMessage(self, text, lineno = 0, comment = None, spacepreserve = 0): """Adds a string to the list of messages.""" if (text.strip() != ''): t = escapePoString(normalizeString(text, not spacepreserve)) if self.output_msgstr: self.translations.append(t) return if self.do_translations or (not t in self.messages):... |
self.linenos[t] = [ (self.filename, lineno) ] | self.linenos[t] = [ (self.filename, tag, lineno) ] | def outputMessage(self, text, lineno = 0, comment = None, spacepreserve = 0): """Adds a string to the list of messages.""" if (text.strip() != ''): t = escapePoString(normalizeString(text, not spacepreserve)) if self.output_msgstr: self.translations.append(t) return if self.do_translations or (not t in self.messages):... |
references += "%s:%d " % (reference[0], reference[1]) | references += "%s:%d(%s) " % (reference[0], reference[2], reference[1]) | def outputAll(self, out): for k in self.messages: if k in self.comments: out.write("#. %s\n" % (self.comments[k].replace("\n","\n#. "))) references = "" for reference in self.linenos[k]: references += "%s:%d " % (reference[0], reference[1]) out.write("#: %s\n" % (references)) if k in self.nowrap and self.nowrap[k]: out... |
text may be a string when it is used verbatim, or a tuple (pair), with first component being a string, and the other being a list of replacements. | text should be a string to look for, spacepreserve set to 1 when spaces should be preserved. | def getTranslation(text, spacepreserve = 0): """Returns a translation via gettext for specified snippet. text may be a string when it is used verbatim, or a tuple (pair), with first component being a string, and the other being a list of replacements. """ text = normalizeString(text, not spacepreserve) if (text.strip(... |
def processFinalTag(node, outtxt): """node must be isFinalTag, this must be checked before calling this function.""" global semitrans if mode == 'merge': outtxt = getTranslation(outtxt, isSpacePreserveNode(node)) for i in semitrans.keys(): outtxt = outtxt.replace('<placeholder-%d/>' % (i), semitrans[i]) replaceNodeCont... | def processFinalTag(node, outtxt): """node must be isFinalTag, this must be checked before calling this function.""" global semitrans if mode == 'merge': outtxt = getTranslation(outtxt, isSpacePreserveNode(node)) for i in semitrans.keys(): outtxt = outtxt.replace('<placeholder-%d/>' % (i), semitrans[i]) replaceNodeCont... | |
while parent: | final = isFinalNode(node) while not final and parent: | def worthOutputting(node): """Returns 1 if node is "worth outputting", otherwise 0. Node is "worth outputting", if none of the parents isFinalNode, and it contains non-blank text and entities. """ worth = 1 parent = node.parent while parent: if isFinalNode(parent): worth = 0 break parent = parent.parent if not worth: ... |
global PlaceHolder global semitrans final = isFinalNode(node) | def processElementTag(node): """Process node with node.type == 'element'.""" if node.type == 'element': global PlaceHolder global semitrans final = isFinalNode(node) outtxt = '' if final: storeholder = PlaceHolder PlaceHolder = 0 storesemi = semitrans semitrans = {} child = node.children while child: if isFinalNode(chi... | |
if final: storeholder = PlaceHolder | if not worthOutputting(node): child = node.children while child: outtxt += doSerialize(child) child = child.next else: | def processElementTag(node): """Process node with node.type == 'element'.""" if node.type == 'element': global PlaceHolder global semitrans final = isFinalNode(node) outtxt = '' if final: storeholder = PlaceHolder PlaceHolder = 0 storesemi = semitrans semitrans = {} child = node.children while child: if isFinalNode(chi... |
storesemi = semitrans semitrans = {} child = node.children while child: if isFinalNode(child): PlaceHolder += 1 newmsg = doSerialize(child) result = '<placeholder-%d/>' % (PlaceHolder) if mode=='merge': semitrans[PlaceHolder] = getTranslation(newmsg, isSpacePreserveNode(node)) else: result = doSerialize(child) outtxt +... | submsgs = {} child = node.children while child: if isFinalNode(child): PlaceHolder += 1 (starttag, submsg, endtag) = processElementTag(child) outtxt += '<placeholder-%d/>' % (PlaceHolder) if mode=='merge': submsgs[PlaceHolder] = (starttag, getTranslation(submsg, isSpacePreserveNode(node)), endtag) | def processElementTag(node): """Process node with node.type == 'element'.""" if node.type == 'element': global PlaceHolder global semitrans final = isFinalNode(node) outtxt = '' if final: storeholder = PlaceHolder PlaceHolder = 0 storesemi = semitrans semitrans = {} child = node.children while child: if isFinalNode(chi... |
msg.outputMessage(outtxt, node.lineNo(), getCommentForNode(node), isSpacePreserveNode(node)) return '<%s>%s</%s>' % (startTagForNode(node), outtxt, node.name) | outtxt += doSerialize(child) child = child.next if mode=='merge': outtxt = getTranslation(outtxt, isSpacePreserveNode(node)) for i in submsgs.keys(): outtxt = outtxt.replace('<placeholder-%d/>' % (i), ''.join(submsgs[i])) if worthOutputting(node): replaceNodeContentsWithText(node, outtxt) elif worthOutputting(node): ... | def processElementTag(node): """Process node with node.type == 'element'.""" if node.type == 'element': global PlaceHolder global semitrans final = isFinalNode(node) outtxt = '' if final: storeholder = PlaceHolder PlaceHolder = 0 storesemi = semitrans semitrans = {} child = node.children while child: if isFinalNode(chi... |
return processElementTag(node) | return ''.join(processElementTag(node)) | def doSerialize(node): """Serializes a node and its children, emitting PO messages along the way. node is the node to serialize, first indicates whether surrounding tags should be emitted as well. """ if ignoreNode(node): return '' elif not node.children: return node.serialize("utf-8") elif node.type == 'entity_ref':... |
submodes_path = "/home/danilo/cvs/i18n/xml2po/modes" | submodes_path = "/home/danilo/cvs/gnom/gnome-doc-utils/xml2po/modes" | def xml_error_handler(arg, ctxt): pass |
print "ovde" | def xml_error_handler(arg, ctxt): pass | |
print "posle" | def xml_error_handler(arg, ctxt): pass | |
final = 0 | if node.name in ignored_tags: return 0 | def autoNodeIsFinal(node): """Returns 1 if node is text node, contains non-whitespace text nodes or entities.""" final = 0 if node.isText() and node.content.strip()!='': return 1 child = node.children while child: if child.type in ['text'] and child.content.strip()!='': final = 1 break child = child.next return final... |
try: params += ' %s:%s="%s"' % (p.ns().name, p.name, p.content) except: params += ' %s="%s"' % (p.name, p.content) | params += p.serialize() | def startTagForNode(node): if not node: return 0 result = node.name params = '' if node.properties: for p in node.properties: if p.type == 'attribute': # FIXME: This part sucks try: params += ' %s:%s="%s"' % (p.ns().name, p.name, p.content) except: params += ' %s="%s"' % (p.name, p.content) return result+params |
print dtd.serialize('utf-8') | def normalizeString(text, ignorewhitespace = 1): """Normalizes string to be used as key for gettext lookup. Removes all unnecessary whitespace.""" if not ignorewhitespace: return text try: # Lets add document DTD so entities are resolved dtd = doc.intSubset() tmp = '' print dtd.serialize('utf-8') if expand_entities: #... | |
if node.isBlankNode(): | if node.isBlankNode() and (not expand_entities and (not node.next or node.next.type!='entity_ref')): | def normalizeNode(node): if not node: return elif isSpacePreserveNode(node): return elif node.isText(): if node.isBlankNode(): node.setContent('') else: node.setContent(re.sub('\s+',' ', node.content)) elif node.children and node.type == 'element': child = node.children while child: normalizeNode(child) child = child.... |
translationlanguage = os.path.split(os.path.splitext(pofile)[0])[1] | translationlanguage = os.path.split(os.path.splitext(mofile)[0])[1] | def usage (with_help = False): print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]) if (with_help): print >> sys.stderr, """ |
tmp = dtd.serialize('utf-8') | tmp = dtd.serialize() | def normalizeString(text, ignorewhitespace = 1): """Normalizes string to be used as key for gettext lookup. Removes all unnecessary whitespace.""" if not ignorewhitespace: return text try: # Lets add document DTD so entities are resolved dtd = doc.intSubset() tmp = dtd.serialize('utf-8') tmp = tmp + '<norm>%s</norm>' ... |
text = node.serialize('utf-8') | text = node.serialize() | def stringForEntity(node): """Replaces entities in the node.""" text = node.serialize('utf-8') try: # Lets add document DTD so entities are resolved dtd = node.doc.intSubset() tmp = dtd.serialize('utf-8') + '<norm>%s</norm>' % text next = 1 except: tmp = '<norm>%s</norm>' % text next = 0 ctxt = libxml2.createDocParser... |
tmp = dtd.serialize('utf-8') + '<norm>%s</norm>' % text | tmp = dtd.serialize() + '<norm>%s</norm>' % text | def stringForEntity(node): """Replaces entities in the node.""" text = node.serialize('utf-8') try: # Lets add document DTD so entities are resolved dtd = node.doc.intSubset() tmp = dtd.serialize('utf-8') + '<norm>%s</norm>' % text next = 1 except: tmp = '<norm>%s</norm>' % text next = 0 ctxt = libxml2.createDocParser... |
params += p.serialize('utf-8') | params += p.serialize() | def startTagForNode(node): if not node: return 0 result = node.name params = '' if node.properties: for p in node.properties: if p.type == 'attribute': # FIXME: This part sucks params += p.serialize('utf-8') return result+params |
tmp = dtd.serialize('utf-8') | tmp = dtd.serialize() | def replaceNodeContentsWithText(node,text): """Replaces all subnodes of a node with contents of text treated as XML.""" if node.children: starttag = node.name #startTagForNode(node) endtag = endTagForNode(node) try: # Lets add document DTD so entities are resolved dtd = doc.intSubset() tmp = '' if expand_entities: # FI... |
return node.serialize('utf-8') | return node.serialize("utf-8") | def doSerialize(node): """Serializes a node and its children, emitting PO messages along the way. node is the node to serialize, first indicates whether surrounding tags should be emitted as well. """ if ignoreNode(node): return '' elif not node.children: return node.serialize('utf-8') elif node.type == 'entity_ref':... |
opts, args = getopt.getopt(args, 'avhmke:t:o:p:u:', | opts, args = getopt.getopt(args, 'avhmket:o:p:u:', | def tryToUpdate(allargs, lang): # Remove "-u" and "--update-translation" command = allargs[0] args = allargs[1:] opts, args = getopt.getopt(args, 'avhmke:t:o:p:u:', ['automatic-tags','version', 'help', 'keep-entities', 'extract-all-entities', 'merge', 'translation=', 'output=', 'po-file=', 'update-translation=' ]) for ... |
file = lang + ".po" | file = lang | def tryToUpdate(allargs, lang): # Remove "-u" and "--update-translation" command = allargs[0] args = allargs[1:] opts, args = getopt.getopt(args, 'avhmke:t:o:p:u:', ['automatic-tags','version', 'help', 'keep-entities', 'extract-all-entities', 'merge', 'translation=', 'output=', 'po-file=', 'update-translation=' ]) for ... |
elif node.children: | elif node.children and node.type == 'element': | def normalizeNode(node): #print node.content if not node: return elif isSpacePreserveNode(node): return elif node.isText(): if node.isBlankNode(): node.setContent('') else: node.setContent(re.sub('\s+',' ', node.content)) elif node.children: child = node.children while child: normalizeNode(child) child = child.next |
tmp = '' if expand_entities: tmp = dtd.serialize() | tmp = dtd.serialize() | def normalizeString(text, ignorewhitespace = 1): """Normalizes string to be used as key for gettext lookup. Removes all unnecessary whitespace.""" if not ignorewhitespace: return text try: # Lets add document DTD so entities are resolved dtd = doc.intSubset() tmp = '' if expand_entities: # FIXME: we get a "Segmentatio... |
tree = libxml2.parseMemory(tmp,len(tmp)) | ctxt = libxml2.createDocParserCtxt(tmp) if expand_entities: ctxt.replaceEntities(1) ctxt.parseDocument() tree = ctxt.doc() | def normalizeString(text, ignorewhitespace = 1): """Normalizes string to be used as key for gettext lookup. Removes all unnecessary whitespace.""" if not ignorewhitespace: return text try: # Lets add document DTD so entities are resolved dtd = doc.intSubset() tmp = '' if expand_entities: # FIXME: we get a "Segmentatio... |
copy.newChild(None, "year", match.group(3)) | copy.newChild(None, "year", match.group(3).encode('utf-8')) | def postProcessXmlTranslation(self, doc, language, translators): """Sets a language and translators in "doc" tree. "translators" is a string consisted of "Name <email>, years" pairs of each translator, separated by newlines.""" |
if isFinalNode(parent): | if isFinalNode(parent) and worthOutputting(parent): | def worthOutputting(node): """Returns 1 if node is "worth outputting", otherwise 0. Node is "worth outputting", if none of the parents isFinalNode, and it contains non-blank text and entities. """ worth = 1 parent = node.parent final = isFinalNode(node) while not final and parent: if isFinalNode(parent): worth = 0 bre... |
opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:', | try: opts, args = getopt.getopt(args, 'avhkem:t:o:p:u:r:', | def xml_error_handler(arg, ctxt): pass |
print >> sys.stderr, "Usage: %s [OPTIONS] [XMLFILE]..." % (sys.argv[0]) print >> sys.stderr, """ OPTIONS may be some of: -a --automatic-tags Automatically decides if tags are to be considered "final" or not (overrides -f and -i options) -k --keep-entities Don't expand entities -e --expand-all-entitie... | usage(True) | def xml_error_handler(arg, ctxt): pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.