rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
opt['label'] = a.pop('configname') | opt['label'] = opt('configName') | def getParam(options=[], doc='', details='', noDialog=False, checkUnprocessedArgs=True, verbose=False, nCol=1): """ get parameter from either - useTk ... - command line argument - configuration file specified by -f file, or - prompt for user input parameter: verbose: whether or not print detailed info checkUnprocesse... |
geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy) > 0: ploidy = atPloidy else: ploidy = range(0, pop.ploidy()) if len(atLoci) > 0: loci = atLoci else: loci = range(pop.totNumLoci()) gs = pop.genoSize() tl = pop.totNumLoci() if len(indRange) > 0: if type(indRange[0]) not in [type([]), type((... | geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy) > 0: ploidy = atPloidy | def getGenotype(pop, atLoci=[], subPop=[], indRange=[], atPloidy=[]): '''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy... |
for i in range(pop.popSize()): for p in ploidy: for loc in loci: geno.append( arr[ gs*i + p*tl +loc] ) return geno | ploidy = range(0, pop.ploidy()) if len(atLoci) > 0: loci = atLoci else: loci = range(pop.totNumLoci()) gs = pop.genoSize() tl = pop.totNumLoci() if len(indRange) > 0: if type(indRange[0]) not in [type([]), type(())]: indRange = [indRange] arr = pop.arrGenotype() for r in indRange: for i in range(r[0], r[1]): for p in p... | def getGenotype(pop, atLoci=[], subPop=[], indRange=[], atPloidy=[]): '''Obtain genotype as specified by parameters atLoci: subset of loci, default to all subPop: subset of subpopulations, default ao all indRange: individual ranges ''' geno = [] if type(atPloidy) == type(1): ploidy = [atPloidy] elif len(atPloidy... |
if type(var) == type( dw({}) ): var = var.__dict__ if level < 0 or (level > 0 and curLevel < level): if type(var) == types.ListType or type(var) == types.TupleType: index = 0 for x in var: if type(x) != types.ListType and type(x) != types.DictType: if x != None: if type(var) == types.ListType: print ' '*indent, '[... | if type(var) == type( dw({}) ): var = var.__dict__ if level < 0 or (level > 0 and curLevel < level): if type(var) == types.ListType or type(var) == types.TupleType: index = 0 for x in var: if type(x) != types.ListType and type(x) != types.DictType: if x != None: if type(var) == types.ListType: print ' '*indent, '[... | def _listVars(var, level=-1, name='', subPop=True, indent=0, curLevel=0): ''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ # all level or level < specified maximum level if level < 0 or (level > 0 and curLevel < level): # list is list or typle type if type(va... |
print ' '*indent, var else: if type(var) == types.ListType or type(var) == types.TupleType: print ' '*indent, 'list of length', len(var) elif type(var) == types.DictType: print ' '*indent, 'dict with keys [', for num in range(0,len(var.keys())): if type(var.keys()[num]) == types.StringType: print "'"+ var.keys()[num] +... | if type(var) == type( dw({}) ): fillFrame = fill.FillingFrame(rootObject=var.__dict__, rootLabel='var') else: fillFrame = fill.FillingFrame(rootObject=var, rootLabel='var') fillFrame.Show(True) app.SetTopWindow(fillFrame) app.MainLoop() | def _listVars(var, level=-1, name='', subPop=True, indent=0, curLevel=0): ''' called by listVars. Will list variables recursively''' if type(var) == type( dw({}) ): var = var.__dict__ # all level or level < specified maximum level if level < 0 or (level > 0 and curLevel < level): # list is list or typle type if type(va... |
""" collect variables so that plotters can plot them all at once You can of course put it in other uses Usage: a = dataAggregator( maxRecord=0, recordSize=0) maxRecord: if more data is pushed, the old ones are discarded recordSize: size of record a.push(gen, data, idx=-1) gen: generation number data: on... | def __init__(self, maxRecord=0, recordSize=0): """ maxRecord: maxRecorddow size. I.e., maximum generations of data to keep """ self.gen = [] self.data = [] self.maxRecord = maxRecord self.recordSize = recordSize | def endl(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) |
Internal data storage: self.gen [ .... ] self.data column1 [ ...... ] column2 [ ...... ] ....... each record is pushed at the end of """ def __init__(self, maxRecord=0, recordSize=0): """ maxRecord: maxRecorddow size. I.e., maximum generations of data to keep """ self.gen = [] self.data = [] self.maxRecord = maxRe... | def __repr__(self): s = str(self.gen) + "\n" for i in range(0, len(self.data)): s += str(self.data[i]) + "\n" return s def clear(self): self.gen = [] self.data = [] def ready(self): return self.recordSize>0 and len(gen)>0 and len( data[0] ) == len( data[-1] ) def flatData(self): res = [] for d in self.data: res.exte... | def endl(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\n"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) |
recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be saved. Must have ancestralDepth 1. paired individuals are sibs. Parental population are co... | recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be saved. Must have ancestralDepth 1. paired individuals are sibs. Parental population are co... | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... |
popType: population type. Can be 'sibpair' or 'bySubPop'. If type is sibpair, pairs of individuals will be considered as sibpairs. If type is bySubPop, individuals in a subpopulation is considered as siblings. output: output.dat and output.ped will be the data and pedigree file. You may need to rename them to be analy... | chromsome famID,indID,sex,affectedness,allel1-1,allel1-2,allele2-1,allele2-2, ... ... chromosome """ if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... |
pedFile = open(file + ".ped", "w") except exceptions.IOError: raise exceptions.IOError, "Can not open file " + file + ".dat/.ped to write." markers = [pop.chromBegin(chrom)+m for m in range(pop.numLoci(chrom))] for e in exclude: markers.remove(e) dataFile.write( '''%d 0 0 5 << nlocus, risklocus, sexlink, n... | raise exceptions.ValueError, "Please specify output or outputExpr" markers = {} for ch in range(0,pop.numChrom()): markers[ch] = [] for m in range(0, pop.numLoci(ch)): if not pop.chromBegin(ch) + m in exclude: markers[ch].append(m) try: out = open( file, "w") except exceptions.IOError: raise exceptions.IOError, "Can n... | def SaveLinkage(pop, chrom, popType='sibpair', output='', outputExpr='', alleleFreq=[], recombination=0.00001, penetrance=[0,0.25,0.5], exclude=[], pre=True, daf=0.001): """ save population in Linkage format. Currently only support affected sibpairs sampled with affectedSibpairSample operator. pop: population to be sa... |
for ped in range(0, np): pop.useAncestralPop(1) par1 = pop.individual(2*ped) if pre: pedFile.write("%3d 1 0 0 %d %d " \ % (ped+1, sexCode(par1), affectedCode(par1))) else: pedFile.write("%3d 1 0 0 3 0 0 %d 0 %d " \ % (ped+1, sexCode(par1), affectedCode(par1))) pedFile.write( genoStr(par1) + '\n' ) par2 = pop.individ... | for ch in range(0, pop.numChrom()): for ped in range(0, np): pop.useAncestralPop(1) par1 = pop.individual(2*ped) content[ch] += "%3d,1,%d,%d" % (ped+1, sexCode(par1), affectedCode(par1)) content[ch] += genoStr(par1, ch) + '\n' par2 = pop.individual(2*ped+1) content[ch] += "%3d,2,%d,%d" % (ped+1, sexCode(par2), affec... | def genoStr(ind): string = '' for marker in markers: string += "%d %d " % (ind.allele(marker, 0)+1, ind.allele(marker, 1)+1) return string |
try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") def sexCode(code): if code == 1: return Male | try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") def sexCode(code): if code == 1: return Male else: return Female def affectedCode(code): if code == 1: return True else: return False numLoci = [] lociOrde... | def LoadCSV(file): """ load file from randfam CSV format file: input file For format description, please see SaveCSV """ # determine files to read try: f = open(file) allLines = f.readlines() except: raise exceptions.ValueError("Can not open one of file " + file + ".\n" + \ "Or file format is not correct.") # sex code ... |
return Female def affectedCode(code): if code == 1: return True else: return False numLoci = [] lociOrder = [] lociPos = [] lociNames = [] for line in allLines: if line[:10] == 'Chromosome': numLoci.append(0) lociOrder.append([]) lociPos.append([]) lociNames.append([]) i = len(numLoci) - 1 chInfo = line.split(',') n... | raise exceptions.ValueError("Wrong freq length") spTraj = [0]*numSP*numLoci for sp in range(numSP): print "Generting trajectory for subpopulation %d (generation %d - %d)" % (sp, split, curGen) def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] while True: t = FreqTrajectoryM... | def sexCode(code): if code == 1: return Male else: return Female |
fitness=fitness, minMutAge=minMutAge, maxMutAge=maxMutAge, restartIfFail=restartIfFail) if len(traj) == 0: print "Failed to generate trajectory. You may need to set a different set of parameters." sys.exit(1) return (traj, [curGen-len(x)+1 for x in traj], trajFunc(curGen, traj)) split = curGen; while(True): if len(Nt... | def FreqTrajectoryMultiStochWithSubPop( curGen, numLoci, freq, NtFunc, fitness, minMutAge, maxMutAge, mode = 'uneven', restartIfFail=True): ''' Simulate frequency trajectory with subpopulation structure, migration is currently ignored. The essential part of this script is to simulate the trajectory of each subpopulatio... | |
minMutAge=curGen-split, maxMutAge=curGen-split, restartIfFail=False) if 0 in [len(x) for x in t]: print "Failed to generate trajectory. You may need to set a different set of parameters." sys.exit(1) if 0 in [x[0] for x in t]: print "Subpop return 0 index. restart " else: break; | minMutAge=minMutAge-len(traj[0])+1, maxMutAge=maxMutAge-len(traj[0])+1, ploidy=ploidy, restartIfFail=True) if 1 in [len(x) for x in trajBeforeSplit]: print "Failed to generated trajectory. (Tried more than 1000 times)" sys.exit(0) def trajFuncWithSubPop(gen): if gen >= split: return [spTraj[x][gen-split] for x in range... | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] |
spTraj[sp+i*numSP] = t[i] traj = [] for i in range(numLoci): traj.append([]) for g in range(split, curGen+1): totAllele = sum( [ spTraj[sp+i*numSP][g-split] * NtFunc(g)[sp] for sp in range(numSP) ]) traj[i].append( totAllele / sum(NtFunc(g)) ) print "Starting allele frequency (at split) ", [traj[i][0] for i in range(... | trajAll.append( [] ) trajAll[i].extend(trajBeforeSplit[i]) trajAll[i].extend(traj[i][1:]) return (trajAll, [curGen-len(x)+1 for x in trajAll ], trajFuncWithSubPop) | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] |
def mate(par, off): ''' a function that get aprental, offspring generations it will select all male and add 1 to their age, and spread to the generation ''' idx = par.infoIdx('age') for i in range(par.popSize()): ind = par.individual(i) ind.setInfo(ind.info(idx)+1, idx) return True pop = population(20, loci=[1], infoF... | def testPyMating(self): ' test pyMating ' | |
os.remove(logFile) | try: os.remove(logFile) except: pass | def last_two(gen): if gen >= endGen -2: return 2 else: return 1 |
for val in values[g]: entryWidgets[g].select_set( opt['chooseFrom'].index(val)) | if type(values[g]) in [types.TupleType, types.ListType]: for val in values[g]: entryWidgets[g].select_set( opt['chooseFrom'].index(val)) else: entryWidgets[g].select_set( opt['chooseFrom'].index( values[g] )) | def doOK(event): " OK buton is pressed " root1.quit() |
if type(values[g]) in [types.ListType, types.TupleType] and len(values[g])>0: | if type(values[g]) in [types.ListType, types.TupleType]: | def formatDesc(text): # linux can auto wrap, windows can not but sometime wrap # at unexpected places... It is safer to wrap at original # place. return '\n'.join( [x.strip() for x in text.splitlines()] ) |
db = multi_database(options.databases)[0][0] | db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0] | def debug(args=None): options = load_options(args) zope.app.appsetup.config(options.site_definition) db = multi_database(options.databases)[0][0] notify(zope.app.appsetup.interfaces.DatabaseOpened(db)) return db |
"ptyperegisterinit", map | "ptyperegisterinit", | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 |
sys.path = ".." | sys.path = os.getcwd() | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 |
e = "../overrides/" + xsubdir | e = gtkpascalgen_outdir + "/overrides/" + xsubdir | def psimplevardecl(vartype, varname): global needtypes global c2penumcopied global wrapperprefix #extra = "" a = vartype.split(" ") extra = " ".join(a[:-1]) if a[-1].endswith("*"): a[-1] = "P" + a[-1][:-1] if a[-1].endswith("*"): # actually this is an c array most of the time so this here is "wrong" a[-1] = "P" + a[-... |
nf = os.path.join("..", "output", os.path.basename(xsubdir), pfilename) | nf = os.path.join(gtkpascalgen_outdir, "output", os.path.basename(xsubdir), pfilename) | def psimplevardecl(vartype, varname): global needtypes global c2penumcopied global wrapperprefix #extra = "" a = vartype.split(" ") extra = " ".join(a[:-1]) if a[-1].endswith("*"): a[-1] = "P" + a[-1][:-1] if a[-1].endswith("*"): # actually this is an c array most of the time so this here is "wrong" a[-1] = "P" + a[-... |
print classname, "warning", fn["name"], "parameter is overridden const but was not originally var" | print classname, "warning", fn["name"], "parameter is overridden 'const' but was not originally 'var'" | def func_cb(varname, fn): global classname global cclassconstructparams global c2pfuncparamoverride global pextratypes global c2pcallbackpointers global preturntransformers global poverridearraytypes global wrapperpointerprefix global wrapperprefix global pstringtype global interfaceprefix if fn["name"] in c2pfuncparam... |
print classname, "warning", fn["name"], "parameter is overridden const but was not originally var" | print classname, "warning", fn["name"], "parameter is overridden 'out' but was not originally 'var'" | def func_cb(varname, fn): global classname global cclassconstructparams global c2pfuncparamoverride global pextratypes global c2pcallbackpointers global preturntransformers global poverridearraytypes global wrapperpointerprefix global wrapperprefix global pstringtype global interfaceprefix if fn["name"] in c2pfuncparam... |
print "NO", rest | def fnsFromFNLines(fnlines): fns = {} rest = "" for fnline in fnlines: rest = rest + fnline.replace("\n", "") if fnline.find(";") > -1: #fns.append(rest) if rest.find("(*Gtk") > -1: # probably a function pointer type (I hope only them) rest = "" continue if rest.find("(*Gdk") > -1: # probably a function pointer type (I... | |
line = line.replace(")</programlisting>", ");") | def stripTags(line): match = re.search(r"^(.*)\)[ ]*:[^<]*</programlisting>.*$", line) if match != None: line = match.group(1) + ");" #line = line.replace(")</programlisting>", ");") # gtk 2.8 forgot the ";" :) while True: match = indexterm1.match(line) if match == None: break line = match.group(1) + match.group(3) ... | |
print sys.path | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | |
return _prelude.idmef_time_get_sec(self.res) | return int(_prelude.idmef_time_get_sec(self.res)) | def __int__(self): """Return the number of seconds.""" return _prelude.idmef_time_get_sec(self.res) |
if type(py_value) is not str: raise IDMEFValueError(py_value, "expected %s, got %s" % (str, type(py_value))) | def _idmef_value_python_to_c(object, py_value): object_type = _prelude.idmef_object_get_value_type(object) if object_type is _prelude.IDMEF_VALUE_TYPE_TIME: time = _idmef_value_time_python_to_c(py_value) c_value = _prelude.idmef_value_new_time(time) if not c_value: raise Error() elif object_type in [ _prelude.IDMEF_V... | |
return (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) | value = (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) return value | def idmef_value_c_to_python(value): func_type_table = { _prelude.IDMEF_VALUE_TYPE_INT8: _prelude.idmef_value_get_int8, _prelude.IDMEF_VALUE_TYPE_UINT8: _prelude.idmef_value_get_uint8, _prelude.IDMEF_VALUE_TYPE_INT16: _prelude.idmef_value_get_int16, _prelude.IDMEF_VALUE_TYPE_UINT16: _prelude.idmef_value_g... |
m = re.compile("(\w+)\[(\w+)\]").match(self.name) | m = re.compile("(.+)\[(.+)\]").match(self.name) | def __init__(self, parent, option): self.parent = parent self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(\w+)\[(\w+)\]").match(self.name) self.in... |
_prelude.idmef_value_destroy(c_value) | if c_value != None: _prelude.idmef_value_destroy(c_value) | def __getitem__(self, object_name): """Get the value of the object in the message.""" object = _prelude.idmef_object_new_fast(object_name) if not object: raise IDMEFObjectError(object_name) c_value = _prelude.idmef_object_get(self.res, object) _prelude.idmef_object_destroy(object) |
self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) | self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.HAVE_CONTEXT) | def __init__(self, parent, option): self.parent = parent self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(.+)\[(.+)\]").match(self.name) self.inst... |
if _prelude.prelude_client_init(self._client, name, config, len(sys.argv), sys.argv) < 0: | if _prelude.prelude_client_init(self._client, name, config, 1, [ sys.argv[0] ]) < 0: | def __init__(self, name, config=None): if not name: name = sys.argv[0] if not config: file = os.popen("libprelude-config --prefix") path = file.read() file.close() config = path[:-1] + "/etc/prelude/default/client.conf" self._client = _prelude.prelude_client_new(_prelude.PRELUDE_CLIENT_CAPABILITY_SEND_IDMEF) if not s... |
def __init__(self, parent, name, description, value): | def __init__(self, parent, option): | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) |
self.name = name self.description = description self.value = value | self.name = _prelude.prelude_option_get_longopt(option) self.instantiable = bool(_prelude.prelude_option_get_flags(option) & _prelude.ALLOW_MULTIPLE_CALL) if self.name.find("[") != -1: self.instance = True m = re.compile("(\w+)\[(\w+)\]").match(self.name) self.instantiable_name = m.group(1) self.instance_name = m.group... | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) |
nodes = [ name ] | nodes = [ self.name ] | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) |
name = _prelude.prelude_option_get_longopt(cur) value = _prelude.prelude_option_get_value(cur) description = _prelude.prelude_option_get_description(cur) option = Option(parent, name, description, value) | option = Option(parent, cur) | def _get_option_list(self, parent, start): options = [ ] cur = None while True: cur = _prelude.prelude_option_get_next(start, cur) if not cur: break name = _prelude.prelude_option_get_longopt(cur) value = _prelude.prelude_option_get_value(cur) description = _prelude.prelude_option_get_description(cur) option = Option... |
def set_option(self, analyzerid, name, value): msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, "%s=%s" % (name, value)) | def set_option(self, analyzerid, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, value) | def set_option(self, analyzerid, name, value): msg = self._request(analyzerid, _prelude.PRELUDE_MSG_OPTION_SET, "%s=%s" % (name, value)) retval = _prelude.prelude_option_recv_set(msg) return retval |
if len < 0: | if size < 0: | def __str__(self): """Return the RFC8601 string representation of the object.""" buf = "A" * 128 |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def set_option(self, analyzer_path, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_SET, value) if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read set_option answer") |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def commit(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_COMMIT, instance) if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read commit answer") |
if _prelude.prelude_option_recv_set(msg) < 0: | if not _prelude.prelude_option_recv_set(msg): | def destroy(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_DESTROY, instance) |
RECV_IDMEF = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_IDMEF SEND_IDMEF = _prelude.PRELUDE_CLIENT_CAPABILITY_SEND_IDMEF RECV_ADMIN = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_ADMIN SEND_ADMIN = _prelude.PRELUDE_CLIENT_CAPABILITY_SEND_ADMIN RECV_CM = _prelude.PRELUDE_CLIENT_CAPABILITY_RECV_CM SEND_CM = _prelude.PRELUDE_CLIE... | def get_libprelude_prefix(): return os.popen("libprelude-config --prefix").read()[:-1] | |
class Admin(Client): | class Admin: | def is_section(self): return len(self.options) > 0 |
Client.__init__(self, Client.SEND_ADMIN, name, get_libprelude_prefix() + "/etc/prelude/default/client.conf") self._manager_connection = _prelude.prelude_connection_new(self._client, address, port) if not self._manager_connection: raise ClientError("could not create new connection to %s:%p" % (address, port)) if _prel... | self._profile = _prelude.prelude_client_profile_new(name or sys.argv[0]) if not self._profile: raise ClientError("could not create client profile for %s" % name or sys.argv[0]) self._connection = _prelude.prelude_connection_new(address, port) if not self._connection: raise ClientError("could not create connection to %... | def __init__(self, name=None, address="127.0.0.1", port=5554): Client.__init__(self, Client.SEND_ADMIN, name, get_libprelude_prefix() + "/etc/prelude/default/client.conf") self._manager_connection = _prelude.prelude_connection_new(self._client, address, port) if not self._manager_connection: raise ClientError("could n... |
_prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) | _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(sel... |
msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._manager_connection)) | msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._client, self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(sel... |
c_data = _prelude.idmef_data_new_dup(py_value, len(py_value) + 1) | if type(py_value) is str: c_data = _prelude.idmef_data_new_char_string_dup(py_value) elif type(py_value) is int: c_data = _prelude.idmef_data_new_uint32(py_value) elif type(py_value) is long: c_data = _prelude.idmef_data_new_uint64(py_value) else: raise IDMEFValueError(py_value, "type %s is not handled by idmef_data" %... | def _idmef_value_python_to_c(object, py_value): object_type = _prelude.idmef_object_get_value_type(object) if object_type is _prelude.IDMEF_VALUE_TYPE_TIME: time = _idmef_value_time_python_to_c(py_value) c_value = _prelude.idmef_value_new_time(time) if not c_value: raise Error() elif object_type in [ _prelude.IDMEF_V... |
return _prelude.idmef_data_get_data(data) | return (lambda d: None, _prelude.idmef_data_get_char, _prelude.idmef_data_get_byte, _prelude.idmef_data_get_uint32, _prelude.idmef_data_get_uint64, _prelude.idmef_data_get_float, _prelude.idmef_data_get_char_string, _prelude.idmef_data_get_byte_string)[_prelude.idmef_data_get_type(data)](data) | def idmef_value_c_to_python(value): func_type_table = { _prelude.IDMEF_VALUE_TYPE_INT8: _prelude.idmef_value_get_int8, _prelude.IDMEF_VALUE_TYPE_UINT8: _prelude.idmef_value_get_uint8, _prelude.IDMEF_VALUE_TYPE_INT16: _prelude.idmef_value_get_int16, _prelude.IDMEF_VALUE_TYPE_UINT16: _prelude.idmef_value_g... |
def _idmef_value_c_to_python(value): | def idmef_value_c_to_python(value): | def _idmef_value_c_to_python(value): func_type_table = { type_int16: idmef_value_get_int16, type_uint16: idmef_value_get_uint16, type_int32: idmef_value_get_int32, type_uint32: idmef_value_get_uint32, type_int64: idmef_value_get_int64, type_uint64: idmef_value_get_uint64, type_float: idmef_val... |
return _idmef_value_c_to_python(value) | return idmef_value_c_to_python(value) | def _idmef_value_list_c_to_python(value): if value is None: return None if not idmef_value_is_list(value): return _idmef_value_c_to_python(value) ret = [ ] for i in range(idmef_value_get_count(value)): ret.append(_idmef_value_list_c_to_python(idmef_value_get_nth(value, i))) return ret |
def __init__(self): """Create a new empty IDMEF message.""" self.res = idmef_message_new() if not self.res: raise Error() | def __init__(self, res=None): """Create a new empty IDMEF message.""" if res: self.res = res else: self.res = idmef_message_new() if not self.res: raise Error() | def __init__(self): """Create a new empty IDMEF message.""" self.res = idmef_message_new() if not self.res: raise Error() |
def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) top_criteria.res = idmef_criteria_clone(self.res) if not top_criteria.res: raise Error() if type(value) is IDMEFCriteria: criteria2 = idmef_criteria_clone(value.res) if not criteria2: raise Error() else: crite... | def __append(self, new_sub_criteria, operator): new_criteria = IDMEFCriteria() idmef_criteria_destroy(new_criteria.res) new_criteria.res = idmef_criteria_clone(self.res) if not new_criteria.res: raise Error() new_sub_criteria_res = idmef_criteria_clone(new_sub_criteria.res) if not new_sub_criteria_res: raise Error() ... | def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) |
def __init__(self, name, config): | def __init__(self, name, config=None): | def __init__(self, name, config): if not config: file = os.popen("libprelude-config --prefix") path = file.read() file.close() config = path[:-1] + "/etc/prelude/default/client.conf" Client.__init__(self, Client.SEND_IDMEF, name, config) self._analyzer = _prelude.prelude_client_get_analyzer(self._client) if not self.... |
_prelude.type_IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], | _prelude.IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], | def _idmef_integer_python_to_c(object, py_value): value_type_table = { _prelude.IDMEF_VALUE_TYPE_INT16: { 'py_type': [ int ], 'check_value': lambda i: i >= -2 ** 15 and i < 2 ** 15, 'convert': _prelude.idmef_value_new_int16 }, _prelude.type_IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], 'check_value': lambda i: i >= 0... |
if _prelude.prelude_connection_connect(self._connection, self._profile, _prelude.PRELUDE_CONNECTION_CAPABILITY_CONNECT) < 0: raise ClientError("could not connect to %s:%d" % (address, port)) | self.connect() | def __init__(self, name=None, address="127.0.0.1", port=5554): self._profile = _prelude.prelude_client_profile_new(name or sys.argv[0]) if not self._profile: raise ClientError("could not create client profile for %s" % name or sys.argv[0]) self._connection = _prelude.prelude_connection_new(address, port) if not self._... |
_prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) | ret = _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) if ret < 0: raise ClientError(ret) ret = _prelude.prelude_option_push_request(self._msgbuf, type, value) if ret < 0: raise ClientError(ret) | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)... |
msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)) | msg = _prelude.prelude_connection_recv(self._connection) if not msg: raise Error("could not read request answer") | def _request(self, analyzer_path, type, value=None): _prelude.prelude_option_new_request(self._msgbuf, 0, analyzer_path) _prelude.prelude_option_push_request(self._msgbuf, type, value) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg = _prelude.my_prelude_msg_read(_prelude.prelude_connection_get_fd(self._connection)... |
if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") | def get_option_list(self, analyzer_path): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_LIST) if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") | |
return | raise Error("could not retrieve option list") | def get_option_list(self, analyzer_path): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_LIST) if not msg: raise Error("PRELUDE_MSG_OPTION_LIST failed") |
retval = _prelude.prelude_option_recv_set(msg) return retval | if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read set_option answer") | def set_option(self, analyzer_path, name, value=None): if value: value = "%s=%s" % (name, value) else: value = name msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_SET, value) retval = _prelude.prelude_option_recv_set(msg) return retval |
if not msg: return retval = _prelude.prelude_option_recv_set(msg) return retval | if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read commit answer") | def commit(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_COMMIT, instance) if not msg: return retval = _prelude.prelude_option_recv_set(msg) |
if not msg: return retval = _prelude.prelude_option_recv_set(msg) return retval | if _prelude.prelude_option_recv_set(msg) < 0: raise Error("could not read destroy answer") | def destroy(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_DESTROY, instance) if not msg: return retval = _prelude.prelude_option_recv_set(msg) |
self._exit_status = _prelude.PRELUDE_CLIENT_EXIST_STATUS_SUCCESS | self._exit_status = _prelude.PRELUDE_CLIENT_EXIT_STATUS_SUCCESS | def set_success(self): self._exit_status = _prelude.PRELUDE_CLIENT_EXIST_STATUS_SUCCESS |
self._exit_status = _prelude.PRELUDE_CLIENT_EXIST_STATUS_FAILURE | self._exit_status = _prelude.PRELUDE_CLIENT_EXIT_STATUS_FAILURE | def set_failure(self): self._exit_status = _prelude.PRELUDE_CLIENT_EXIST_STATUS_FAILURE |
_prelude.prelude_client_destroy(self._client) | _prelude.prelude_client_destroy(self._client, self._exit_status) | def __del__(self): #print "Client.__del__" if self._msgbuf: _prelude.prelude_msgbuf_close(self._msgbuf) #self._msgbuf = None |
_prelude.prelude_client_destroy(self._client) | _prelude.prelude_client_destroy(self._client, _prelude.PRELUDE_CLIENT_EXIT_STATUS_FAILURE) | def __init__(self, name, config=None): if not config: file = os.popen("libprelude-config --prefix") path = file.read() file.close() config = path[:-1] + "/etc/prelude/default/client.conf" Client.__init__(self, Client.SEND_IDMEF, name, config) self._analyzer = _prelude.prelude_client_get_analyzer(self._client) if not ... |
_prelude.prelude_client_set_connection(self._client, self._manager_connection) _prelude.prelude_connection_connect(self._manager_connection) | if not self._manager_connection: raise ClientError("could not create new connection to %s:%p" % (address, port)) if _prelude.prelude_client_set_connection(self._client, self._manager_connection) < 0: raise ClientError("could not set client connection") if _prelude.prelude_connection_connect(self._manager_connection) ... | def __init__(self, name=None, address="127.0.0.1", port=5554): Client.__init__(self, Client.SEND_ADMIN, name, None) self._manager_connection = _prelude.prelude_connection_new(self._client, address, port) _prelude.prelude_client_set_connection(self._client, self._manager_connection) _prelude.prelude_connection_connect(s... |
def maintainence_price(): | def maintainence_price(addMarkup = True): | def maintainence_price(): "Calculate the price of maintainence" price = (float(maintainenceCost[1]) / float(maintainenceCost[0])) / 1000.0 price = price * transfer if addMarkup: price = addPercent(price, markup) return price |
price = (float(maintainenceCost[1]) / float(maintainenceCost[0])) / 1000.0 price = price * transfer | price = float(maintainenceCost[1]) / float(maintainenceCost[0]) price = price | def maintainence_price(): "Calculate the price of maintainence" price = (float(maintainenceCost[1]) / float(maintainenceCost[0])) / 1000.0 price = price * transfer if addMarkup: price = addPercent(price, markup) return price |
def cmdITIME(self, source, name): | def cmdITIME(self, source): | def cmdITIME(self, source, name): """Synonym, of BEAT See: BEAT """ |
if tokens.peek().upper() == "LIST": tokens.next() self.doLIST(target) elif tokens.peek().upper() == "INFO": tokens.next() plugin = tokens.next() self.doINFO(target, plugin) | if tokens.more(): if tokens.peek().upper() == "LIST": tokens.next() self.doLIST(target) elif tokens.peek().upper() == "INFO": tokens.next() plugin = tokens.next() self.doINFO(target, plugin) | def onMESSAGE(self, source, target, message): |
msg = 'Hostname: ' + socket.gethostbyaddr(host) else: msg = source[0] + ', Hostname: ' + socket.gethostbyaddr(host) | msg = "Hostname: %s" + name else: msg = "%s, Hostname: %s" % (source[0], name) | def doHOST(self, source, target, host): if re.search('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', host): if source[0] == target: msg = 'Hostname: ' + socket.gethostbyaddr(host) else: msg = source[0] + ', Hostname: ' + socket.gethostbyaddr(host) else: if source[0] == target: msg = 'IP: ' + socket.gethostbyname(host) else: msg = so... |
msg = 'IP: ' + socket.gethostbyname(host) else: msg = source[0] + ', IP: ' + socket.gethostbyname(host) | msg = "IP: %s" % name else: msg = "%s, IP: %s" % (source[0], name) | def doHOST(self, source, target, host): if re.search('[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', host): if source[0] == target: msg = 'Hostname: ' + socket.gethostbyaddr(host) else: msg = source[0] + ', Hostname: ' + socket.gethostbyaddr(host) else: if source[0] == target: msg = 'IP: ' + socket.gethostbyname(host) else: msg = so... |
win.show() | def sighndl(sig, stack): win.show() | |
ret=self.__parse_results(cursor,callback, sofar) | ret=self.__parse_results(cursor,callback, sofar=sofar) | def query(self, query, callback): """execute a query and call callback on all the results, in the correct order. |
if not sofar or id not in sofar: if sofar: | if sofar==None or id not in sofar: if sofar!=None: | def __parse_results(self, cursor, callback, sofar=None): """Call callback on all the results, in the correct order. |
assert (RPath(self.lc, self.mainprefix, ("sampledir",)).listdir() == ["1", "2", "3", "4"]) | dirlist = RPath(self.lc, self.mainprefix, ("sampledir",)).listdir() dirlist.sort() assert dirlist == ["1", "2", "3", "4"], dirlist | def testListdir(self): """Checking dir listings""" assert (RPath(self.lc, self.mainprefix, ("sampledir",)).listdir() == ["1", "2", "3", "4"]) |
if attr == 'com.apple.FinderInfo' or attr == 'come.apple.ResourceFork': | if attr == 'com.apple.FinderInfo' or attr == 'com.apple.ResourceFork': | def read_from_rp(self, rp): """Set the extended attributes from an rpath""" try: attr_list = rp.conn.xattr.listxattr(rp.path) except IOError, exc: if exc[0] == errno.EOPNOTSUPP: return # if not sup, consider empty if exc[0] == errno.EACCES: log.Log("Warning: listattr(%s): %s" % (rp.path, exc), 3) return raise for attr ... |
if diff_rorp.isspecial(): | if rf.metadata_rorp.isspecial(): | def fast_process(self, index, rf): """Process when nothing is a directory""" if not rf.metadata_rorp.equal_loose(rf.mirror_rp): log.Log("Regressing file %s" % (rf.metadata_rorp.get_indexpath()), 5) if rf.metadata_rorp.isreg(): self.restore_orig_regfile(rf) else: if rf.mirror_rp.lstat(): rf.mirror_rp.delete() if diff_ro... |
assert not ext_rp.lstat() | if ext_rp: assert not ext_rp.lstat() | def set_extended_filenames(self, subdir): """Set self.extended_filenames by trying to write a path""" assert not self.read_only |
The quoting this session appears to need do not match those in | The quoting chars this session needs (%s) do not match the repository settings (%s) listed in | def compare_ctq_file(self, rbdir, suggested_ctq): """Compare ctq file with suggested result, return actual ctq""" ctq_rp = rbdir.append("chars_to_quote") if not ctq_rp.lstat(): if Globals.chars_to_quote is None: actual_ctq = suggested_ctq else: actual_ctq = Globals.chars_to_quote ctq_rp.write_string(actual_ctq) return ... |
backed up onto it. If you want to risk it, remove the file rdiff-backup-data/chars_to_quote.""" % (ctq_rp.path,)) | backed up onto it.""" % (suggested_ctq, actual_ctq, ctq_rp.path)) | def compare_ctq_file(self, rbdir, suggested_ctq): """Compare ctq file with suggested result, return actual ctq""" ctq_rp = rbdir.append("chars_to_quote") if not ctq_rp.lstat(): if Globals.chars_to_quote is None: actual_ctq = suggested_ctq else: actual_ctq = Globals.chars_to_quote ctq_rp.write_string(actual_ctq) return ... |
if len(session_times) < session_num: | if len(session_times) <= session_num: | def time_from_session(session_num, rp = None): """Return time in seconds of given backup The current mirror is session_num 0, the next oldest increment has number 1, etc. Requires that the Globals.rbdir directory be set. """ session_times = Globals.rbdir.conn.restore.MirrorStruct \ .get_increment_times() session_tim... |
str_list.append(" Uname %s\n" % rorpath.getuname() or ":") | str_list.append(" Uname %s\n" % (rorpath.getuname() or ":")) | def RORP2Record(rorpath): """From RORPath, return text record of file's metadata""" str_list = ["File %s\n" % quote_path(rorpath.get_indexpath())] # Store file type, e.g. "dev", "reg", or "sym", and type-specific data type = rorpath.gettype() if type is None: type = "None" str_list.append(" Type %s\n" % type) if type... |
str_list.append(" Gname %s\n" % rorpath.getgname() or ":") | str_list.append(" Gname %s\n" % (rorpath.getgname() or ":")) | def RORP2Record(rorpath): """From RORPath, return text record of file's metadata""" str_list = ["File %s\n" % quote_path(rorpath.get_indexpath())] # Store file type, e.g. "dev", "reg", or "sym", and type-specific data type = rorpath.gettype() if type is None: type = "None" str_list.append(" Type %s\n" % type) if type... |
if data == ":": data_dict['uname'] = None | if data == ":" or data == 'None': data_dict['uname'] = None | def Record2RORP(record_string): """Given record_string, return RORPath For speed reasons, write the RORPath data dictionary directly instead of calling rorpath functions. Profiling has shown this to be a time critical function. """ data_dict = {} for field, data in line_parsing_regexp.findall(record_string): if fiel... |
if data == ':': data_dict['gname'] = None | if data == ':' or data == 'None': data_dict['gname'] = None | def Record2RORP(record_string): """Given record_string, return RORPath For speed reasons, write the RORPath data dictionary directly instead of calling rorpath functions. Profiling has shown this to be a time critical function. """ data_dict = {} for field, data in line_parsing_regexp.findall(record_string): if fiel... |
self.conn.os.utime(self.path, (accesstime, modtime)) self.data['atime'] = accesstime self.data['mtime'] = modtime | try: self.conn.os.utime(self.path, (accesstime, modtime)) except OverflowError: log.Log("Cannot change times of %s to %s - problem is probably" "64->32bit conversion" % (self.path, (accesstime, modtime)), 2) else: self.data['atime'] = accesstime self.data['mtime'] = modtime | def settime(self, accesstime, modtime): """Change file modification times""" log.Log("Setting time of %s to %d" % (self.path, modtime), 7) self.conn.os.utime(self.path, (accesstime, modtime)) self.data['atime'] = accesstime self.data['mtime'] = modtime |
self.conn.os.utime(self.path, (long(time.time()), modtime)) self.data['mtime'] = modtime | try: self.conn.os.utime(self.path, (long(time.time()), modtime)) except OverflowError: log.Log("Cannot change mtime of %s to %s - problem is probably" "64->32bit conversion" % (self.path, modtime), 2) else: self.data['mtime'] = modtime | def setmtime(self, modtime): """Set only modtime (access time to present)""" log.Log(lambda: "Setting time of %s to %d" % (self.path, modtime), 7) self.conn.os.utime(self.path, (long(time.time()), modtime)) self.data['mtime'] = modtime |
retvalparts.append('createDate:%d' % cfile['createDate']) | try: retvalparts.append('createDate:%d' % cfile['createDate']) except KeyError: log.Log("Writing pre-1.1.6 style metadata, without creation date", 9) | def carbonfile2string(cfile): """Convert CarbonFile data to a string suitable for storing.""" if not cfile: return "None" retvalparts = [] retvalparts.append('creator:%s' % binascii.hexlify(cfile['creator'])) retvalparts.append('type:%s' % binascii.hexlify(cfile['type'])) retvalparts.append('location:%d,%d' % cfile['lo... |
if raw_rf: raw_rf.set_metadata_rorp(metadata_rorp) yield raw_rf else: | if not raw_rf: | def iterate_meta_rfs(mirror_rp, inc_rp): """Yield RegressFile objects with extra metadata information added Each RegressFile will have an extra object variable .metadata_rorp which will contain the metadata attributes of the mirror file at regress_time. """ raw_rfs = iterate_raw_rfs(mirror_rp, inc_rp) collated = rorp... |
yield RegressFile(mirror_rp.new_index(metadata_rorp.index), inc_rp.new_index(metadata_rorp.index), ()) | continue raw_rf.set_metadata_rorp(metadata_rorp) yield raw_rf | def iterate_meta_rfs(mirror_rp, inc_rp): """Yield RegressFile objects with extra metadata information added Each RegressFile will have an extra object variable .metadata_rorp which will contain the metadata attributes of the mirror file at regress_time. """ raw_rfs = iterate_raw_rfs(mirror_rp, inc_rp) collated = rorp... |
if rid.inc_list: print "/".join(rid.index) | if rid.inc_list: if not rid.index: path = "." else: path = "/".join(rid.index) print "%-11s: %s" % (determineChangeType(rid.inc_list), path) | def get_rids_recursive(rid): """Yield all the rids under rid that have inc newer than rest_time""" yield rid for sub_rid in Restore.yield_rids(rid, rest_time, mirror_time): for sub_sub_rid in get_rids_recursive(sub_rid): yield sub_sub_rid |
if Globals.get(attr) is not None: | if Globals.get(attr) is None: | def update_bool_global(attr, bool): """If bool is not None, update Globals.attr accordingly""" if Globals.get(attr) is not None: SetConnections.UpdateGlobal(attr, bool) |
if Globals.get(attr) is not None: SetConnections.UpdateGlobal(attr, bool) | if Globals.get(attr) is None: SetConnections.UpdateGlobal(attr, bool) | def update_bool_global(attr, bool): """If bool is not None, update Globals.attr accordingly""" if Globals.get(attr) is not None: SetConnections.UpdateGlobal(attr, bool) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.