rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
elif self.moh: extensions.appendExten(self.ext, "SetMusicOnHold(%s)" % self.moh) | else: if self.moh: extensions.appendExten(self.ext, "Answer") extensions.appendExten(self.ext, "SetMusicOnHold(%s)" % self.moh) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
extensions.appendExten(self.name, "Answer") | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") | |
elif self.moh: extensions.appendExten(self.name, "SetMusicOnHold(%s)" % self.moh) | else: if self.moh: extensions.appendExten(self.name, "Answer") extensions.appendExten(self.name, "SetMusicOnHold(%s)" % self.moh) | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
c.appendExten("s", "Goto(phones,%s,1)" % self.phone) | c.appendExten("_.", "Goto(phones,%s,1)" % self.phone) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) if self.contextin == 'phone' and self.phone: c.appendExten("s", "Goto(phones,%s,1)" % self.phone) if self.contextin == 'ivr' and self.ivr: c.appendExten("s", "Goto(%s,s,1)" % self.ivr) |
c.appendExten("s", "Goto(%s,s,1)" % self.ivr) | c.appendExten("_.", "Goto(%s,s,1)" % self.ivr) | def createIncomingContext(self): c = AstConf("extensions.conf") contextin = "in-%s" % self.name c.setSection(contextin) if self.contextin == 'phone' and self.phone: c.appendExten("s", "Goto(phones,%s,1)" % self.phone) if self.contextin == 'ivr' and self.ivr: c.appendExten("s", "Goto(%s,s,1)" % self.ivr) |
if self.rtpstart < self.rtpend: | if self.rtpstart > self.rtpend: | def checkConfig(self): ret = CfgOpt.checkConfig(self) if ret: return ret |
fields=['src as %s' % _("Source"), 'dst as %s' % _("Destination"), 'answer as %s' % _("Time_of_answer"), 'billsec as %s' % _("Duration"), 'disposition as %s' % _("Result"), 'accountcode as %s' % _("Cost_per_Minute")], | fields=['src as %s' % N_("Source"), 'dst as %s' % N_("Destination"), 'answer as %s' % N_("Time_of_answer"), 'billsec as %s' % N_("Duration"), 'disposition as %s' % N_("Result"), 'accountcode as %s' % N_("Cost_per_Minute")], | def select( fields=['src as %s' % _("Source"), 'dst as %s' % _("Destination"), 'answer as %s' % _("Time_of_answer"), 'billsec as %s' % _("Duration"), 'disposition as %s' % _("Result"), 'accountcode as %s' % _("Cost_per_Minute")], groupby=[], having=[], where=[], order=['Acctid'], limit=0, offset=0, ): cursor = db.curso... |
print "Unknown zaptel type '%s' % type | print "Unknown zaptel type '%s' % type" | def fixupZaptel(): """This loads genzaptelconf results""" zap_cfg_dict = {} zap_chans_dict = {} for obj in configlets.config_entries: if (obj.__class__.__name__ == 'CfgLineZapTDM' or obj.__class__.__name__ == 'CfgPhoneZap'): zap_cfg_dict[int(obj.channel)] = obj #print "zap_cfg_dict now has: ", zap_cfg_dict f = open... |
a.append( (obj.__dict__[key],obj.__dict__[val]) ) | a.append( (obj.__dict__[val],obj.__dict__[key]) ) | def getChoice(clazz, key='name',val='name'): """This is used to generate a list of tupled which we later use in the select widgets of type "choice" or "mchoice". 'clazz' is the classname the configlet must have.""" if not __loaded: loadPythonConfig() a = [] n = 0 obj2 = globals()[clazz] for obj in configlets.config_... |
names = fnmatch.filter(os.listdir('lang/'), '*.gmo') | names = fnmatch.filter(os.listdir(CONFIGLETS_DIR+'/lang/'), '*.gmo') | def listLanguages(): try: names = fnmatch.filter(os.listdir('lang/'), '*.gmo') except IOError: names = [] d = dict([('en','en.gmo')] + [(re.sub(r'(.*)\.gmo',r'\1',x),x) for x in names]) return d |
c.append("exten=s,203,DBGet(dsec=DSEC/${MACRO_EXTEN})") | c.append("exten=s,203,DBGet(dsec=DSEC/${ARG5}/${ARG4})") | def initializeAsteriskConfig(): """This puts some hard coded default values into some asterisk config files: * adsi.conf * extconfig.conf * extensions.conf * sip.conf * iax.conf * zapata.conf * macros.inc """ # Start with empty config files configlets.asterisk_configfiles = [] c = AstConf("adsi.conf") c.setSection... |
if ring: | if self.ring: | def createAsteriskConfig(self): needModule("app_queue") needModule("res_monitor") |
c.appendExten(self.msn, "Goto(phones,%s,1)" % self.phone) | c.appendExten(self.ext, "Goto(phones,%s,1)" % self.phone) | def createAsteriskConfiglet(self): needModule("res_crypto") needModule("chan_iax2") |
c.append("exten=s,13,Goto(testvmb)") | c.append("exten=s,110,Goto(testvmb)") | def initializeAsteriskConfig(): """This puts some hard coded default values into some asterisk config files: * adsi.conf * extconfig.conf * extensions.conf * sip.conf * iax.conf * zapata.conf * macros.inc """ # Start with empty config files configlets.asterisk_configfiles = [] c = AstConf("adsi.conf") c.setSection... |
self.stderr = open(logfile, 'w') | self.stderr = open(logfile, 'w+') | def start(self): """ Start the external process :return: """ self.stop()# Stop current process self._watchdog = threading.Thread(target=self._watch) logfile = settings.get("path", "logs")+'/'+self.name+'.log' self.stderr = open(logfile, 'w') self._running.set() self._popen = Popen( shlex.split(self.command), bufsize=0,... |
for box in SCENARIO[scenario]['boxes']: if box['name']+'_PUBLICBOX' in DECLARED_PUBLICBOXES: if DECLARED_PUBLICBOXES[box['name']+'_PUBLICBOX']['start']: SC['etapes'].append(boxname(scenario, box)) for box in SCENARIO[scenario]['boxes']: if 'media' in box.keys(): pool.Cartes[device['name']].media.append( os.path... | if scenario in SCENARIO.keys(): for box in SCENARIO[scenario]['boxes']: if box['name']+'_PUBLICBOX' in DECLARED_PUBLICBOXES: if DECLARED_PUBLICBOXES[box['name']+'_PUBLICBOX']['start']: SC['etapes'].append(boxname(scenario, box)) for box in SCENARIO[scenario]['boxes']: if 'media' in box.keys(): pool.Cartes[devi... | def parse_timeline(parsepool): Sceno = dict() # PROCESS SCENES for device in parsepool: for block in device["blocks"]: SC = { "carte": device['name'], "scenarios": block['scenarios'], "etapes": [], "start": block['start'], "end": block['end'] } #FIND START ETAPE FOR EACH ACTIVATED SCENARIO IN THE SCENE for scenario in ... |
self.repeat = 'off' | self.repeat = False | def __init__(self, start=True): ExternalProcess.__init__(self, 'vlcvideo') self.onClose = "VIDEO_END" self.media = None self.repeat = 'off' self.preloaded = False if start: self.start() |
self.repeat = 'on' if repeat else 'off' | self.repeat = True if repeat else False | def preload(self, filename=None, repeat=None, mediatype='video'): if filename is not None: media = os.path.join(settings.get_path("media", mediatype), filename) if os.path.isfile(media): self.media = media |
self.say("repeat {switch}".format(switch=self.repeat)) | repeat = 'on' if self.repeat else 'off' self.say("repeat {switch}".format(switch=repeat)) | def play(self, filename=None, repeat=None): if filename is not None: self.preload(filename, repeat) if self.preloaded: #self.say("clear") self.say("add {media}".format(media=self.media)) #self.say("play") self.say("repeat {switch}".format(switch=self.repeat)) |
self.command = self.executable+' --play-and-exit '+self.media | self.command = self.executable+' --play-and-exit ' if repeat: self.command += ' --repeat ' self.command += self.media | def play(self, filename=None, repeat=None): if filename is not None: self.preload(filename, repeat) if self.preloaded: self.command = self.executable+' --play-and-exit '+self.media self.start() |
import etapes import signals | def init_declared_objects(): import functions import etapes import signals import modules global DECLARED_ETAPES, DECLARED_FUNCTIONS, DECLARED_SIGNALS, DECLARED_PATCHER, DECLARED_TRANSITION, DECLARED_OSCROUTES #dumpclean(DECLARED_TRANSITION) # .. # Import declared elements to Poll pool.Etapes_and_Functions.update(DECL... | |
def device_do_reload(flag, **kwargs): | def device_reload(flag, **kwargs): | def device_do_reload(flag, **kwargs): application.reload() |
scenariopath = settings.get_path("scenario", "activescenario") | scenariopath = settings.get('path', "activescenario") | def set_python_path(depth=0): f = sys._getframe(1) fname = f.f_code.co_filename fpath = os.path.dirname(os.path.abspath(fname)) PythonPath = os.path.join(fpath, "../".join(["" for x in xrange(depth+1)])) sys.path.append(PythonPath) # print(PythonPath) |
mediapath = settings.get_path("media") | mediapath = settings.get('path', "media") | def set_python_path(depth=0): f = sys._getframe(1) fname = f.f_code.co_filename fpath = os.path.dirname(os.path.abspath(fname)) PythonPath = os.path.join(fpath, "../".join(["" for x in xrange(depth+1)])) sys.path.append(PythonPath) # print(PythonPath) |
path = settings.get_path('media', 'video') | path = settings.get('path', 'video') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get_path('media', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get_path('media', 'audio') if isdir(path): for f in listdir(path... |
path = settings.get_path('media', 'audio') | path = settings.get('path', 'audio') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get_path('media', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get_path('media', 'audio') if isdir(path): for f in listdir(path... |
path = settings.get_path('media', 'text') | path = settings.get('path', 'text') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get_path('media', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get_path('media', 'audio') if isdir(path): for f in listdir(path... |
path = settings.get_path('deviceslist') | path = settings.get('path', 'deviceslist') | def dispoList(): response.content_type = 'application/json' path = settings.get_path('deviceslist') try: answer = dict() with open(path, 'r') as file: # Use file to refer to the file object answer = json.loads( file.read() ) answer['status'] = 'success' return sendjson(answer) except: answer = dict() answer['status']... |
signalSOLO = signal.get() | def _dispatch(self, signal): # envoyer au destinataire via OSC signalSOLO = signal.get() sendto = copy(signal.args["dest"]) del signal.args["dest"] log.log("raw", "dispatch to : {0}".format(sendto)) if settings.get("scenario", "dest_all") in sendto: log.log("raw", "dispatch to all dest") message.send(message.Address("2... | |
time.sleep(10) | time.sleep(15) | def restart_netctl(): global no_signal, bad_signal, sleeptime, status, exec_error, DONE try: subprocess.check_call("systemctl restart netctl-auto@wlan0.service", shell=True) time.sleep(10) no_signal = 0 bad_signal = 0 sleeptime = SleepTimeNone status = S_INIT exec_error = 0 except subprocess.CalledProcessError as e: ex... |
scenariopath = settings.get("path", "activescenario") | scenariopath = settings.get_path("scenario", "activescenario") | def set_python_path(depth=0): f = sys._getframe(1) fname = f.f_code.co_filename fpath = os.path.dirname(os.path.abspath(fname)) PythonPath = os.path.join(fpath, "../".join(["" for x in xrange(depth+1)])) sys.path.append(PythonPath) # print(PythonPath) |
mediapath = settings.get("path", "media") | mediapath = settings.get_path("media") | def set_python_path(depth=0): f = sys._getframe(1) fname = f.f_code.co_filename fpath = os.path.dirname(os.path.abspath(fname)) PythonPath = os.path.join(fpath, "../".join(["" for x in xrange(depth+1)])) sys.path.append(PythonPath) # print(PythonPath) |
path = settings.get('path', 'video') | path = settings.get_path('media', 'video') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get('path', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get('path', 'audio') if isdir(path): for f in listdir(path): if f[0] !... |
path = settings.get('path', 'audio') | path = settings.get_path('media', 'audio') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get('path', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get('path', 'audio') if isdir(path): for f in listdir(path): if f[0] !... |
path = settings.get('path', 'text') | path = settings.get_path('media', 'text') | def medialist(): answer = dict() answer['all'] = [] answer['audio'] = [] answer['video'] = [] answer['txt'] = [] path = settings.get('path', 'video') if isdir(path): for f in listdir(path): if f[0] != '.': answer['video'].append(f) path = settings.get('path', 'audio') if isdir(path): for f in listdir(path): if f[0] !... |
path = settings.get('path', 'deviceslist') | path = settings.get_path('deviceslist') | def dispoList(): response.content_type = 'application/json' path = settings.get('path', 'deviceslist') try: answer = dict() with open(path, 'r') as file: # Use file to refer to the file object answer = json.loads( file.read() ) answer['status'] = 'success' return sendjson(answer) except: answer = dict() answer['statu... |
log.debug(onlyfiles) | def filelist(): filetype = request.forms.get('type') path = scenariopath+"/" onlyfiles = list() #onlyfiles.append(filetype+"_"+filetype+".json") if os.path.exists(path): onlyfiles = [ f.replace(filetype+"_",'') for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f.startswith(filetype+"_") ] log.debug... | |
if strob is not None: | if strob is not None and strob != '' and int(strob) > 0: | def setLight(self, rgb=None, led10w1=None, led10w2=None, strob=None, fade=None): cmd = 'setlight' if strob is not None: cmd += ' -strob {0}'.format(int(strob)) if fade is not None: cmd += ' -fade {0}'.format(int(fade)) if rgb is not None: rgb = re.split('\W+', rgb) if len(rgb) == 0: rgb = str(rgb) rgb = rgb.lstrip('#')... |
if fade is not None: | if fade is not None and fade != '' and int(fade) > 0: | def setLight(self, rgb=None, led10w1=None, led10w2=None, strob=None, fade=None): cmd = 'setlight' if strob is not None: cmd += ' -strob {0}'.format(int(strob)) if fade is not None: cmd += ' -fade {0}'.format(int(fade)) if rgb is not None: rgb = re.split('\W+', rgb) if len(rgb) == 0: rgb = str(rgb) rgb = rgb.lstrip('#')... |
Method: readLUT | def readLUT(self): """ Method: readLUT Created: 16.02.2006, KP Description: Read the LUT for this dataset """ lutpath = os.path.join(self.path,"%s.oif.files"%self.basename,"%s_LUT%d.lut"%(self.basename,self.channel)) f=codecs.open(lutpath,"r","utf-16") #print "Reading lut from %s..."%lutpath while 1: line=f.readline() ... | |
print max(vals) | def readLUT(self): """ Method: readLUT Created: 16.02.2006, KP Description: Read the LUT for this dataset """ lutpath = os.path.join(self.path,"%s.oif.files"%self.basename,"%s_LUT%d.lut"%(self.basename,self.channel)) f=codecs.open(lutpath,"r","utf-16") #print "Reading lut from %s..."%lutpath while 1: line=f.readline() ... | |
ctf.AddRGBPoint(i/255.0,r,g,b) | ctf.AddRGBPoint(i/16.0,r,g,b) | #def f(x):( (x>>16)&0xff |
Method: getSpacing() | def getSpacing(self): """ Method: getSpacing() Created: 12.04.2005, KP Description: Returns the spacing of the datasets this dataunit contains """ if not self.spacing: a,b,c = self.getVoxelSize() self.spacing=[1,b/a,c/a] return self.spacing | |
Method: getVoxelSize() | def getVoxelSize(self): """ Method: getVoxelSize() Created: 12.04.2005, KP Description: Returns the voxel size of the datasets this dataunit contains """ if not self.voxelsize: x,y,z,tp,ch,vx,vy,vz=self.getAllDimensions(self.parser) self.voxelsize=(vx,vy,vz) | |
Method: getAllDimensions | def getAllDimensions(self,parser): """ Method: getAllDimensions Created: 16.02.2006, KP Description: Read the number of timepoints, channels and XYZ from the OIF file """ timepoints = 0 channels = 0 x = 0 y = 0 z = 1 for i in range(0,7): sect="Axis %d Parameters Common"%i key = "AxisCode" data = parser.get(sect,key) # ... | |
return self.pos | return self.posInPixels | def getCenterOfMass(self): """ Created: 26.11.2006, KP Description: Return the center of mass component """ return self.pos |
tracks=[[]*trackCount] | tracks=[] for i in range(trackCount):tracks.append([]) | def track(self, fromTimepoint=0, seedParticles=[]): """ Created: KP Description: Perform the actual tracking using the given particles and tracking parameters. """ tracks=[] trackCount=0 totalTimepoints = len(self.particles) searchOn = False foundOne = False print "Total timepoints=",totalTimepoints minDists, maxDists,... |
def ReOrderItems(self,tgtsize=0): """ Created: 27.04.2006, KP Description: A method for re-ordering the toolbar items to rows """ for ctrl in self.ctrls: if ctrl in self.ctrlToRow: sizer = self.ctrlToRow[ctrl] if sizer: if sizer in self.rowsizers: self.sizer.Detach(sizer) self.rowsizers.remove(sizer) sizer.Detach(ctr... | def ReOrderItems2(self, layout, width): """ Created: 28.07.2006, KP Description: Re-order the items based on a given layout """ for sizer in self.rowsizers: try: while sizer.GetItem(0): sizer.Detach(0) except: pass ms = 0 for y,row in enumerate(layout): self.x =0 for i,ctrl in enumerate(row): self.rowsizers[y].Add(ctrl... | |
Method: AddControl | def AddControl(self,ctrl): """ Method: AddControl Created: 27.04.2006, KP Description: Add a control to the toolbar """ self.ctrls.append(ctrl) self.idToTool[ctrl.GetId()] = ctrl self.sizes.append(ctrl.GetSize()[0]) #self.sizer.Add(ctrl,(self.y,self.x)) self.x+=1 | |
Method: ToggleTool | def ToggleTool(self,toolid,flag): """ Method: ToggleTool Created: 27.04.2006, KP Description: A method for toggling a togglebutton on or off """ ctrl = self.idToTool[toolid] ctrl.SetToggle(flag) | |
Method: AddSeparator | def AddSeparator(self): """ Method: AddSeparator Created: 27.04.2006, KP Description: A method for adding a separator to the toolbar """ sep = wx.Panel(self,-1,size=(2,32),style = wx.SUNKEN_BORDER) #self.sizer.Add(sep, (self.y,self.x)) self.x+=1 self.ctrls.append(sep) self.idToTool[sep.GetId()] = sep self.sizes.append(... | |
Method: GetToolSeparation | def GetToolSeparation(self): """ Method: GetToolSeparation Created: 27.04.2006, KP Description: Return the width between tools """ return self.toolSeparation | |
Method: GetToolSize | def GetToolSize(self): """ Method: GetToolSize Created: 27.04.2006, KP Description: Return the size of a toolbar item """ return self.toolSize | |
cref = cref.split('::')[-1] | cconstref = cconstref.split('::')[-1] | pat = r'typedef *(list|vector) *< *([^ ].*[^ ]) *>' |
for iname in sys.argv[1:]: | for iname in inames: | pat = r'typedef *(list|vector) *< *([^ ].*[^ ]) *>' |
return int(val) | return int(val) def get_UseSoapProtocol(self): val = self.__getConfigAttribute('UseSoapProtocol') if val == None or val == "": return 0 else: return int(val) | def get_UseSSL(self): val = self.__getConfigAttribute('UseSSL') if val == None or val == "": return 0 else: return int(val) |
self._code = code | if code == -1: if message == "OK": self._code = 0 else: self._code = 1 else: self._code = code | def __init__(self, code, message): self._code = code self._message = message |
__connect() | def Initialize(customConfig = "ProbeConfig"): "This function initializes the Gratia metering engine" "We connect/register with the collector and load" "this meter's configuration" "We also load the list of record files that have not" "yet been sent" global Config if len(BackupDirList) == 0: # This has to be the first ... | |
if Config.get_UseSSL() == 0: | if Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 1: | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) else: if Config.get_UseGratiaCertificates() == 0: __connection = httplib.HTTPSConnection(Config.... |
else: if Config.get_UseGratiaCertificates() == 0: __connection = httplib.HTTPSConnection(Config.get_SSLHost(), cert_file = Config.get_CertificateFile(), key_file = Config.get_KeyFile()) else: __connection = httplib.HTTPSConnection(Config.get_SSLHost(), cert_file = Config.get_GratiaCertificateFile(), key_file = Config.g... | print "Using SOAP protocol" elif Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 0: __connection = httplib.HTTPConnection(Config.get_SOAPHost()) __connection.connect() DebugPrint(1,"Connection via HTTP to: " + Config.get_SOAPHost()) print "Using POST protocol" elif Config.get_UseSSL() == 1 and Config.get_U... | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) else: if Config.get_UseGratiaCertificates() == 0: __connection = httplib.HTTPSConnection(Config.... |
if Config.get_UseSSL() == 0: | if Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 1: | def __sendUsageXML(meterId, recordXml): global __connection global __connectionError try: # Connect to the web service, in case we aren't already connected. If we are already connected, this call will do nothing __connect() __connectionError = False # Generate a unique Id for this transaction transactionId = meterId... |
response = Response(1, responseString) | response = Response(-1, responseString) | def __sendUsageXML(meterId, recordXml): global __connection global __connectionError try: # Connect to the web service, in case we aren't already connected. If we are already connected, this call will do nothing __connect() __connectionError = False # Generate a unique Id for this transaction transactionId = meterId... |
response = Response(1, responseString) | response = Response(1,responseString) elif Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 0: __connection.request("POST",Config.get_CollectorService(),"command=update&arg1=" + recordXml) responseString = __connection.getresponse().read() response = Response(-1, responseString) | def __sendUsageXML(meterId, recordXml): global __connection global __connectionError try: # Connect to the web service, in case we aren't already connected. If we are already connected, this call will do nothing __connect() __connectionError = False # Generate a unique Id for this transaction transactionId = meterId... |
(f,dirIndex,recordIndex) = OpenNewRecordFile(dirIndex,recordIndex) DebugPrint(1,"Will save in the record in:",f.name) DebugPrint(3,"DirIndex=",dirIndex," RecordIndex=",recordIndex) if f.name == "<stdout>": success = True else: try: for line in record.XmlData: f.write(line) f.flush(); if f.tell() > 0: success = True Deb... | (f,dirIndex,recordIndex) = OpenNewRecordFile(dirIndex,recordIndex) DebugPrint(1,"Will save in the record in:",f.name) DebugPrint(3,"DirIndex=",dirIndex," RecordIndex=",recordIndex) if f.name == "<stdout>": success = True else: try: for line in record.XmlData: f.write(line) f.flush(); if f.tell() > 0: success = True Deb... | def Send(record): global __connectionError global WroteTooManyFiles DebugPrint(0, "***********************************************************") DebugPrint(1,"Record: ",record) DebugPrint(1,"Username: ", record.Username) # Check if there are too many pending files (canProcess, responseString) = CanProcess() if not ca... |
except: DebugPrint(0,"failed to fill with exception: ",f.name,"--", sys.exc_info(),"--",sys.exc_info()[0],"++",sys.exc_info()[1]) if f.name != "<stdout>": os.remove(f.name) | def Send(record): global __connectionError global WroteTooManyFiles DebugPrint(0, "***********************************************************") DebugPrint(1,"Record: ",record) DebugPrint(1,"Username: ", record.Username) # Check if there are too many pending files (canProcess, responseString) = CanProcess() if not ca... | |
seconds = value % 60 | seconds = (int(value*100) % 6000 ) / 100.0 | def Duration(self,value): " Helper Function to generate the xml (Do not call directly)" seconds = value % 60 value = int( (value - seconds) / 60 ) minutes = value % 60 value = (value - minutes) / 60 hours = value % 24 value = (value - hours) / 24 result = "P" if value>0: result = result + str(value) + "D" if (hours>0 o... |
print "Connected via HTTS to: " + Config.get_SOAPHost() | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) print "Connected via HTTS to: " + Config.get_SOAPHost() else: if Config.get_UseSSLCertificates()... | |
print "Connected via HTTPS to: " + Config.get_SSLHost() __connected = 1 | DebugPrint(1, "Connected via HTTPS to: " + Config.get_SSLHost()) __connected = 1 | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) print "Connected via HTTS to: " + Config.get_SOAPHost() else: if Config.get_UseSSLCertificates()... |
if mapMatch: self.__UserVOMapFile = mapMatch.group[0] | if mapMatch: self.__UserVOMapFile = mapMatch.group(1) | def get_UserVOMapFile(self): if self.__UserVOMapFile: return self.__UserVOMapFile val = self.__getConfigAttribute('UserVOMapFile') if val and re.search(r'MAGIC_VDT_LOCATION', val): val = re.sub(r'MAGIC_VDT_LOCATION', self.__findVDTTop(), val) if path.os.isfile(val): self.__UserVOMapFile = val elif val and os.path.isfil... |
print Gratia.Send(r) | Gratia.Send(r) | def SendData(values, dateAsSecondSinceEpoch): # This function takes the input data passed as a python tuple, # create the Gratia record and send it. (SiteName, UserVoName, WallHours, Njobs) = values r = Gratia.UsageRecord() r.Njobs(toint(Njobs)) r.WallDuration( toint(WallHours)*3600) # The argument must be in seconds... |
argOutput = PSACCTReport.gOutput | argOutput = "None" | def main(argv=None): UseArgs(argv) argOutput = PSACCTReport.gOutput Gratia.Initialize() result = PSACCTReport.DailySiteVOReport(PSACCTReport.gBegin,output=argOutput) print result dateAsSecondSinceEpoch = time.mktime(PSACCTReport.gBegin.timetuple()) # else: # today = time.localtime() # ... |
print result | def main(argv=None): UseArgs(argv) argOutput = PSACCTReport.gOutput Gratia.Initialize() result = PSACCTReport.DailySiteVOReport(PSACCTReport.gBegin,output=argOutput) print result dateAsSecondSinceEpoch = time.mktime(PSACCTReport.gBegin.timetuple()) # else: # today = time.localtime() # ... | |
print line[0:4] | def main(argv=None): UseArgs(argv) argOutput = PSACCTReport.gOutput Gratia.Initialize() result = PSACCTReport.DailySiteVOReport(PSACCTReport.gBegin,output=argOutput) print result dateAsSecondSinceEpoch = time.mktime(PSACCTReport.gBegin.timetuple()) # else: # today = time.localtime() # ... | |
++__connectionRetries | __connectionRetries += 1 | def __connect(): global __connection global __connected global __connectionError if __connectionError: __disconnect() ++__connectionRetries if __connectionRetries > MaxConnectionRetries: Error("Unable to reconnect after ", MaxConnectionRetries, " attempts") sys.exit(1) __connectionError = False if not __connected: if ... |
DebugPrint(1, 'Disconnected from ' + Config.get_SSLHost() + '/jclarens/xmlrpc' ) | DebugPrint(1, 'Disconnected from ' + Config.get_SSLHost() ) | def __disconnect(): global __connection global __connected try: if Config.get_UseSSL() != 0 and __connected == 1: __connection.system.logout() __connected = 0 DebugPrint(1, 'Disconnected from ' + Config.get_SSLHost() + '/jclarens/xmlrpc' ) except: DebugPrint(0, 'Failed to disconnect from ' + Config.get_SSLHost() + ': ... |
print "Using SOAP protocol" | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 1: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) print "Using SOAP protocol" elif Config.get_UseSSL() == 0 ... | |
print "Using POST protocol" | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 1: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) print "Using SOAP protocol" elif Config.get_UseSSL() == 0 ... | |
print "Using SSL protocol" | def __connect(): global __connection global __connected if __connected == 0: if Config.get_UseSSL() == 0 and Config.get_UseSoapProtocol() == 1: __connection = httplib.HTTP(Config.get_SOAPHost()) DebugPrint(1, 'Connected via HTTP to: ' + Config.get_SOAPHost()) print "Using SOAP protocol" elif Config.get_UseSSL() == 0 ... | |
print "Mkdir %s" % repr(newdir) | def Mkdir(newdir): """works the way a good mkdir should :) - already exists, silently complete - regular file in the way, raise an exception - parent directory(ies) does not exist, make them as well """ if os.path.isdir(newdir): pass elif os.path.isfile(newdir): raise OSError("a file with the same name as the desired "... | |
(r'(function)(\s+)', bygroups(Keyword, Text), 'functionname'), | (r'(function)(\s+)(&?)(\s*)', bygroups(Keyword, Text, Operator, Text), 'functionname'), | def analyse_text(text): if html_doctype_matches(text): return 0.5 |
(r'<\s*[a-zA-Z0-9:-]+', Name.Tag, 'tag'), (r'<\s*/\s*[a-zA-Z0-9:-]+\s*>', Name.Tag), | (r'<\s*[a-zA-Z0-9:.-]+', Name.Tag, 'tag'), (r'<\s*/\s*[a-zA-Z0-9:.-]+\s*>', Name.Tag), | def analyse_text(text): rv = 0.0 for tag in '<?php', '?>': if tag in text: rv += 0.2 return rv |
(r'[a-zA-Z0-9_:-]+\s*=', Name.Attribute, 'attr'), | (r'[a-zA-Z0-9_.:-]+\s*=', Name.Attribute, 'attr'), | def analyse_text(text): rv = 0.0 for tag in '<?php', '?>': if tag in text: rv += 0.2 return rv |
return Lexer.get_tokens(self, text) | text = text.strip('\n') + '\n' for i, t, v in self.get_tokens_unprocessed(text): yield t, v | def get_tokens(self, text): if self.compress == 'gz': import gzip gzipfile = gzip.GzipFile('', 'rb', 9, cStringIO.StringIO(text)) text = gzipfile.read() elif self.compress == 'bz2': import bz2 text = bz2.decompress(text) return Lexer.get_tokens(self, text) |
write("%s\t%r\n" % (lasttype, lastval)) | write("%s\t%s\n" % (lasttype, lastval)) | def flush(): outfile.write(compressor.flush()) outfile.flush() |
('(%s)' % '|'.join( re.escape(entry) + ' ' for entry in keywords), | ('(%s)' % '|'.join([ re.escape(entry) + ' ' for entry in keywords]), | def get_tokens_unprocessed(self, text): for index, token, value in \ RegexLexer.get_tokens_unprocessed(self, text): if token is Name: if value in self._functions: yield index, Name.Function, value continue elif '.' in value: a, b = value.split('.') yield index, Name, a yield index + len(a), Text, u'.' yield index + len... |
("(?<=\()(%s)" % '|'.join( re.escape(entry) + ' ' for entry in builtins), | ("(?<=\()(%s)" % '|'.join([ re.escape(entry) + ' ' for entry in builtins]), | def get_tokens_unprocessed(self, text): for index, token, value in \ RegexLexer.get_tokens_unprocessed(self, text): if token is Name: if value in self._functions: yield index, Name.Function, value continue elif '.' in value: a, b = value.split('.') yield index, Name, a yield index + len(a), Text, u'.' yield index + len... |
(r'[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)*', | (r'[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z0-9_]+)*', | def analyse_text(text): rv = 0.0 if re.search('\{if\s+.*?\}.*?\{/if\}', text): rv += 0.15 if re.search('\{include\s+file=.*?\}', text): rv += 0.15 if re.search('\{foreach\s+.*?\}.*?\{/foreach\}', text): rv += 0.15 if re.search('\{\$.*?\}', text): rv += 0.01 return rv |
super(GenshiLexer, self).__init__(HtmlLexer, GenshiMarkupLexer, | super(GenshiLexer, self).__init__(XmlLexer, GenshiMarkupLexer, | def __init__(self, **options): super(GenshiLexer, self).__init__(HtmlLexer, GenshiMarkupLexer, **options) |
next_token_is_function | def get_tokens_unprocessed(self, text): scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE) stack = ['initial'] in_function_block = False in_property_block = False was_dot = False next_token_is_function = False next_token_is_property = False collect_labels = False block_labels = set() brace_balance = [0, ... | |
lowercase_name in ('read, write'): | lowercase_name in ('read', 'write'): | def get_tokens_unprocessed(self, text): scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE) stack = ['initial'] in_function_block = False in_property_block = False was_dot = False next_token_is_function = False next_token_is_property = False collect_labels = False block_labels = set() brace_balance = [0, ... |
for _, fullname, names, exts in LEXERS.itervalues(): | for _, fullname, names, exts, mimetypes in LEXERS.itervalues(): | def cmdline_main(args): """ Make pygments usable as a command line utility. """ import getopt USAGE = """\ |
(r'(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)', heredoc_callback), | (r'(?<!\w)(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)', heredoc_callback), | def intp_string_callback(self, match, ctx): yield match.start(1), String.Other, match.group(1) nctx = LexerContext(match.group(3), 0, ['interpolated-string']) for i, t, v in self.get_tokens_unprocessed(context=nctx): yield match.start(3)+i, t, v yield match.start(4), String.Other, match.group(4) # end ctx.pos = matc... |
(r'\s', Text), | (r'[^\S\n]+', Text), | def analyse_text(text): if text[0] != '.': return False if text[:3] == '.\\"': return True if text[:4] == '.TH ': return True if text[1:3].isalnum() and text[3].isspace(): return 0.9 |
O_opts[o_arg] = True | opts[o_arg] = True | def _parse_options(o_str): opts = {} if not o_str: return opts o_args = o_str.split(',') for o_arg in o_args: o_arg = o_arg.strip() try: o_key, o_val = o_arg.split('=') o_key = o_key.strip() o_val = o_val.strip() except ValueError: O_opts[o_arg] = True else: O_opts[o_key] = o_val return opts |
O_opts[o_key] = o_val | opts[o_key] = o_val | def _parse_options(o_str): opts = {} if not o_str: return opts o_args = o_str.split(',') for o_arg in o_args: o_arg = o_arg.strip() try: o_key, o_val = o_arg.split('=') o_key = o_key.strip() o_val = o_val.strip() except ValueError: O_opts[o_arg] = True else: O_opts[o_key] = o_val return opts |
(r' | (r" | def get_tokens_unprocessed(self, text): for index, token, value in \ RegexLexer.get_tokens_unprocessed(self, text): if token is Name: if value in self._functions: yield index, Name.Function, value continue elif '.' in value: a, b = value.split('.') yield index, Name, a yield index + len(a), Text, u'.' yield index + len... |
_tokens = {} | def __call__(cls, *args, **kwds): if not hasattr(cls, '_tokens'): cls._tokens = {} cls._tmpname = 0 for state in cls.tokens.keys(): cls._process_state(state) | |
tests.sort(key=lambda x: x[0]) | tests.sort(lambda x, y: cmp(x[0], y[0])) | def run_tests(): # needed to avoid confusion involving atexit handlers import logging orig_modules = sys.modules.keys() if sys.argv[1:]: # test only files given on cmdline files = [entry + '.py' for entry in sys.argv[1:] if entry.startswith('test_')] else: files = [entry for entry in os.listdir(testdir) if (entry.sta... |
suite.addTests(x[1] for x in tests) | suite.addTests([x[1] for x in tests]) | def run_tests(): # needed to avoid confusion involving atexit handlers import logging orig_modules = sys.modules.keys() if sys.argv[1:]: # test only files given on cmdline files = [entry + '.py' for entry in sys.argv[1:] if entry.startswith('test_')] else: files = [entry for entry in os.listdir(testdir) if (entry.sta... |
if not self.encoding: outfile.write(u'') | def format(self, tokensource, outfile): if not self.encoding: outfile.write(u'') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.