rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if regressions[testName][reffile] == 'fail': nbRegressions = nbRegressions + 1 out.write(regressions[testName][reffile]) | if reffile in regressions[testName]: if regressions[testName][reffile] == 'fail': regressionNames |= set([testName]) nbRegressions = nbRegressions + 1 out.write(regressions[testName][reffile]) else: out.write("absent") | def logAdvance(log): logTestName = None logLineNum = sys.maxint logLine = log.readline() # print "advance log: " + logLine look = re.match('(\d+):@@ test: (\S+) (\S+)? @@',logLine) if look != None: logLineNum = int(look.group(1)) logTestName = look.group(2) # group(3) if present is status return logLineNum, logTestName... |
print str(nbFailures) + ' failures' print str(nbRegressions) + ' regressions' | sys.stdout.write(str(nbFailures) + ' failures (' \ + ' '.join(failureNames) + ')\n') sys.stdout.write(str(nbRegressions) + ' regressions (' \ + ' '.join(regressionNames) + ')\n') | def logAdvance(log): logTestName = None logLineNum = sys.maxint logLine = log.readline() # print "advance log: " + logLine look = re.match('(\d+):@@ test: (\S+) (\S+)? @@',logLine) if look != None: logLineNum = int(look.group(1)) logTestName = look.group(2) # group(3) if present is status return logLineNum, logTestName... |
PREFIX := $(CURDIR)/debian/tmp/usr/local | PREFIX := $(CURDIR)/debian/tmp/usr | def buildPackage(project, version, installTop): '''Writes out the necessary files such as specification, control, etc. then builds a binary distribution package based on the local system. This routine with returns the name of the package that was built. ''' dist = context.host() name = context.cwdProject() if dist ==... |
\tPATH=/usr/local/bin:${PATH} ./configure --prefix=$(PREFIX) | \tPATH=''' + context.value('binDir') + ''':${PATH} ./configure --prefix=$(PREFIX) | def buildPackage(project, version, installTop): '''Writes out the necessary files such as specification, control, etc. then builds a binary distribution package based on the local system. This routine with returns the name of the package that was built. ''' dist = context.host() name = context.cwdProject() if dist ==... |
self.environ[look.group(1)] = Pathname(look.group(1), 'no description') self.environ[look.group(1)].value = look.group(2) | self.environ[look.group(1)] = look.group(2) else: self.environ[look.group(1)].value = look.group(2) | def locate(self): '''Locate the workspace configuration file and derive the project name out of its location.''' try: self.buildTopRelativeCwd, self.configFilename \ = searchBackToRoot(self.configName) except IOError, e: configFromBuildTop = os.path.join(self.environ['buildTop'].default, self.configName) if not os.path... |
if self.environ[key].value: configFile.write(key + '=' + str(self.environ[key].value) + '\n') | val = str(self.environ[key]) if val: configFile.write(key + '=' + val + '\n') | def save(self): '''Write the config back to a file.''' try: configFile = open(self.configFilename,'w') except: self.configFilename = self.objDir(self.configName) configFile = open(self.configFilename,'w') keys = sorted(self.environ.keys()) configFile.write('# configuration for development workspace\n\n') for key in key... |
if self.environ[name].configure(): | if (isinstance(self.environ[name],Variable) and self.environ[name].configure()): | def value(self,name): '''returns the value of the workspace variable *name*. If the variable has no value yet, a prompt is displayed for it.''' if not name in self.environ: raise Error("Trying to read unknown variable " + name + ".\n") if self.environ[name].configure(): self.save() return self.environ[name].value |
return self.environ[name].value | return str(self.environ[name]) | def value(self,name): '''returns the value of the workspace variable *name*. If the variable has no value yet, a prompt is displayed for it.''' if not name in self.environ: raise Error("Trying to read unknown variable " + name + ".\n") if self.environ[name].configure(): self.save() return self.environ[name].value |
return dgen.topological() | vars = [] reps, packages, fetches = dgen.topological() projs = reps + packages projs.reverse() for projName in projs: if projName in dgen.repositories: vars += dgen.projects[projName].repository.vars elif projName in dgen.patches: vars += dgen.projects[projName].patch.vars elif projName in dgen.packages: vars += dgen.p... | def closure(self, dgen): '''Find out all dependencies from a root set of projects as defined by the dependency generator *dgen*.''' while dgen.more(): self.parse(dgen) return dgen.topological() |
vars = [] | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
vars += self.projects[target].repository.vars | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
vars += self.projects[target].patch.vars | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
vars += self.projects[target].packages[tags].vars | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
configVar(vars) | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
self.levels.insert(0,newLevel) | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) | |
for newEdge in self.levels[0]: if len(self.levels) > 1: for level in self.levels[1:]: for edge in level: if edge[0] == newEdge[0] and edge[1] == newEdge[1]: raise CircleError(edge[0],edge[1]) if not newEdge[1] in roots: roots += [ newEdge[1] ] | level = [] for newEdge in newLevel: found = False for edge in level: if (edge[0] == newEdge[0] and edge[1] == newEdge[1]): found = True break if not found: level += [ newEdge ] if not newEdge[1] in roots: roots += [ newEdge[1] ] | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) |
for edge in self.levels[0]: | for edge in level: | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) |
self.levels[0] = newLevel | self.levels.insert(0,newLevel) if None: print "levels:" print self.levels for newEdge in self.levels[0]: if len(self.levels) > 1: for level in self.levels[1:]: for edge in level: if edge[0] == newEdge[0] and edge[1] == newEdge[1]: raise CircleError(edge[0],edge[1]) | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) |
def __init__(self,name,descr=None): | def __init__(self,name,value,descr=None): | def __init__(self,name,descr=None): self.name = name self.descr = descr if descr: self.descr = descr.strip() self.value = None |
self.value = None | self.constrains = {} def __str__(self): return str(self.value) def constrain(self,vars): None | def __init__(self,name,descr=None): self.name = name self.descr = descr if descr: self.descr = descr.strip() self.value = None |
Variable.__init__(self,name,descr) | Variable.__init__(self,name,None,descr) | def __init__(self,name,descr=None): Variable.__init__(self,name,descr) |
Variable.__init__(self,name,descr) | Variable.__init__(self,name,None,descr) | def __init__(self,name,descr=None,base=None,default=None): Variable.__init__(self,name,descr) self.base = base self.default = default |
def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) | def __init__(self,name,value,descr=None,choices=[]): if value and isinstance(value,str): value = value.split(' ') Variable.__init__(self,name,value,descr) | def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) self.choices = choices self.constrains = {} |
self.constrains = {} | def __str__(self): return ' '.join(self.value) | def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) self.choices = choices self.constrains = {} |
if self.value != None: | choices = [] for choice in self.choices: if not choice[0] in self.value: choices += [ choice ] if len(choices) == 0: | def configure(self): '''Generate an interactive prompt to enter a workspace variable *var* value and returns True if the variable value as been set.''' if self.value != None: return False self.value = selectMultiple(self.descr,self.choices) if log: log.write(self.name + ' set to ' + ', '.join(self.value) +'\n') else: s... |
self.value = selectMultiple(self.descr,self.choices) | descr = self.descr if len(self.value) > 0: descr += " (constrained: " + ", ".join(self.value) + ")" self.value += selectMultiple(descr,choices) | def configure(self): '''Generate an interactive prompt to enter a workspace variable *var* value and returns True if the variable value as been set.''' if self.value != None: return False self.value = selectMultiple(self.descr,self.choices) if log: log.write(self.name + ' set to ' + ', '.join(self.value) +'\n') else: s... |
def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) | def __init__(self,name,value,descr=None,choices=[]): Variable.__init__(self,name,value,descr) | def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) self.choices = choices self.constrains = {} |
self.constrains = {} | def __init__(self,name,descr=None,choices=[]): Variable.__init__(self,name,descr) self.choices = choices self.constrains = {} | |
if self.value != None: | if self.value: | def configure(self): '''Generate an interactive prompt to enter a workspace variable *var* value and returns True if the variable value as been set.''' if self.value != None: return False self.value = selectOne(self.descr,self.choices) if log: log.write(self.name + ' set to ' + self.value +'\n') else: sys.stdout.write(... |
files = [] for lookPat, lookPath in self.files[d]: found = False if not lookPath: for pat, path in deps[d]: if pat == lookPat: files += [ (lookPat, path) ] found = True break if not found: files += [ (lookPat, lookPath) ] self.files[d] = files | if d in self.files: files = [] for lookPat, lookPath in self.files[d]: found = False if not lookPath: for pat, path in deps[d]: if pat == lookPat: files += [ (lookPat, path) ] found = True break if not found: files += [ (lookPat, lookPath) ] self.files[d] = files | def populate(self, buildDeps = {}): if self.name in buildDeps: deps = buildDeps[self.name].files for d in deps: files = [] for lookPat, lookPath in self.files[d]: found = False if not lookPath: for pat, path in deps[d]: if pat == lookPat: files += [ (lookPat, path) ] found = True break if not found: files += [ (lookPat... |
self.var = MultipleChoice(attrs['name']) if self.var.name in self.context.environ: self.var.value = self.context.environ[self.var.name] | choiceValue = None if attrs['name'] in self.context.environ: choiceValue = str(self.context.environ[attrs['name']]) self.var = MultipleChoice(attrs['name'],choiceValue,None,[]) | def startElement(self, name, attrs): '''Start populating an element.''' self.text = '' if name == self.tagAlternate: self.tagIndices += [ len(self.tags) ] self.locIndices += [ len(self.locals) ] elif name == self.tagAlternates: self.locals += [ Alternates() ] self.tagIndices += [ len(self.tags) ] self.locIndices += [ l... |
if self.var.name in self.context.environ: self.var.value = self.context.environ[self.var.name] | self.var.value = choiceValue | def startElement(self, name, attrs): '''Start populating an element.''' self.text = '' if name == self.tagAlternate: self.tagIndices += [ len(self.tags) ] self.locIndices += [ len(self.locals) ] elif name == self.tagAlternates: self.locals += [ Alternates() ] self.tagIndices += [ len(self.tags) ] self.locIndices += [ l... |
self.var = SingleChoice(attrs['name']) if self.var.name in self.context.environ: self.var.value = self.context.environ[self.var.name] | choiceValue = None if attrs['name'] in self.context.environ: choiceValue = str(self.context.environ[attrs['name']]) self.var = SingleChoice(attrs['name'],choiceValue,None,[]) | def startElement(self, name, attrs): '''Start populating an element.''' self.text = '' if name == self.tagAlternate: self.tagIndices += [ len(self.tags) ] self.locIndices += [ len(self.locals) ] elif name == self.tagAlternates: self.locals += [ Alternates() ] self.tagIndices += [ len(self.tags) ] self.locIndices += [ l... |
self.var.base = self.context.environ[self.text.strip()] | self.var.base = str(self.context.environ[self.text.strip()]) | def endElement(self, name): '''Once the element is fully populated, call back the simplified interface on the handler.''' if name == self.tagDb: self.handler.endParse() elif name == self.tagAlternate: depFirst = self.locIndices.pop() tagFirst = self.tagIndices.pop() alternateSet = self.locals[depFirst:] alternates = se... |
self.choice += [ self.text ] | self.choice += [ self.text.strip() ] | def endElement(self, name): '''Once the element is fully populated, call back the simplified interface on the handler.''' if name == self.tagDb: self.handler.endParse() elif name == self.tagAlternate: depFirst = self.locIndices.pop() tagFirst = self.tagIndices.pop() alternateSet = self.locals[depFirst:] alternates = se... |
self.var.descr = self.text | self.var.descr = self.text.strip() | def endElement(self, name): '''Once the element is fully populated, call back the simplified interface on the handler.''' if name == self.tagDb: self.handler.endParse() elif name == self.tagAlternate: depFirst = self.locIndices.pop() tagFirst = self.tagIndices.pop() alternateSet = self.locals[depFirst:] alternates = se... |
suffix = '.*(\\' + libStaticSuffix() + '|\\' + libDynSuffix() + ')' | suffix = '((-.+)|(_.+))?(\\' + libStaticSuffix() + '|\\' + libDynSuffix() + ')' | def findLib(names,excludes=[]): '''Search for a list of libraries that can be found from $PATH where bin was replaced by lib. *names* is a list of (pattern,absolutePath) pairs where the absolutePat can be None and in which case pattern will be used to search for library names with neither a 'lib' prefix nor a '.a', '.... |
linkContext(linkPath,linkName) | def linkDependencies(projects, cuts=[]): '''All projects which are dependencies but are not part of *srcTop* are not under development in the current workspace. Links to the required executables, headers, libraries, etc. will be added to the install directories such that projects in *srcTop* can build.''' import __main... | |
os.symlink(os.path.relpath(pchname), os.path.basename(srcname)) | basename = os.path.basename(srcname) if os.path.exists(basename): shutil.move(basename,basename + '~') os.symlink(os.path.relpath(pchname),basename) | def integrate(srcdir, pchdir, verbose=True): for name in os.listdir(pchdir): srcname = os.path.join(srcdir,name) pchname = os.path.join(pchdir,name) if os.path.isdir(pchname): if not os.path.basename(name) in [ 'CVS', '.git']: integrate(srcname,pchname,verbose) else: if not name.endswith('~'): if not os.path.islink(src... |
+ os.path.join(context.value('etcDir'),'dws','index.xsd') \ | + context.derivedEtc('index.xsd') \ | def pubCollect(args): '''collect Consolidate local dependencies information into a global dependency database. Copy all distribution packages built into a platform distribution directory. (example: dws --exclude test collect) ''' # Create the distribution directory, i.e. where packages are stored. packa... |
shellCommand('tar ' + d + 'xf ' + pkgfilename) return os.path.basename(os.path.splitext(os.path.splitext(pkgfilename)[0])) | shellCommand('tar ' + d + 'xf ' + pkgfilename) return os.path.basename(os.path.splitext( os.path.splitext(pkgfilename)[0])[0]) | def unpack(pkgfilename): '''unpack a tar[.gz|.bz2] source distribution package.''' if pkgfilename.endswith('.bz2'): d = 'j' elif pkgfilename.endswith('.gz'): d = 'z' shellCommand('tar ' + d + 'xf ' + pkgfilename) return os.path.basename(os.path.splitext(os.path.splitext(pkgfilename)[0])) |
print ' '.join(s[1:]) | sys.stdout.write(' '.join(s[1:]) + '\n') | def unpack(pkgfilename): '''unpack a tar[.gz|.bz2] source distribution package.''' if pkgfilename.endswith('.bz2'): d = 'j' elif pkgfilename.endswith('.gz'): d = 'z' shellCommand('tar ' + d + 'xf ' + pkgfilename) return os.path.basename(os.path.splitext(os.path.splitext(pkgfilename)[0])) |
print line | sys.stdout.write(line + '\n') | def unpack(pkgfilename): '''unpack a tar[.gz|.bz2] source distribution package.''' if pkgfilename.endswith('.bz2'): d = 'j' elif pkgfilename.endswith('.gz'): d = 'z' shellCommand('tar ' + d + 'xf ' + pkgfilename) return os.path.basename(os.path.splitext(os.path.splitext(pkgfilename)[0])) |
def makeProject(name,targets,dependencies={}): | def makeProject(name,options,dependencies={}): | def makeProject(name,targets,dependencies={}): '''Create links for prerequisites when necessary, then issue a make command and log output.''' log.header(name) makefile = context.srcDir(os.path.join(name,'Makefile')) objDir = context.objDir(name) if objDir != os.getcwd(): if not os.path.exists(objDir): os.makedirs(objDi... |
shellCommand(cmdline + [ target ]) | shellCommand(cmdline + [ target ] + overrides) | def makeProject(name,targets,dependencies={}): '''Create links for prerequisites when necessary, then issue a make command and log output.''' log.header(name) makefile = context.srcDir(os.path.join(name,'Makefile')) objDir = context.objDir(name) if objDir != os.getcwd(): if not os.path.exists(objDir): os.makedirs(objDi... |
vars += dgen.projects[projName].packages[tags].vars | distHost = context.value('distHost') vars += dgen.projects[projName].packages[distHost].vars | def closure(self, dgen): '''Find out all dependencies from a root set of projects as defined by the dependency generator *dgen*.''' while dgen.more(): self.parse(dgen) vars = [] reps, packages, fetches = dgen.topological() projs = reps + packages projs.reverse() for projName in projs: if projName in dgen.projects: if p... |
locals += self.projects[target].packages[tags].prerequisites(tags) for f in self.projects[target].packages[tags].fetches: fetches[f] = self.projects[target].packages[tags].fetches[f] | distHost = context.value('distHost') locals += self.projects[target].packages[distHost].prerequisites(tags) for f in self.projects[target].packages[distHost].fetches: fetches[f] = self.projects[target].packages[distHost].fetches[f] | def endParse(self): # !!! Debugging Prints !!! # print "* endParse:" # print " includes: " + str(self.includePats) # print " excludes: " + str(self.excludePats) # print " levels: " + str(self.levels) # print " missings: " + str(self.missings) |
outname = os.path.join(cachePath,'srcs',os.path.basename(uri.path)) httpCmds += [ ['curl', '--create-dirs' ] \ + ['-o', outname, h ] ] | if context.value('distHost') == 'Darwin': httpCmds += [ ['curl', '--create-dirs', '-o', context.cachePath(uri.path), h ] ] else: httpCmds += [ [ '/usr/bin/wget', '-P', os.path.dirname(context.cachePath(uri.path)) , h ] ] | def remoteSyncCommand(filenames, cacheDir=None,admin=False,relative=False): '''returns a pair (downCmdline, upCmdline) where downCmdline can be used to download from the remote machine onto the local machine and upCmdline can be used to upload from the local machine to the remote machine. ''' downCmdline = None upCmdli... |
if len(ext) > 0: | if len(ext) > 0 and not ext.startswith('.*'): | def findLib(names,excludes=[]): '''Search for a list of libraries that can be found from $PATH where bin was replaced by lib. *names* is a list of (pattern,absolutePath) pairs where the absolutePat can be None and in which case pattern will be used to search for library names with neither a 'lib' prefix nor a '.a', '.... |
log.write('yes\n') | log.write('yes (no suffix?)\n') | def findLib(names,excludes=[]): '''Search for a list of libraries that can be found from $PATH where bin was replaced by lib. *names* is a list of (pattern,absolutePath) pairs where the absolutePat can be None and in which case pattern will be used to search for library names with neither a 'lib' prefix nor a '.a', '.... |
except: print "Error parsing regular expression: {0}".format(value) | except Exception, ex: raise ValueError("Invalid regular expression ({0}): {1}" .format(ex, value)) | def parse_regexps(self): """ Parse the <common-regexps> section of the config file. """ regexps = getattr(self.xml, "common-regexps").findall("regexp") parsed = {} for regexp in regexps: name = regexp.get("name") value = regexp.get("value") try: parsed[name] = re.compile(value) except: print "Error parsing regular expr... |
conf.registerPlugin('IRCLogin', True) | IRCLogin = conf.registerPlugin('IRCLogin', True) if advanced: UserList = IRCLogin.UserList._default teamname = IRCLogin.teamname._default else: UserList = IRCLogin.UserList._default teamname = IRCLogin.teamname._default IRCLogin.UserList.setValue(UserList) IRCLogin.teamname.setValue(teamname) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
self.do376(irc, msg, True) | self.do376(irc, msg, force=True) | def identifymsg(self, irc, msg, args): """ takes no arguments. Sends a requet for the identify-msg capability. """ self.do376(irc, msg, True) irc.replySuccess() |
if not hasattr(irc.getRealIrc(), "_Freenode_capabed") or force: realIrc = irc.getRealIrc() | realIrc = hasattr(irc, 'getRealIrc') and irc.getRealIrc() or irc if not hasattr(realIrc, "_Freenode_capabed") or force: | def do376(self, irc, msg, force=False): # End of /MOTD command. """ The new freenode ircd-seven requires using the 'CAP' command to set capabilities, rather than hyperirons 'CAPAB' command. You request "CAP REQ IDENTIFY-MSG" and the server will respond with either "CAP <nick> ACK :identify-msg" to acknowledge, or "CAP ... |
irc.ququeMsg(ircmsgs.IrcMsg("CAP LS")) | irc.queueMsg(ircmsgs.IrcMsg("CAP LS")) | def do376(self, irc, msg, force=False): # End of /MOTD command. """ The new freenode ircd-seven requires using the 'CAP' command to set capabilities, rather than hyperirons 'CAPAB' command. You request "CAP REQ IDENTIFY-MSG" and the server will respond with either "CAP <nick> ACK :identify-msg" to acknowledge, or "CAP ... |
if not hasattr(irc.getRealIrc(), "_Freenode_capabed") and not force: | if not hasattr(irc.getRealIrc(), "_Freenode_capabed") or force: | def do376(self, irc, msg, force=False): # End of /MOTD command. """ The new freenode ircd-seven requires using the 'CAP' command to set capabilities, rather than hyperirons 'CAPAB' command. You request "CAP REQ IDENTIFY-MSG" and the server will respond with either "CAP <nick> ACK :identify-msg" to acknowledge, or "CAP ... |
irc.reply("identify-msg is %sabled" % (haveCap and "En" or "Dis") | irc.reply("identify-msg is %sabled" % (haveCap and "En" or "Dis")) | def haveidentifymsg(self, irc, msg, args): realIrc = hasattr(irc, 'getRealIrc') and irc.getRealIrc() or irc haveCap = getattr(realIrc, "_Freenode_capabed", False) irc.reply("identify-msg is %sabled" % (haveCap and "En" or "Dis") |
self.chunk(lambda text: self.element('p', text, {'phrase': True, 'break': True}), 'paragraph', '((?m)^(?P<text_paragraph>\S.+?)(?:\\n\\n|\Z))', 5) | self.chunk(lambda text: self.element('p', text, {'phrase': True, 'break': True}), 'paragraph', '((?m)^(?P<text_paragraph>\S.*?)(?:\n\n|\Z))', 5) | def __init__(self, raw): super(Marxup, self).__init__(raw) self.preclean("&", "&") self.clean("<", "<") self.clean(">", ">") self.clean("(\r\n|\r)", "\n") |
self.chunk(lambda text: self.element('p', text, {'phrase': True, 'break': True}), 'paragraph', '((?m)^(?P<text_paragraph>\S.*?)(?:\n\n|\Z))', 5) | self.chunk(lambda text: self.element('p', text, {'phrase': True, 'break': True}), 'paragraph', '((?m)^(?P<text_paragraph>\S.*?)(?:\n\n|\Z|\n\Z))', 5) | def __init__(self, raw): super(Marxup, self).__init__(raw) self.preclean("&", "&") self.clean("<", "<") self.clean(">", ">") self.clean("(\r\n|\r)", "\n") |
def chunk(self, block, *args): return self.rule(block, 'chunks', *args) | def chunk(self, element, *args): return self.rule(element, 'chunks', *args) | def chunk(self, block, *args): return self.rule(block, 'chunks', *args) |
def phrase(self, block, *args): return self.rule(block, 'phrases', *args) | def phrase(self, element, *args): return self.rule(element, 'phrases', *args) | def phrase(self, block, *args): return self.rule(block, 'phrases', *args) |
if 'context' not in self.patterns: self.patterns['context'] = self.__compile(getattr(self, context)) return self.patterns['context'] | if context not in self.patterns: self.patterns[context] = self.__compile(getattr(self, context)) return self.patterns[context] | def pattern(self, context): #TODO klassemetode? """Create a regexp (and cache it)""" if 'context' not in self.patterns: self.patterns['context'] = self.__compile(getattr(self, context)) return self.patterns['context'] |
def rule(self, method, context, label, pattern, priority=1): | def rule(self, element, context, label, pattern, priority=1): | def rule(self, method, context, label, pattern, priority=1): getattr(self, context).append(('(?P<%s>%s)' % (label, pattern), priority)) # Add a new chunk/phrase self.__dict__[label] = method # Add a method for the rule |
self.__dict__[label] = method | self.__dict__[label] = element | def rule(self, method, context, label, pattern, priority=1): getattr(self, context).append(('(?P<%s>%s)' % (label, pattern), priority)) # Add a new chunk/phrase self.__dict__[label] = method # Add a method for the rule |
return re.compile('|'.join(re.escape(p) for p in elements)) | return '|'.join(elements) | def __compile(self, raw): """Builds a regexp with all patterns, sorted by priority""" elements = [rule[0] for rule in sorted(raw, key=lambda (pattern, priority): priority)] # Sort by priority return re.compile('|'.join(re.escape(p) for p in elements)) # Build a regexp union |
args = Tiki.groups[:method_arity] | args = map(lambda arg: match.group(arg), Tiki.groups[:method_arity]) print match print method print args | def repl(match): method = getattr(self, match.lastgroup) method_arity = len(inspect.getargspec(method)[0]) args = Tiki.groups[:method_arity] return getattr(self, match.lastgroup)(*args) |
self.chunk(lambda text: self.element('h3', text), 'header', '^\=\s*(?<text>.+?)$') | self.chunk(lambda text: self.element('h3', text), 'header', '^\=\s*(?P<text>.+?)$') | def __init__(self, raw): super(Marxup, self).__init__(raw) self.clean("&", "&") self.clean("<", "<") self.clean("<", ">") self.clean("(\r\n|\r)", "\n") |
instanceCat.objectType = 'POINT' | def doOneCatalogType(self, catalogType, queryTypes, obsHistID): #nFN = self.getNextGoodFileNum() self.executionDBManager = jobDB.JobState() t0 = self.executionDBManager.getJobId() | |
phiarray[i] = bandpasslist.phi | phiarray[i] = bp.phi | def setupPhiArray(self, bandpasslist): """Sets up a 2-d numpy phi array from bandpasslist suitable for input to manyMagCalc. |
jobKey = tableId + '_' + jobId + '_JobState' | jobKey = tableId + '_' + jobId + 'JS' | def qsubJob(eM, tableId, jobId): tableStr = str(tableId) t0 = eM.queryState(tableStr + 'NumJobs') if t0 == None: t0 = 0 print 'addJob: Current num: ', t0 t1 = int(t0) + 1 eM.updateState(tableStr + 'NumJobs', str(t1)) print 'addJob: New num: ', t1 jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'QSUB... |
eM.updateState(jobKey + 'qsubTime', time.ctime()) | eM.updateState(jobKey + 'QT', time.ctime()) | def qsubJob(eM, tableId, jobId): tableStr = str(tableId) t0 = eM.queryState(tableStr + 'NumJobs') if t0 == None: t0 = 0 print 'addJob: Current num: ', t0 t1 = int(t0) + 1 eM.updateState(tableStr + 'NumJobs', str(t1)) print 'addJob: New num: ', t1 jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'QSUB... |
jobKey = tableId + '_' + jobId + '_JobState' | jobKey = tableId + '_' + jobId + 'JS' | def jobRunning(eM, tableId, jobId): jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'RUNNING') eM.updateState(jobKey + 'RunningTime', time.ctime()) eM.showStates() |
eM.updateState(jobKey + 'RunningTime', time.ctime()) | eM.updateState(jobKey + 'RT', time.ctime()) | def jobRunning(eM, tableId, jobId): jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'RUNNING') eM.updateState(jobKey + 'RunningTime', time.ctime()) eM.showStates() |
jobKey = tableId + '_' + jobId + '_JobState' | jobKey = tableId + '_' + jobId + 'JS' | def jobFinished(eM, tableId, jobId): tableStr = str(tableId) t0 = eM.queryState(tableStr + 'NumJobs') print 'addJob: Current num: ', t0 t1 = int(t0) - 1 eM.updateState(tableStr + 'NumJobs', str(t1)) print 'addJob: New num: ', t1 jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'FINISHED') eM.updateSt... |
eM.updateState(jobKey + 'finishedTime', time.ctime()) | eM.updateState(jobKey + 'FT', time.ctime()) | def jobFinished(eM, tableId, jobId): tableStr = str(tableId) t0 = eM.queryState(tableStr + 'NumJobs') print 'addJob: Current num: ', t0 t1 = int(t0) - 1 eM.updateState(tableStr + 'NumJobs', str(t1)) print 'addJob: New num: ', t1 jobKey = tableId + '_' + jobId + '_JobState' eM.updateState(jobKey, 'FINISHED') eM.updateSt... |
print '%i: Current num jobs' | print '%i: Current num jobs' % i | def throttle(eM, tableId, maxNumJobs, throttleTime): print 'throttle: maxNumJobs is ', maxNumJobs done = False while done == False: numJobs = howManyJobs(eM, tableId) print 'throttle: numJobs is ', numJobs if numJobs >= maxNumJobs: print 'Max reached; sleeping...' time.sleep(throttleTime) print 'Waking to check again.'... |
throttle(eM, tableId, 5, 10) | def throttle(eM, tableId, maxNumJobs, throttleTime): print 'throttle: maxNumJobs is ', maxNumJobs done = False while done == False: numJobs = howManyJobs(eM, tableId) print 'throttle: numJobs is ', numJobs if numJobs >= maxNumJobs: print 'Max reached; sleeping...' time.sleep(throttleTime) print 'Waking to check again.'... | |
else: | def calcADU(self, bandpass, wavelen=None, fnu=None, expTime=EXPTIME, effarea=EFFAREA, gain=GAIN): """Calculate the number of adu from camera, using sb and fnu. | |
else: wavelen = self.wavelen fnu = self.fnu | wavelen = self.wavelen fnu = self.fnu else: wavelen = wavelen fnu = fnu | def calcMag(self, bandpass, wavelen=None, fnu=None): """Calculate the AB magnitude of an object, using phi the normalized system response. |
else: wavelen = self.wavelen fnu = self.fnu | wavelen = self.wavelen fnu = self.fnu else: wavelen = wavelen fnu = fnu | def calcFlux(self, bandpass, wavelen=None, fnu=None): """Calculate the F_b (integrated flux of an object, above the atmosphere), using phi. Passed wavelen/fnu arrays will be unchanged, but if uses self will check if fnu is set. Calculating the AB mag requires the wavelen/fnu pair to be on the same grid as bandpass; (t... |
if update_self: | def multiplyFluxNorm(self, fluxNorm, wavelen=None, fnu=None): """Multiply wavelen/fnu (or self.wavelen/fnu) by fluxnorm. Returns wavelen/fnu arrays (or updates self). Note that multiplyFluxNorm does not regrid self.wavelen/flambda/fnu at all.""" # Note that fluxNorm is intended to be applied to f_nu, # so that fluxnor... | |
else | else: | def redshiftSED(self, redshift, dimming=False, wavelen=None, flambda=None): """Redshift an SED, optionally adding cosmological dimming. Pass wavelen/flambda or redshift/update self.wavelen/flambda (unsets fnu)""" # Updating self or passed arrays? update_self = self.checkUseSelf(wavelen, flambda) if update_self: wavele... |
r['sedname'] = "S.dat" | mymo = mo.MovingObject(r['q'], r['e'], r['i'], r['node'], r['argPeri'], r['timePeri'], r['epoch'], magHv=r['magHv'], phaseGv=r['phaseGv'], index=r['index'], n_par=r['n_par'], moid=r['moid'], objid=r['id'], objtype=r['objtype'], isVar=r['isVar'], var_t0=r['var_t0'], var_timescale=r['var_timescale'], var_fluxmax=r['var_f... | def makeMovingObjectsFromOrbitList(self, results): objects = [] ephem_datfile = "" pyoorb.pyoorb.oorb_init(ephemeris_fname=ephem_datfile) for r in results: #Hack since there are no sedfilenames in the db at the moment r['sedname'] = "S.dat" mymo = mo.MovingObject(r['q'], r['e'], r['i'], r['node'], r['argPeri'], r['time... |
i_opp=r['i_opp'], z_opp=r['z_opp'], y_opp=r['y_opp']) | i_opp=r['i_opp'], z_opp=r['z_opp'], y_opp=r['y_opp']) ''' | def makeMovingObjectsFromOrbitList(self, results): objects = [] ephem_datfile = "" pyoorb.pyoorb.oorb_init(ephemeris_fname=ephem_datfile) for r in results: #Hack since there are no sedfilenames in the db at the moment r['sedname'] = "S.dat" mymo = mo.MovingObject(r['q'], r['e'], r['i'], r['node'], r['argPeri'], r['time... |
''' def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and ... | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, rootFILTERdir=None, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList. Give the filter, the mjd (to find the ephemeris info) and the root directory of SEDS. Calculates magnitudes. Individual objects alread... | def getMovingObjectsInFieldofView(self, ra_fov, dec_fov, radius_fov, mjdTai): """ Return MovingObjectList of objects within field of view """ """ given field of view info in degrees """ # this method is only applicable to ONE time and one field of view at a time outputList = [] for movingobj in self._mObjects: # check... |
if rootSEDdir != '': rootSEDdir = rootSEDdir + "/" | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... | |
filterlist = [filt, 'V', 'imsim'] for filter in filterlist: if filter == 'V': filename = rootSEDdir + 'harris_V.dat' elif filter=='imsim': | filterlist = ('V', 'imsim', filt) for f in filterlist: if f == 'V': filename = os.path.join(rootSEDdir,'harris_V.dat') bandpass[f] = Bandpass() bandpass[f].readThroughput(filename) elif f=='imsim': | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
filename = rootSEDdir + 'final_' + filt bandpass[filter] = lm.teleThruput(filename) | filename = os.path.join(rootFILTERdir,'total_' + f + '.dat') bandpass[f] = Bandpass() bandpass[f].readThroughput(filename) | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
filename = rootSEDdir + sedfile sed[sedfile] = lm.simObj(filename) | filename = os.path.join(rootSEDdir, sedfile) sed[sedfile] = Sed() sed[sedfile].readSED_flambda(filename) | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
for filter in filterlist: sedmag[sedfile][filter] = sed[sedfile].calcMag(bandpass[filter]) | for f in filterlist: sedmag[sedfile][f] = sed[sedfile].calcMag(bandpass[f]) sedcol[sedfile][f] = sedmag[sedfile][f] - sedmag[sedfile]['V'] | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
raise Exception, "Do not have an ephemeride on date %s" %(mjdTaiStr) | raise Exception("Do not have an ephemeride on date %s" %(mjdTaiStr)) | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
warning.warn("Found a SED not in movingObjectList calcAllMag's dictionary. Substituting C/S seds.") q = movingobj.Orbit.getq() e = movingobj.Orbit.gete() a = q/(1-e) if a<2: sedname = 'S.dat' elif a>4: sedname = 'C.dat' else: prob_c = 0.5*a-1 chance = n.random.random() if chance<= prob_c: sedname = 'C.dat' else: sednam... | raise Exception("SED (%s) of moving object not in movingObjectList's directory." %(sedname)) | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
fluxnorm = sed[sedname].calcFluxNorm(vmag, bandpass['V']) movingobj.Ephemerides[mjdTaiStr].setfluxnorm(fluxnorm) dmag = -2.5*n.log10(fluxnorm) filtmag = sedmag[sedname][filt] + dmag imsimmag = sedmag[sedname]['imsim'] + dmag | filtmag = vmag + sedcol[sedname][filt] imsimmag = vmag + sedcol[sedname]['imsim'] | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... |
''' | def calcAllMags(self, filt, mjdTaiList, rootSEDdir, withErrors=True, fiveSigmaLimitingMag=None): """ Calculate the magnitude of all objects in the movingObjectList """ """ - Given the filter, the mjd (to find the ephemeris info) and the root directory of SEDS/thruputs """ """ individual objects know their SED and thei... | |
phiarray[i] = bandpass.phi | phiarray[i] = bandpasslist.phi | def setupPhiArray(self, bandpasslist): """Sets up a 2-d numpy phi array from bandpasslist suitable for input to manyMagCalc. |
wavelen_max = bandpasslist[0].wavelen[len(bandpasslist[0].wavelen)] | wavelen_max = bandpasslist[0].wavelen[len(bandpasslist[0].wavelen)-1] | def setupPhiArray(self, bandpasslist): """Sets up a 2-d numpy phi array from bandpasslist suitable for input to manyMagCalc. |
self.zp = -8.9 | self.zp = -2.5*n.log10(3631) | def __init__(self, wavelen=None, flambda=None): """Initialize sed object by giving filename or lambda/flambda array. |
need_grid = n.any(abs(wavelen_match-wavelen)>1e-10) | need_regrid = n.any(abs(wavelen_match-wavelen)>1e-10) | def needResample(self, wavelen_match=None, wavelen=None, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Check if wavelen or self.wavelen matches wavelen or wavelen_min/max/step grid.""" # Check if should use self or passed wavelen. if wavelen==None: wavelen = self.wavelen # Check if wavel... |
need_grid = True | need_regrid = True | def needResample(self, wavelen_match=None, wavelen=None, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Check if wavelen or self.wavelen matches wavelen or wavelen_min/max/step grid.""" # Check if should use self or passed wavelen. if wavelen==None: wavelen = self.wavelen # Check if wavel... |
if self.needResample((wavelen=wavelen, wavelen_match=bandpass.wavelen): | if self.needResample(wavelen=wavelen, wavelen_match=bandpass.wavelen): | def calcFluxNorm(self, magmatch, bandpass, wavelen=None, fnu=None, wavelen_min=MINWAVELEN, wavelen_max=MAXWAVELEN, wavelen_step=WAVELENSTEP): """Calculate the fluxNorm (SED normalization value for a given mag) for a sed. Equivalent to adjusting a particular f_nu to Jansky's appropriate for the desired mag. Can pass wa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.