rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
debugger_prefix += ['--dsymutil=yes'] | debugger_prefix.append('--dsymutil=yes') | def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]... |
debugger_prefix += [ valgrind_args ] | debugger_prefix.append(OPTIONS.valgrind_args) | def run_tests(tests, results): """Run the given tests, sending raw results to the given results accumulator.""" pb = None if not OPTIONS.hide_progress: try: from progressbar import ProgressBar pb = ProgressBar('', len(tests), 16) except ImportError: pass results.pb = pb test_list = [ TestTask(test) for test in tests ]... |
print(cmd) | print(subprocess.list2cmdline(cmd)) | def run_test(test, lib_dir): if test.tmflags: env = os.environ.copy() env['TMFLAGS'] = test.tmflags else: env = None cmd = get_test_cmd(test.path, lib_dir) if (test.valgrind and any([os.path.exists(os.path.join(d, 'valgrind')) for d in os.environ['PATH'].split(os.pathsep)])): valgrind_prefix = [ 'valgrind', '-q', '--s... |
_redefines = re.compile('define|endef') | _redefines = re.compile('\s*define|\s*endef') | def itercommandchars(d, offset, tokenlist, it): """ Iterate over command syntax. # comment markers are not special, and escaped newlines are included in the output text. """ assert offset >= d.lstart and offset <= d.lend, "offset %i should be between %i and %i" % (offset, d.lstart, d.lend) if offset == d.lend: return... |
directive = m.group(0) | directive = m.group(0).strip() | as they would be in makefile syntax. Internal define/endef pairs are ignored. |
validateParam(member, param) | argName = 'arg%d' % i argTypeKey = argName + 'Type' if customMethodCall is None or not argTypeKey in customMethodCall: validateParam(member, param) realtype = param.realtype else: realtype = xpidl.Forward(name=customMethodCall[argTypeKey], location='', doccomments='') | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... |
f, i, 'arg%d' % i, param.realtype, | f, i, argName, realtype, | def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False): """ Write a single quick stub (a custom SpiderMonkey getter/setter/method) for the specified XPCOM interface-member. """ isAttr = (member.kind == 'attribute') isMethod = (member.kind == 'method') assert isAttr or isMethod isGetter = isAttr and ... |
validateParam(member, param) type = unaliasType(param.realtype) | def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N... | |
param.realtype, haveCcx, rvdeclared) | realtype, haveCcx, rvdeclared) | def writeTraceableQuickStub(f, customMethodCalls, member, stubName): assert member.traceable traceInfo = { 'type': getTraceInfoReturnType(member.realtype) + "_FAIL", 'params': ["CONTEXT", "THIS"] } haveCcx = memberNeedsCcx(member) customMethodCall = customMethodCalls.get(stubName, None) if customMethodCall is not N... |
def __init__(self, host, port = 27020): | agentErrorRE = re.compile('^ def __init__(self, host, port = 20701): | def __str__(self): return self.msg |
def sendCMD(self, cmdline, newline = True, sleep = 0): | def cmdNeedsResponse(self, cmd): """ Not all commands need a response from the agent: * if the cmd matches the pushRE then it is the first half of push and therefore we want to wait until the second half before looking for a response * rebt obviously doesn't get a response * uninstall performs a reboot to ensure starti... | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
pushre = re.compile('^push .*$') | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') | |
noQuit = False | shouldCloseSocket = False recvGuard = 1000 | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
if (cmd == 'quit'): break | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') | |
self._sock.send(cmd) | numbytes = self._sock.send(cmd) if (numbytes != len(cmd)): print "ERROR: our cmd was " + str(len(cmd)) + " bytes and we only sent " + str(numbytes) return None | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
if (pushre.match(cmd) or cmd == 'rebt'): noQuit = True elif noQuit == False: time.sleep(int(sleep)) | shouldCloseSocket = self.shouldCmdCloseSocket(cmd) if (self.cmdNeedsResponse(cmd)): | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
while (found == False): | loopguard = 0 while (found == False and (loopguard < recvGuard)): | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
time.sleep(int(sleep)) if (noQuit == True): | loopguard = loopguard + 1 if (shouldCloseSocket == True): | def sendCMD(self, cmdline, newline = True, sleep = 0): promptre = re.compile(self.prompt_regex + '$') |
sleepsize = 1024 * 1024 sleepTime = (int(filesize / sleepsize) * 5) + 2 | def pushFile(self, localname, destname): if (self.debug >= 2): print "in push file with: " + localname + ", and: " + destname if (self.validateFile(destname, localname) == True): if (self.debug >= 2): print "files are validated" return '' | |
retVal = self.sendCMD(['push ' + destname + '\r\n', data], newline = False, sleep = sleepTime) if (retVal == None): if (self.debug >= 2): print "Error in sendCMD, not validating push" return None if (self.validateFile(destname, localname) == False): if (self.debug >= 2): print "file did not copy as expected" return No... | retVal = self.sendCMD(['push ' + destname + ' ' + str(filesize) + '\r\n', data], newline = False) if (self.debug >= 3): print "push returned: " + str(retVal) validated = False if (retVal): retline = self.stripPrompt(retVal).strip() if (retline == None or self.agentErrorRE.match(retVal)): validated = self.validateFil... | def pushFile(self, localname, destname): if (self.debug >= 2): print "in push file with: " + localname + ", and: " + destname if (self.validateFile(destname, localname) == True): if (self.debug >= 2): print "files are validated" return '' |
time.sleep(5) | def pushDir(self, localDir, remoteDir): if (self.debug >= 2): print "pushing directory: " + localDir + " to " + remoteDir for root, dirs, files in os.walk(localDir): parts = root.split(localDir) for file in files: remoteRoot = remoteDir + '/' + parts[1] remoteName = remoteRoot + '/' + file if (parts[1] == ""): remoteRo... | |
data = self.sendCMD(['cd ' + dirname, 'cwd', 'quit'], sleep = 1) | data = self.sendCMD(['cd ' + dirname, 'cwd']) | def dirExists(self, dirname): match = ".*" + dirname + "$" dirre = re.compile(match) data = self.sendCMD(['cd ' + dirname, 'cwd', 'quit'], sleep = 1) if (data == None): return None retVal = self.stripPrompt(data) data = retVal.split('\n') found = False for d in data: if (dirre.match(d)): found = True |
data = self.sendCMD(['cd ' + rootdir, 'ls', 'quit'], sleep=1) | data = self.sendCMD(['cd ' + rootdir, 'ls']) | def listFiles(self, rootdir): if (self.dirExists(rootdir) == False): return [] data = self.sendCMD(['cd ' + rootdir, 'ls', 'quit'], sleep=1) if (data == None): return None retVal = self.stripPrompt(data) return retVal.split('\n') |
return self.sendCMD(['rm ' + filename, 'quit']) | return self.sendCMD(['rm ' + filename]) | def removeFile(self, filename): if (self.debug>= 2): print "removing file: " + filename return self.sendCMD(['rm ' + filename, 'quit']) |
self.sendCMD(['rmdr ' + remoteDir], sleep = 5) | self.sendCMD(['rmdr ' + remoteDir]) | def removeDir(self, remoteDir): self.sendCMD(['rmdr ' + remoteDir], sleep = 5) |
data = self.sendCMD(['ps'], sleep = 3) | data = self.sendCMD(['ps']) | def getProcessList(self): data = self.sendCMD(['ps'], sleep = 3) if (data == None): return None retVal = self.stripPrompt(data) lines = retVal.split('\n') files = [] for line in lines: if (line.strip() != ''): pidproc = line.strip().split() if (len(pidproc) == 2): files += [[pidproc[0], pidproc[1]]] elif (len(pidproc)... |
data = self.sendCMD(['mems', 'quit']) | data = self.sendCMD(['mems']) | def getMemInfo(self): data = self.sendCMD(['mems', 'quit']) if (data == None): return None retVal = self.stripPrompt(data) # TODO: this is hardcoded for now fhandle = open("memlog.txt", 'a') fhandle.write("\n") fhandle.write(retVal) fhandle.close() |
data = self.sendCMD(['tmpd', 'quit']) | data = self.sendCMD(['tmpd']) | def getTempDir(self): retVal = '' data = self.sendCMD(['tmpd', 'quit']) if (data == None): return None return self.stripPrompt(data).strip('\n') |
data = self.sendCMD(['cat ' + remoteFile, 'quit'], sleep = 5) | data = self.sendCMD(['cat ' + remoteFile]) | def getFile(self, remoteFile, localFile = ''): if localFile == '': localFile = os.path.join(self.tempRoot, "temp.txt") promptre = re.compile(self.prompt_regex + '.*') data = self.sendCMD(['cat ' + remoteFile, 'quit'], sleep = 5) if (data == None): return None retVal = self.stripPrompt(data) fhandle = open(localFile, '... |
data = self.sendCMD(['hash ' + filename, 'quit'], sleep = 1) | data = self.sendCMD(['hash ' + filename]) | def getRemoteHash(self, filename): data = self.sendCMD(['hash ' + filename, 'quit'], sleep = 1) if (data == None): return '' retVal = self.stripPrompt(data) if (retVal != None): retVal = retVal.strip('\n') if (self.debug >= 3): print "remote hash returned: '" + retVal + "'" return retVal |
data = self.sendCMD(['testroot'], sleep = 1) | data = self.sendCMD(['testroot']) | def getDeviceRoot(self): if (not self.deviceRoot): data = self.sendCMD(['testroot'], sleep = 1) if (data == None): return '/tests' self.deviceRoot = self.stripPrompt(data).strip('\n') + '/tests' |
def getInfo(self, directive): | def getInfo(self, directive=None): | def validateDir(self, localDir, remoteDir): if (self.debug >= 2): print "validating directory: " + localDir + " to " + remoteDir for root, dirs, files in os.walk(localDir): parts = root.split(localDir) for file in files: remoteRoot = remoteDir + '/' + parts[1] remoteRoot = remoteRoot.replace('/', '/') if (parts[1] == "... |
if (directive in ('os','id','uptime','systime','screen','memory','process', 'disk','power')): data = self.sendCMD(['info ' + directive, 'quit'], sleep = 1) | result = {} collapseSpaces = re.compile(' +') directives = ['os', 'id','uptime','systime','screen','memory','process', 'disk','power'] if (directive in directives): directives = [directive] for d in directives: data = self.sendCMD(['info ' + d]) if (data is None): continue data = self.stripPrompt(data) data = collap... | def getInfo(self, directive): data = None if (directive in ('os','id','uptime','systime','screen','memory','process', 'disk','power')): data = self.sendCMD(['info ' + directive, 'quit'], sleep = 1) else: directive = None data = self.sendCMD(['info', 'quit'], sleep = 1) |
directive = None data = self.sendCMD(['info', 'quit'], sleep = 1) if (data is None): return None data = self.stripPrompt(data) result = {} if directive: result[directive] = data.split('\n') for i in range(len(result[directive])): if (len(result[directive][i]) != 0): result[directive][i] = result[directive][i].strip(... | return True """ Uninstalls the named application from device and causes a reboot. Takes an optional argument of installation path - the path to where the application was installed. Returns True, but it doesn't mean anything other than the command was sent, the reboot happens and we don't know if this succeeds or not. ... | def getInfo(self, directive): data = None if (directive in ('os','id','uptime','systime','screen','memory','process', 'disk','power')): data = self.sendCMD(['info ' + directive, 'quit'], sleep = 1) else: directive = None data = self.sendCMD(['info', 'quit'], sleep = 1) |
" XPCReadableJSStringWrapper ${name}(${argVal});\n", | " XPCReadableJSStringWrapper ${name};\n" " if (!${name}.init(cx, ${argVal})) {\n" "${error}", | def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent)) |
" NS_ConvertUTF16toUTF8 ${name}(" "(const PRUnichar *)JS_GetStringChars(${argVal}), " "JS_GetStringLength(${argVal}));\n", | " size_t ${name}_length;\n" " const jschar *${name}_chars = JS_GetStringCharsAndLength(cx, " "${argVal}, &${name}_length);\n" " if (!${name}_chars) {\n" "${error}" " NS_ConvertUTF16toUTF8 ${name}(${argVal}_chars, ${argVal}_length);\n", | def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent)) |
" NS_ConvertUTF16toUTF8 ${name}_utf8(" "(const PRUnichar *)JS_GetStringChars(${argVal}), " "JS_GetStringLength(${argVal}));\n" | " size_t ${name}_length;\n" " const jschar *${name}_chars = JS_GetStringCharsAndLength(cx, " "${argVal}, &${name}_length);\n" " if (!${name}_chars) {\n" "${error}" " NS_ConvertUTF16toUTF8 ${name}_utf8(${name}_chars, ${name}_length);\n" | def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent)) |
" const PRUnichar *${name} = JS_GetStringChars({argVal});\n", | " const jschar *${name}_chars = JS_GetStringCharsZ(cx, {argVal});\n" " if (!${name}_chars) {\n" "${error}" " const PRUnichar *${name} = ${name}_chars;\n", | def writeFailure(f, retval, indent): f.write(getFailureString(retval, indent)) |
'argVal': argVal | 'argVal': argVal, 'error': getFailureString(getTraceInfoDefaultReturn(member.realtype), 2) | def writeTraceableArgumentConversion(f, member, i, name, type, haveCcx, rvdeclared): argVal = "_arg%d" % i params = { 'name': name, 'argVal': argVal } typeName = getBuiltinOrNativeTypeName(type) if typeName is not None: template = traceableArgumentConversionTemplates.get(typeName) if template is not None: f.write(sub... |
servers_file = open(UTCFG.ServersFile, "a") servers_file.write(new_line) servers_file.close() | self.fdb.addLine(new_line) | def play(self, tree, path=None, column=None): (model, iter) = self.tree.get_selection().get_selected() if iter!=None: launch_cmd = self.urtExec + " +connect " + model.get(iter, 1)[0] else: launch_cmd = self.urtExec # === LAUNCHING THE GAME === print("launching game with command : " + launch_cmd) args = shlex.split(lau... |
def __init__(self, players_): self.players = players_ | def __init__(self): self.players = {} | def __init__(self, players_): #we get a link to the players we'll display in the tooltip self.players = players_ TreeViewTooltips.__init__(self) self.label.set_use_markup(False) #to prevent wrong parsing from players names |
if loop>=6: | if loop>6: | def get_tooltip(self, view_, column_, path_): tooltip = "" try: address = view_.get_model()[path_[0]][1] loop = 0 for player in self.players[address]: tooltip += player.split('"')[1] + "\n" loop += 1 if loop>=6: tooltip += "..." break except: tooltip += "SERVER UNREACHABLE\n" return tooltip |
playtt = PlayersToolTips(self.players) playtt.add_view(self.tree) | self.playtt = PlayersToolTips() self.playtt.add_view(self.tree) | def __init__(self): gobject.threads_init() #threads for GTK #default values, can be changed by the config self.UrtExec = UrtExec #loading the cfg file that repleaces some values if needed self.loadCfg() |
self.players[address] = utsq_cli.clients | self.players[address] = self.playtt.players[address] = utsq_cli.clients | def loadFile(self, init_=True): #are we asked to clean the input fields? if init_: #once loaded, we clean the input fields self.server_address.set_text("") self.server_name.set_text("") self.game_type.set_active(-1) self.del_bt.set_sensitive(False) |
logger.info(repr(pt_class)) | logger.debug(repr(pt_class)) | def get_and_bind(template, view=None, cls=None): inst = get(template, view, cls) if inst._v_last_read is False: inst.registry.purge() inst.read() return five_bind(inst, view, cls) |
logger.info(repr(pt_class)) | logger.debug(repr(pt_class)) | def five_get_and_bind(template, view=None, cls=None): inst = get(template, view, cls) if inst._v_last_read is False: inst.read() return zope_bind(inst, view, cls) |
logger.info(repr(fs_class)) | logger.debug(repr(fs_class)) | def set_filename(obj, value, *args): obj._filepath = value |
from Products.Five.browser.pagetemplatefile import \ BoundPageTemplate | zope_bind = pt_class.__get__ | def get_and_bind(template, view=None, cls=None): inst = get(template, view, cls) if inst._v_last_read is False: inst.registry.purge() inst.read() return five_bind(inst, view, cls) |
zope_bind = pt_class.__get__ | def get_and_bind(template, view=None, cls=None): inst = get(template, view, cls) if inst._v_last_read is False: inst.registry.purge() inst.read() return five_bind(inst, view, cls) | |
for pt_class in PT_CLASSES: pt_class.__get__ = get logger.info(repr(pt_class)) | def get_and_bind(template, view=None, cls=None): inst = get(template, view, cls) if inst._v_last_read is False: inst.registry.purge() inst.read() return bind(inst, view, cls) | |
test_id = self._testNameFromId(event.name) if test_id is not None: event.name = test_id | testid = self._testNameFromId(event.name) if testid is not None: event.name = testid | def loadTestsFromName(self, event): """Implement hook. If the name is a number, it might be an ID assigned by us. If we can find a test to which we have assigned that ID, event.name is changed to the test's real ID. In this way, tests can be referred to via sequential numbers. """ test_id = self._testNameFromId(event.... |
test_id = self._testNameFromId(name) if test_id is not None: event.names[i] = test_id | testid = self._testNameFromId(name) if testid is not None: event.names[i] = testid | def loadTestsFromNames(self, event): """Implement hook.""" new_names = [] for i, name in enumerate(event.names[:]): test_id = self._testNameFromId(name) if test_id is not None: event.names[i] = test_id |
<a href="%(siteurl)s?ln=%(ln)s"> | <a class="img" href="%(siteurl)s?ln=%(ln)s"> | def tmpl_pageheader(self, req, ln=CFG_SITE_LANG, headertitle="", description="", keywords="", userinfobox="", useractivities_menu="", adminactivities_menu="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0, navmenuid="admin", metaheaderadd="", rssurl=CFG_SITE_URL+"/rss", body_css_classes=None): |
if lastupdated: | if lastupdated and lastupdated != '$Date$': | def tmpl_pagefooter(self, req=None, ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=""): """Creates a page footer Parameters: |
%(sitename)s :: <a class="footer" href="%(siteurl)s/?ln=%(ln)s">%(msg_search)s</a> :: <a class="footer" href="%(siteurl)s/submit?ln=%(ln)s">%(msg_submit)s</a> :: <a class="footer" href="%(sitesecureurl)s/youraccount/display?ln=%(ln)s">%(msg_personalize)s</a> :: <a class="footer" ... | %(sitename)s :: <a class="footer" href="%(siteurl)s/?ln=%(ln)s">%(msg_search)s</a> :: <a class="footer" href="%(siteurl)s/help/%(langlink)s">%(msg_help)s</a> | def tmpl_pagefooter(self, req=None, ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=""): """Creates a page footer Parameters: |
'sitesupportemail' : CFG_SITE_SUPPORT_EMAIL, | 'sitesupportemail' : 'feedback@inspire-hep.net', | def tmpl_pagefooter(self, req=None, ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=""): """Creates a page footer Parameters: |
'msg_submit' : _("Submit"), 'msg_personalize' : _("Personalize"), | def tmpl_pagefooter(self, req=None, ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=""): """Creates a page footer Parameters: | |
[major, minor] = version.split('.')[:2] return "%s.%s" % (major, minor) | [major, minor, patchlevel] = version.split('.')[:3] out = "%s.%s.%s" % (major, minor, patchlevel) if out != version: out += "+" return out | def trim_version(self, version = CFG_VERSION): """Take CFG_VERSION and return a sanitized version for display""" |
if colls and interactive != "yes": | if colls and (interactive != "yes" or short_coll): | def format(bfo, limit, separator='; ', extension='[...]', print_links = "yes", print_affiliations='no', affiliation_prefix = ' (', affiliation_suffix = ')', print_affiliation_first='no', interactive="no", highlight="no", affiliations_separator=" ; ", name_last_first = "yes", collaboration = "yes", id_links = "no", mark... |
elif (colls or (limit.isdigit() and nb_authors > int(limit))) and interactive == "yes": | elif interactive == "yes" and ((colls and not short_coll) or (limit.isdigit() and nb_authors > int(limit))): | def format(bfo, limit, separator='; ', extension='[...]', print_links = "yes", print_affiliations='no', affiliation_prefix = ' (', affiliation_suffix = ')', print_affiliation_first='no', interactive="no", highlight="no", affiliations_separator=" ; ", name_last_first = "yes", collaboration = "yes", id_links = "no", mark... |
_lookup_url_name(bfo, url.get('y')) +'</a>' | _lookup_url_name(bfo, url.get('y', 'Fulltext')) +'</a>' | def format(bfo, default = '', separator = '; ', style = '', \ show_icons = 'no', prefix='', suffix=''): """ Creates html of links based on metadata @param separator (separates instances of links) @param prefix @param suffix @param show_icons default = no @param style options CSS style for link """ _ = gettext_set_langu... |
url.get('y').upper() != "DOI" and not \ | url.get('y', 'Fulltext').upper() != "DOI" and not \ | def format(bfo, default = '', separator = '; ', style = '', \ show_icons = 'no', prefix='', suffix=''): """ Creates html of links based on metadata @param separator (separates instances of links) @param prefix @param suffix @param show_icons default = no @param style options CSS style for link """ _ = gettext_set_langu... |
out += key | out += key + ',' | def format(bfo, width="50"): """ Prints a full BibTeX record. 'width' must be bigger than or equal to 30. This format element is an example of large element, which does all the formatting by itself @param width the width (in number of characters) of the record """ out = "@" width = int(width) if width < 30: width = 3... |
<body%(body_css_classes)s lang="%(ln_iso_639_a)s"> | <body%(body_css_classes)s lang="%(ln_iso_639_a)s" onload="document.search.p.focus()"> | def tmpl_pageheader(self, req, ln=CFG_SITE_LANG, headertitle="", description="", keywords="", userinfobox="", useractivities_menu="", adminactivities_menu="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0, navmenuid="admin", metaheaderadd="", rssurl=CFG_SITE_URL+"/rss", body_css_classes=None): |
Please go to <a href="http://www.slac.stanford.edu/spires/">SPIRES</a> if you are here by mistake.</br></br> | Please go to <a href="http://www.slac.stanford.edu/spires/">SPIRES</a> if you are here by mistake.<br /> | def tmpl_pageheader(self, req, ln=CFG_SITE_LANG, headertitle="", description="", keywords="", userinfobox="", useractivities_menu="", adminactivities_menu="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0, navmenuid="admin", metaheaderadd="", rssurl=CFG_SITE_URL+"/rss", body_css_classes=None): |
<a id="nav-jobs" href="%(siteurl)s/help/?ln=%(ln)s">%(msg_help)s</a> | <a id="nav-help" href="%(siteurl)s/help/?ln=%(ln)s">%(msg_help)s</a> | def tmpl_pageheader(self, req, ln=CFG_SITE_LANG, headertitle="", description="", keywords="", userinfobox="", useractivities_menu="", adminactivities_menu="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0, navmenuid="admin", metaheaderadd="", rssurl=CFG_SITE_URL+"/rss", body_css_classes=None): |
'feedback_address' : 'feedback@inspire-hep.net', | 'feedback_address' : 'feedback@inspirebeta.net', | def tmpl_feedback_box(self, ln=CFG_SITE_LANG): |
'sitesupportemail' : 'feedback@inspire-hep.net', | 'sitesupportemail' : 'feedback@inspirebeta.net', | def tmpl_pagefooter(self, req=None, ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=""): """Creates a page footer |
if external_keys['9'] == "SPIRESTeX" and external_keys['a']: key = external_keys['a'] | if external_keys['9'] == "SPIRESTeX" and external_keys['z']: key = external_keys['z'] | def format(bfo, width="50"): """ Prints a full BibTeX record. 'width' must be bigger than or equal to 30. This format element is an example of large element, which does all the formatting by itself @param width the width (in number of characters) of the record """ out = "@" width = int(width) if width < 30: width = 3... |
date= re.sub(',\s00:00$','',convert_datestruct_to_dategui(datestruct)) if us=="yes": return(re.sub(r' 0(\d),',r' \1,',(re.sub(r'(\d{2})\s(\w{3})',r'\2 \1,',date)))) else: return(date) | dummy_time = ( 0, 0, 44, 2, 320, 0) if len(datestruct) == 3: datestruct = tuple(datestruct[0:3]) + dummy_time date = re.sub(',\s00:00$','',convert_datestruct_to_dategui(datestruct)) if us == "yes": return(re.sub(r' 0(\d),',r' \1,',(re.sub(r'(\d{2})\s(\w{3})',r'\2 \1,',date)))) else: return(date) elif len(datestruct) =... | def format(bfo, us="yes"): """ returns dategui for the best available date, looking in several locations for it (date, eprint, journal, date added) @params us us style date Mon dd, yyyy (default) otherwise dd mon yyyy """ datestruct=get_date(bfo) date= re.sub(',\s00:00$','',convert_datestruct_to_dategui(datestruct)) i... |
if datestruct[1]: | if datestruct[0]: | def get_date(bfo): """ returns datestruct for best available date """ from invenio.bibformat_elements.bfe_INSPIRE_arxiv import get_arxiv #true date date = bfo.fields('269__c') if date: datestruct=parse_date(date[0]) if datestruct[1]: return(datestruct) #arxiv date arxiv = get_arxiv(bfo,category="no") if arxiv: date=... |
Reads in a date imported from SPIRES, returning the datestruct | Reads in a date imported from SPIRES, returns as much of the date as we have in a struct, not quite a date struct | def parse_date(datetext): """ Reads in a date imported from SPIRES, returning the datestruct accounts for either native spires (YYYYMMDD) or invenio style (YYYY-MM-DD) @param datetext: date from SPIRES record """ import time match=re.search(r'\d+\-\d+\-\d+ \d+:\d+:\d+', datetext) if match: return(convert_datetext_to_da... |
import time match=re.search(r'\d+\-\d+\-\d+ \d+:\d+:\d+', datetext) if match: return(convert_datetext_to_datestruct(datetext)) datetext=datetext.split(' ')[0] if re.search(r'\d+\-\d+\-\d+', datetext): return(convert_datetext_to_datestruct(datetext+' 0:0:0')) if re.search(r'\d+\-\d+', datetext): return(convert_datetext... | datetext = datetext.split(' ')[0] if datetext.count('-') > 0: return [int(date) for date in datetext.split('-')] return int(datetext), | def parse_date(datetext): """ Reads in a date imported from SPIRES, returning the datestruct accounts for either native spires (YYYYMMDD) or invenio style (YYYY-MM-DD) @param datetext: date from SPIRES record """ import time match=re.search(r'\d+\-\d+\-\d+ \d+:\d+:\d+', datetext) if match: return(convert_datetext_to_da... |
print "%f %f" % (x, y) | def map_transform( x, y, xt, yt, data ): print "%f %f" % (x, y) radius = 90.0 - y xt[0] = radius * cos( x * pi / 180.0 ) yt[0] = radius * sin( x * pi / 180.0 ) print "%f %f" % (xt[0], yt[0]) #return [xt, yt] | |
print "%f %f" % (xt[0], yt[0]) | def map_transform( x, y, xt, yt, data ): print "%f %f" % (x, y) radius = 90.0 - y xt[0] = radius * cos( x * pi / 180.0 ) yt[0] = radius * sin( x * pi / 180.0 ) print "%f %f" % (xt[0], yt[0]) #return [xt, yt] | |
process.analyseFullHadronicSelection.remove(process.monitorKinFitQuality_1) process.analyseFullHadronicSelection.remove(process.monitorKinFitQuality_2) process.analyseFullHadronicSelection.remove(process.monitorFullHadTopReco_1) process.analyseFullHadronicSelection.remove(process.monitorFullHadTopReco_2) | process.analyseFullHadronicSelection.remove(process.monitorGenParticles_3) process.analyseFullHadronicSelection.remove(process.monitorKinFit_2) process.analyseFullHadronicSelection.remove(process.monitorKinFit_3) | def removeMonitoringOfCutflow(process): print '++++++++++++++++++++++++++++++++++++++++++++' print 'removing all monitoring elements from the ' print 'sequence *analyseFullHadronicSelection* so' print 'only a pure selection of events is done ' print '++++++++++++++++++++++++++++++++++++++++++++' process.analyseFullHadr... |
print 'removing the default HLT_Ht200 trigger from ' | print 'removing the default trigger from ' | def removeDefaultTrigger(process): print '++++++++++++++++++++++++++++++++++++++++++++' print 'removing the default HLT_Ht200 trigger from ' print 'standard fully hadronic event selection ' print '++++++++++++++++++++++++++++++++++++++++++++' process.analyseFullHadronicSelection.remove(process.hltHt200) |
process.analyseFullHadronicSelection.remove(process.hltQuadJet30) | def removeDefaultTrigger(process): print '++++++++++++++++++++++++++++++++++++++++++++' print 'removing the default HLT_Ht200 trigger from ' print 'standard fully hadronic event selection ' print '++++++++++++++++++++++++++++++++++++++++++++' process.analyseFullHadronicSelection.remove(process.hltHt200) | |
foundPath = False | def parseTrigReport(path, modules): print 'Path: ' + path for s in modules: foundPath = False nvisit = 0 npass = 0 nfail = 0 nerror = 0 for i in range(1,len(sys.argv) ) : infile = open(sys.argv[i], 'r') for line in infile : if( not foundPath ) : if( line.find('TrigReport ---------- Modules in Path: ' + path) >= 0 ) :... | |
def bits(n, width=None): | def bits(n): | def bits(n, width=None): s = bin(n)[2:] # '0b...' without the '0b' if width: s = '0' * (width - len(s)) + s return unicode(s) |
if width: s = '0' * (width - len(s)) + s | s = '0' * (32 - len(s)) + s | def bits(n, width=None): s = bin(n)[2:] # '0b...' without the '0b' if width: s = '0' * (width - len(s)) + s return unicode(s) |
height = draw_textbox([gold, bits(i, sigbits)], gray) | height = draw_textbox([gold, bits(i)[:sigbits]], gray) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
draw_textbox([white, u' ' * 7], lightgray) | draw_textbox([white, u' ' * 9], lightgray) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
draw_textbox([white, u' ' * 7], gray) | draw_textbox([white, u' ' * 9], gray) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
bstr = bits(h, 8)[:hashwidth - 1] | bstr = bits(h)[:hashwidth - 1] | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
draw_textbox([white, u'%7s' % repr(k)], gray) | draw_textbox([white, u'%9s' % repr(k)], gray) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
draw_textbox([white, u'%7s' % repr(v)], gray) | draw_textbox([white, u'%9s' % repr(v)], gray) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
cr.rectangle(0,0, WIDTH,HEIGHT) cr.set_source_rgb(1,1,1) cr.fill() d = {'a': 1, 'b': 2, 'i': 3} del d['a'] d = {'boss': 1, 'phew': 2, 'rock': 3, 'jazz': 4, 'felt': 5, 'bozo': 8} draw_dictionary(d, 100, 20) surface.write_to_png(sys.argv[1]) | if __name__ == '__main__': cr.rectangle(0,0, WIDTH,HEIGHT) cr.set_source_rgb(1,1,1) cr.fill() d = {0: 'zero', 'Brandon': 1, 'Brendon': 2, 'brandy': 3, 3.141: 'pi', 'nom': 9} draw_dictionary(d, 100, 20) surface.write_to_png(sys.argv[1]) | def draw_dictionary(d, x0, y0): """Supply `d` a Python dictionary.""" o = my_inspect.dictobject(d) with save(cr): if len(o) == 8: sigbits = 3 hashwidth = 9 # width of the hash field font_size = 28 slot_height = 40 gap = 2 elif len(o) == 32: sigbits = 5 hashwidth = 16 # width of the hash field font_size = 10 slot_heigh... |
url = self.request.RESPONSE.get('HTTP_REFERER') | url = self.request.get('HTTP_REFERER') | def handle_cancel(self, action): url = self.request.RESPONSE.get('HTTP_REFERER') url = url or self.context.portal_url() self.request.RESPONSE.redirect(url) |
iid = md5.new(base + str(counter)).hexdigest().strip() | iid = md5(base + str(counter)).hexdigest().strip() | def generate_iid_for(self, invitation): """Generates a invitation id for the invitation and sets it (and returns it eventually). |
html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | html_pre = u'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
html_post = u'' body = u'' | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
body = str(highlight_code(body, params.getvalue('hl'))) | body = (highlight_code(body, params.getvalue('hl'))) | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
html_post = '</pre>' | html_post += '</pre>' | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
start_response('200 OK', [('Content-Type', 'text/html')]) return html_pre + body + html_post | start_response('200 OK', [('Content-Type', 'text/html'), ('charset', 'utf-8')]) return (html_pre + body + html_post).encode('utf-8') | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
if params.getvalue('hl', '') != '': | if 'mldown' in params: options += '&mldown' elif params.getvalue('hl', '') != '': | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = u'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
return highlight(code, get_lexer_by_name(lang), HtmlFormatter()) | res = highlight(code, get_lexer_by_name(lang), HtmlFormatter()) return res.encode('iso-8859-1') | def highlight_code(code, lang): return highlight(code, get_lexer_by_name(lang), HtmlFormatter()) |
def checkbox(name, label, checked=False, value="on"): | def checkbox(name, label, checked=False, value='on'): | def checkbox(name, label, checked=False, value="on"): res = '<label><input type="checkbox" name="' + name + '" value="' + value + '" ' if checked: res += 'checked="checked"' res += '/>' + label + '</label>\n' return res |
f = open(filename, "r") | f = open(filename, 'r') | def read_paste(filename): f = open(filename, "r") return f.read() |
start_response('200 OK', [('Content-Type', 'text/plain')]) | start_response('200 OK', [('Content-Type', 'text/plain'), charset]) | def paste(environ, start_response): params = FieldStorage(fp=environ['wsgi.input'], environ=environ, keep_blank_values = True) html_pre = u'''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.