bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | 32,300 |
def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | 32,301 |
def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | 32,302 |
def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | def outputStatistics(pop, args): ''' this function will be working with a pyOperator to output statistics. Many parameters will be passed, packed as a tuple. We need to output 1. LD (D') from a central marker to all others on a non-DSL chromosome, at burnin and before and after migration 2. LD (D') from a central DSL ... | 32,303 |
def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' # return max LD res = {} # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] # D' ldvalue = [] # D for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.append(pop.locusDist(ld[... | def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' # return max LD res = {} # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] # D' ldvalue = [] # D for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.append(pop.locusDist(ld[... | 32,304 |
def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+data+ "_%d" % ch i... | def TDT(geneHunter, DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+data+ ... | 32,305 |
def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+data+ "_%d" % ch i... | def TDT(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use TDT method to analyze the results. Has to have rpy installed ''' if not hasRPy or geneHunter in ['', 'none']: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying TDT method to affected sibpairs " for ch in range(numChrom): inputfil... | 32,306 |
def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+... | def Linkage(geneHunter, DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(numChrom): inputfil... | 32,307 |
def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(numChrom): inputfile = dataDir+... | def Linkage(DSL, cutoff, dataDir, data, epsFile, jpgFile): ''' use Linkage method to analyze the results. Has to have rpy installed ''' if not hasRPy or geneHunter in ['', 'none']: return (0,[]) # write a batch file and call gh allPvalue = [] print "Applying Linkage (LOD) method to affected sibpairs " for ch in range(n... | 32,308 |
def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, geneHunter, dryrun, popIdx... | 32,309 |
def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | 32,310 |
def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | def processOnePopulation(dataDir, numChrom, numLoci, markerType, DSLafter, DSLdist, initSize, meanInitAllele, burnin, introGen, minAlleleFreq, maxAlleleFreq, fitness, mlSelModel, numSubPop, finalSize, noMigrGen, mixingGen, popSizeFunc, migrModel, mu, mi, rec, peneFunc, penePara, N, numSample, dryrun, popIdx): ''' this... | 32,311 |
def writeReport(content, allParam, numChrom, numLoci, DSLafter, peneFunc, numSample, results): ''' write a HTML file. The parts for each population has been written but we need a summary table. ''' print "Writing a report (saved in summary.htm )" try: summary = open(outputDir + "/summary.htm", 'w') except: raise except... | def writeReport(content, allParam, numChrom, numLoci, DSLafter, peneFunc, numSample, results): ''' write a HTML file. The parts for each population has been written but we need a summary table. ''' print "Writing a report (saved in summary.htm )" try: summary = open(outputDir + "/summary.htm", 'w') except: raise except... | 32,312 |
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... | 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... | 32,313 |
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... | 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(atPlo... | 32,314 |
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... | 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... | 32,315 |
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... | 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... | 32,316 |
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... | 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... | 32,317 |
def constSize(size, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' The population size is constant, but will split into numSubPop subpopulations at generation split ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [int(bottleneckSize/numSubPop)... | def constSize(size, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' The population size is constant, but will split into numSubPop subpopulations at generation split ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bottleneckSize] else: return [int(bottleneckSize/numSubPop)... | 32,318 |
def LinearExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Linearly expand population size from intiSize to endSize after burnin, split the population at generation split. ''' inc = (endSize-initSize)/float(end-burnin) def func(gen, oldSize=[]): if gen == bottle... | def LinearExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Linearly expand population size from intiSize to endSize after burnin, split the population at generation split. ''' inc = (endSize-initSize)/float(end-burnin) def func(gen, oldSize=[]): if gen == bottle... | 32,319 |
def ExponentialExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Exponentially expand population size from intiSize to endSize after burnin, split the population at generation split. ''' rate = (math.log(endSize)-math.log(initSize))/(end-burnin) def func(gen, old... | def ExponentialExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Exponentially expand population size from intiSize to endSize after burnin, split the population at generation split. ''' rate = (math.log(endSize)-math.log(initSize))/(end-burnin) def func(gen, old... | 32,320 |
def InstantExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Instaneously expand population size from intiSize to endSize after burnin, split the population at generation split. ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bott... | def InstantExpansion(initSize, endSize, end, burnin=0, split=0, numSubPop=1, bottleneckGen=-1, bottleneckSize=0): ''' Instaneously expand population size from intiSize to endSize after burnin, split the population at generation split. ''' def func(gen, oldSize=[]): if gen == bottleneckGen: if gen < split: return [bott... | 32,321 |
def testDemoFunc(end, func): g = range(end) rng = [min( [ func(x)[0] for x in g]), max( [ sum(func(x)) for x in g])] r.plot(g, [sum(func(x)) for x in g], ylim=rng, type='l', xlab='gen', ylab='subPopSize(0)') r.lines(g, [func(x)[0] for x in g], type='l', xlab='gen', ylab='subPopSize(0)', lty=2) | def testDemoFunc(end, func): g = range(end) rng = [min( [ func(x)[0] for x in g]), max( [ sum(func(x)) for x in g])] r.plot(g, [sum(func(x)) for x in g], ylim=rng, type='l', xlab='gen', ylab='subPopSize(0)') r.lines(g, [func(x)[0] for x in g], type='l', xlab='gen', ylab='subPopSize(0)', lty=2) | 32,322 |
def migrIslandRates(r, n): ''' migration rate matrix x m/(n-1) m/(n-1) .... m/(n-1) x ............ ..... .... m/(n-1) m/(n-1) x where x = 1-m ''' # n==1? if n == 1: return [[1]] # m = [] for i in range(0,n): m.append( [r/(n-1.)]*n) m[-1][i] = 1-r return m | def migrIslandRates(r, n): ''' migration rate matrix x m/(n-1) m/(n-1) .... m/(n-1) x ............ ..... .... m/(n-1) m/(n-1) x where x = 1-m ''' # n==1? if n == 1: return [[1]] # m = [] for i in range(0,n): m.append( [r/(n-1.)]*n) m[-1][i] = 1-r return m | 32,323 |
def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | 32,324 |
def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | def migrSteppingStoneRates(r, n, circular=False): ''' migration rate matrix, circular step stone model (X=1-m) X m/2 m/2 m/2 X m/2 0 0 m/2 x m/2 ......0 ... m/2 0 .... m/2 X or non-circular X m/2 m/2 m/2 X m/2 0 0 m/2 X m/2 ......0 ... ... ... | 32,325 |
def tab(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\t"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | def tab(output=">", outputExpr="", **kwargs): parm = '' for (k,v) in kwargs.items(): parm += ' , ' + str(k) + '=' + str(v) cmd = r'''pyEval( r'"\t"' ''' + ', output="""' + output + \ '""", outputExpr="""' + outputExpr + '"""' + parm + ')' # print cmd return eval(cmd) | 32,326 |
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) | 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) | 32,327 |
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) | 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) | 32,328 |
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) | 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) | 32,329 |
def CollectValue(pop, gen, expr, name): value = eval(expr, globals(), pop.vars()) d = pop.vars() if not d.has_key(name): d[name] = {} d[name][gen] = value | def CollectValue(pop, gen, expr, name): value = eval(expr, globals(), pop.vars()) d = pop.vars() if not d.has_key(name): d[name] = {} d[name][gen] = value | 32,330 |
def collector(name, expr, **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # Collect(pop, expr, name) # """) opt = '''pyExec(exposePop=1, %s stmts=r\'\'\'CollectValue(pop, gen, expr="""%s""", name="""%s""")\'... | def collector(name, expr, **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # Collect(pop, expr, name) # """) opt = '''pyExec(exposePop=1, %s stmts=r\'\'\'CollectValue(pop, gen, expr="""%s""", name="""%s""")\'... | 32,331 |
def SaveFstat(pop, output='', outputExpr='', maxAllele=0): if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) else: raise exceptions.ValueError, "Please specify output or outputExpr" # open file try: f = open(file, "w") except exceptions.IOError: raise exceptions.IOErr... | def SaveFstat(pop, output='', outputExpr='', maxAllele=0): if output != '': file = output elif outputExpr != '': file = eval(outputExpr, globals(), pop.vars() ) else: raise exceptions.ValueError, "Please specify output or outputExpr" # open file try: f = open(file, "w") except exceptions.IOError: raise exceptions.IOErr... | 32,332 |
def saveFstat(output='', outputExpr='', **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # saveInFSTATFormat( pop, rep=rep?, output=output?, outputExpr=outputExpr?) # """) opt = '''pyEval(exposePop=1, %s stmt... | def saveFstat(output='', outputExpr='', **kwargs): # deal with additional arguments parm = '' for (k,v) in kwargs.items(): parm += str(k) + '=' + str(v) + ', ' # pyEval( exposePop=1, param?, stmts=""" # saveInFSTATFormat( pop, rep=rep?, output=output?, outputExpr=outputExpr?) # """) opt = '''pyEval(exposePop=1, %s stmt... | 32,333 |
def LoadFstat(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") # # file is opened. get basic parameters try: # get numSubPop(), totNumLoci(), maxAllele(), digit [np, nl, nu, nd] = map(int, f.readline().split()) except exc... | def LoadFstat(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") # # file is opened. get basic parameters try: # get numSubPop(), totNumLoci(), maxAllele(), digit [np, nl, nu, nd] = map(int, f.readline().split()) except exc... | 32,334 |
def LoadGCData(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") gt = [] for line in f.readlines(): gt.append( line.split() ) f.close() # now we have a 2-d matrix of strings # population size? popSize = len(gt) # number of... | def LoadGCData(file, loci=[]): # open file try: f = open(file, "r") except exceptions.IOError: raise exceptions.IOError("Can not open file " + file + " to read.") gt = [] for line in f.readlines(): gt.append( line.split() ) f.close() # now we have a 2-d matrix of strings # population size? popSize = len(gt) # number of... | 32,335 |
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... | 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... | 32,336 |
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... | 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... | 32,337 |
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... | 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... | 32,338 |
def genoStr(ind): string = '' for marker in markers: string += "%d %d " % (ind.allele(marker, 0)+1, ind.allele(marker, 1)+1) return string | def genoStr(ind): string = '' for marker in markers: string += "%d %d " % (ind.allele(marker, 0)+1, ind.allele(marker, 1)+1) return string | 32,339 |
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 ... | 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 ... | 32,340 |
def sexCode(code): if code == 1: return Male else: return Female | def sexCode(code): if code == 1: return Male else: return Female | 32,341 |
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... | 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... | 32,342 |
def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | 32,343 |
def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | def spPopSize(gen): if gen < split: return [NtFunc(split-1)[0]] else: return [NtFunc(gen)[sp]] | 32,344 |
def trajFuncWithSubPop(gen): if gen >= split: return [spTraj[x][gen-split] for x in range(numLoci*numSP)] else: freq = [] for tr in trajBeforeSplit: if gen < split - len(tr) + 1: freq.append( 0 ) else: freq.append( tr[ gen - (split - len(tr) + 1) ] ) return freq | def trajFuncWithSubPop(gen): if gen >= split: return [spTraj[x][gen-split] for x in range(numLoci*numSP)] else: freq = [] for tr in trajBeforeSplit: if gen < split - len(tr) + 1: freq.append( 0 ) else: freq.append( tr[ gen - (split - len(tr) + 1) ] ) return freq | 32,345 |
def setGen(pop, off, dad, mom): off.setAllele(pop.gen(), 0) return True | def setGen(pop, off, dad, mom): off.setAllele(pop.gen(), 0) return True | 32,346 |
def testNoMating(self): 'Testing noMating mating scheme' simu = simulator(population(10, loci=[1], ploidy=1), noMating()) # during mating operator will be applied simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.assertEqual( simu.population(0).arrGenotype(), [0]*10) simu.step( ops=[ pyOperator(func=... | def testNoMating(self): 'Testing noMating mating scheme' simu = simulator(population(10, loci=[1], ploidy=1), noMating()) # during mating operator will be applied simu.step( ops=[ pyOperator(func=setGen, stage=DuringMating) ]) self.assertEqual( simu.population(0).arrGenotype(), [0]*10) simu.step( ops=[ pyOperator(func=... | 32,347 |
## def testTrajectoryStoch(self): | ## def testTrajectoryStoch(self): | 32,348 |
## def testTrajectoryMultiStoch(self): | ## def testTrajectoryMultiStoch(self): | 32,349 |
def testPyMating(self): ' test pyMating ' | def testPyMating(self): ' test pyMating ' | 32,350 |
def last_two(gen): if gen >= endGen -2: return 2 else: return 1 | def last_two(gen): if gen >= endGen -2: return 2 else: return 1 | 32,351 |
def doOK(event): " OK buton is pressed " root1.quit() | def doOK(event): " OK buton is pressed " root1.quit() | 32,352 |
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()] ) | 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()] ) | 32,353 |
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 | def debug(args=None): options = load_options(args) zope.app.appsetup.config(options.site_definition) db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0] notify(zope.app.appsetup.interfaces.DatabaseOpened(db)) return db | 32,354 |
def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | 32,355 |
def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | 32,356 |
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[-... | 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[-... | 32,357 |
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[-... | 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[-... | 32,358 |
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... | 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... | 32,359 |
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... | 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... | 32,360 |
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... | 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... | 32,361 |
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) ... | defline = line.replace(")</programlisting>", ");") stripTags(line):line = line.replace(")</programlisting>", ");") matchline = line.replace(")</programlisting>", ");") =line = line.replace(")</programlisting>", ");") re.search(r"^(.*)\)[line = line.replace(")</programlisting>", ");") ]*:[^<]*</programlisting>.*$",line ... | 32,362 |
def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | def mergeArrays(a1, a2): a3 = [] for item in a1: a3.append(item) for item in a2: a3.append(item) return a3 | 32,363 |
def __int__(self): """Return the number of seconds.""" return _prelude.idmef_time_get_sec(self.res) | def __int__(self): """Return the number of seconds.""" return _prelude.idmef_time_get_sec(self.res) | 32,364 |
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... | 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... | 32,365 |
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): 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... | 32,366 |
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... | 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... | 32,367 |
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) | 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) | 32,368 |
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... | 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.HAVE_CONTEXT) if self.name.find("[") != -1: self.instance = True m = re.compile("(.+)\[(.+)\]").match(self.name) self.instantiabl... | 32,369 |
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, 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... | 32,370 |
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) | def __init__(self, parent, option): 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) | 32,371 |
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) | def __init__(self, parent, name, description, value): 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(... | 32,372 |
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) | def __init__(self, parent, name, description, value): self.parent = parent self.name = name self.description = description self.value = value self.options = [ ] nodes = [ self.name ] while parent: nodes.insert(0, parent.name) parent = parent.parent self.path = ".".join(nodes) | 32,373 |
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 _get_option_list(self, parent, start): options = [ ] cur = None while True: cur = _prelude.prelude_option_get_next(start, cur) if not cur: break option = Option(parent, cur) options.append(option) if _prelude.prelude_option_has_optlist(cur): option.options = self._get_option_list(option, cur) return options | 32,374 |
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 | 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) retval = _prelude.prelude_option_recv_set(msg) return retval | 32,375 |
def __str__(self): """Return the RFC8601 string representation of the object.""" buf = "A" * 128 | def __str__(self): """Return the RFC8601 string representation of the object.""" buf = "A" * 128 | 32,376 |
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") | 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 not _prelude.prelude_option_recv_set(msg): raise Error("could not read set_option answer") | 32,377 |
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") | def commit(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_COMMIT, instance) if not _prelude.prelude_option_recv_set(msg): raise Error("could not read commit answer") | 32,378 |
def destroy(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_DESTROY, instance) | def destroy(self, analyzer_path, instance): msg = self._request(analyzer_path, _prelude.PRELUDE_MSG_OPTION_DESTROY, instance) | 32,379 |
def get_libprelude_prefix(): return os.popen("libprelude-config --prefix").read()[:-1] | def get_libprelude_prefix(): return os.popen("libprelude-config --prefix").read()[:-1] | 32,380 |
def is_section(self): return len(self.options) > 0 | def is_section(self): return len(self.options) > 0 | 32,381 |
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... | 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... | 32,382 |
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... | 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._manager_con... | 32,383 |
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... | 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... | 32,384 |
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... | 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... | 32,385 |
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): 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... | 32,386 |
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... | 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_valu... | 32,387 |
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 _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 | 32,388 |
def __init__(self): """Create a new empty IDMEF message.""" 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() | 32,389 |
def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) | def __append(self, value, operator): top_criteria = IDMEFCriteria() idmef_criteria_destroy(top_criteria.res) | 32,390 |
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.... | 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 ... | 32,391 |
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... | 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.IDMEF_VALUE_TYPE_UINT16: { 'py_type': [ int ], 'check_value': lambda i: i >= 0 and ... | 32,392 |
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._... | 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._... | 32,393 |
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)... | def _request(self, analyzer_path, type, value=None): 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) _prelude.prelude_msgbuf_mark_end(self._msgbuf) msg... | 32,394 |
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)... | 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.prelude_connection_recv(self._connection) if not msg: raise Error("coul... | 32,395 |
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") | 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") | 32,396 |
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") | 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") | 32,397 |
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 | 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 | 32,398 |
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) | 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) | 32,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.