bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def min_dist(coord, surface): """ Return minimum distance between coord and surface. """ d=surface-coord d2=sum(d*d, 1) return numpy.sqrt(min(d2)) | def min_dist(coord, surface): """ Return minimum distance between coord and surface. """ d=surface-coord d2=numpy.sum(d*d, 1) return numpy.sqrt(min(d2)) | 448,300 |
def _parse_pdb_header_list(header): # database fields dict={'name':"", 'head':'', 'deposition_date' : "1909-01-08", 'release_date' : "1909-01-08", 'structure_method' : "unknown", 'resolution' : 0.0, 'structure_reference' : "unknown", 'journal_reference' : "unknown", 'author' : "", 'compound':{'1':{'misc':''}},'source':... | def _parse_pdb_header_list(header): # database fields dict={'name':"", 'head':'', 'deposition_date' : "1909-01-08", 'release_date' : "1909-01-08", 'structure_method' : "unknown", 'resolution' : 0.0, 'structure_reference' : "unknown", 'journal_reference' : "unknown", 'author' : "", 'compound':{'1':{'misc':''}},'source':... | 448,301 |
def get_all_primary_ids(self): """All the primary_ids of the sequences in the database (OBSOLETE). | def get_all_primary_ids(self): """All the primary_ids of the sequences in the database (OBSOLETE). | 448,302 |
def keys(self): """List of ids which may not be meaningful outside this database.""" return self.get_all_primary_ids() | def keys(self): """List of ids which may not be meaningful outside this database.""" return self.get_all_primary_ids() | 448,303 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,304 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,305 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,306 |
def UniprotIterator(handle, alphabet=Alphabet.ProteinAlphabet(), return_raw_comments=False): '''Generator Function parses an XML entry at a time from any UniProt XML file returns a SeqRecord for each iteration This generator can be used in Bio.SeqIO return_raw_comments = True --> comment fields are returned as comple... | def UniprotIterator(handle, alphabet=Alphabet.ProteinAlphabet(), return_raw_comments=False): '''Generator Function parses an XML entry at a time from any UniProt XML file returns a SeqRecord for each iteration This generator can be used in Bio.SeqIO return_raw_comments = True --> comment fields are returned as comple... | 448,307 |
def get_sequence(self): """ Return the AA sequence. | def get_sequence(self): """ Return the AA sequence. | 448,308 |
def _validate(self): #Check the outfile, filter, or stdout option has been set. #We can't simply do this via the required flag for the outfile #output - this seems the simplest solution. if not (self.outfile or self.filter or self.stdout): raise ValueError("You must either set outfile (output filename), " "or enable fi... | def _validate(self): #Check the outfile, filter, or stdout option has been set. #We can't simply do this via the required flag for the outfile #output - this seems the simplest solution. if not (self.outfile or self.filter or self.stdout): raise ValueError("You must either set outfile (output filename), " "or enable fi... | 448,309 |
def _name_n_vector(self,opts,separator='='): """Extract name and check that it's not in vector format.""" rest=opts.rest() name=opts.next_word() # we ignore * before names if name=='*': name=opts.next_word() if not name: raise NexusError('Formatting error in line: %s ' % rest) name=quotestrip(name) if opts.peek_nonwhit... | def _name_n_vector(self,opts,separator='='): """Extract name and check that it's not in vector format.""" rest=opts.rest() name=opts.next_word() # we ignore * before names if name=='*': name=opts.next_word() if not name: raise NexusError('Formatting error in line: %s ' % rest) name=quotestrip(name) if opts.peek_nonwhit... | 448,310 |
def _name_n_vector(self,opts,separator='='): """Extract name and check that it's not in vector format.""" rest=opts.rest() name=opts.next_word() # we ignore * before names if name=='*': name=opts.next_word() if not name: raise NexusError('Formatting error in line: %s ' % rest) name=quotestrip(name) if opts.peek_nonwhit... | def _name_n_vector(self,opts,separator='='): """Extract name and check that it's not in vector format.""" rest=opts.rest() name=opts.next_word() # we ignore * before names if name=='*': name=opts.next_word() if not name: raise NexusError('Formatting error in line: %s ' % rest) name=quotestrip(name) if opts.peek_nonwhit... | 448,311 |
def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to, or filename as string (note older versions of Biopython only took a handle). - format - lower case string describing ... | def write(alignments, handle, format): """Write complete set of alignments to a file. Arguments: - sequences - A list (or iterator) of Alignment objects - handle - File handle object to write to, or filename as string (note older versions of Biopython only took a handle). - format - lower case string describing ... | 448,312 |
def test_duplicates_index(self): | def test_duplicates_index(self): | 448,313 |
def test_duplicates_to_dict(self): | def test_duplicates_to_dict(self): | 448,314 |
def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | 448,315 |
def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | def _feed_header_lines(self, consumer, lines): EMBL_INDENT = self.HEADER_WIDTH EMBL_SPACER = " " * EMBL_INDENT consumer_dict = { 'AC' : 'accession', 'SV' : 'version', # SV line removed in June 2006, now part of ID line 'DE' : 'definition', #'RN' : 'reference_num', #'RC' : reference comment... TODO #'RP' : 'reference_b... | 448,316 |
def _parse_organism(element): com_name=sci_name='' for organism_element in element.getchildren(): if organism_element.tag==NS + 'name': if organism_element.attrib['type']== 'scientific': sci_name=organism_element.text elif organism_element.attrib['type']== 'common': com_name=organism_element.text else: append_to_annota... | def _parse_organism(element): com_name=sci_name='' for organism_element in element.getchildren(): if organism_element.tag==NS + 'name': if organism_element.attrib['type']== 'scientific': if organism_element.text: sci_name=organism_element.text if (organism_element.attrib['type']== 'common') and not sci_name: if organis... | 448,317 |
def is_parent_of(self, target=None, **kwargs): """True if target is a descendent of this tree. | def is_parent_of(self, target=None, **kwargs): """True if target is a descendent of this tree. | 448,318 |
def __str__(self): """ __str__(self) -> "" | def __str__(self): """ __str__(self) -> "" | 448,319 |
def __init__(self, name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None): """ Atom object. | def __init__(self, name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None): """ Atom object. | 448,320 |
def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | 448,321 |
def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | 448,322 |
def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | def draw_line_graph(self, graph): """ draw_line_graph(self, graph) -> [element, element,...] | 448,323 |
def __contains__(self, value): """Check if a primary (internal) id is this namespace (sub database).""" sql = "SELECT COUNT(bioentry_id) FROM bioentry " + \ "WHERE biodatabase_id=%s AND bioentry_id=%s;" return bool(self.adaptor.execute_and_fetch_col0(sql, (self.dbid, value))[0]) | def __contains__(self, value): """Check if a primary (internal) id is this namespace (sub database).""" sql = "SELECT COUNT(bioentry_id) FROM bioentry " + \ "WHERE biodatabase_id=%s AND bioentry_id=%s;" return bool(self.adaptor.execute_and_fetch_col0(sql, (self.dbid, bioentry_id))[0]) | 448,324 |
def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | def reverse_complement(self, id=False, name=False, description=False, features=True, annotations=False, letter_annotations=True, dbxrefs=False): """Returns new SeqRecord with reverse complement sequence. | 448,325 |
def __create_motif(line): line = line.strip() ls = line.split() motif = MEMEMotif() motif.length = int(ls[4]) motif._numoccurrences(ls[7]) motif._evalue(ls[13]) return motif | def __create_motif(line): line = line[5:].strip() ls = line.split() motif = MEMEMotif() motif.length = int(ls[4]) motif._numoccurrences(ls[7]) motif._evalue(ls[13]) return motif | 448,326 |
def __create_motif(line): line = line.strip() ls = line.split() motif = MEMEMotif() motif.length = int(ls[4]) motif._numoccurrences(ls[7]) motif._evalue(ls[13]) return motif | def __create_motif(line): line = line.strip() ls = line.split() motif = MEMEMotif() motif.length = int(ls[3]) motif._numoccurrences(ls[6]) motif._evalue(ls[12]) return motif | 448,327 |
def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" #print name, repr(from_res), repr(to_res), "..." if from_res == "?" and to_res == "?": #If this does happen, will need to think about this some more! raise ValueError("Swiss file FT loca... | def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" #print name, repr(from_res), repr(to_res), "..." if from_res == "?" and to_res == "?": #If this does happen, will need to think about this some more! raise ValueError("Swiss file FT loca... | 448,328 |
def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" #print name, repr(from_res), repr(to_res), "..." if from_res == "?" and to_res == "?": #If this does happen, will need to think about this some more! raise ValueError("Swiss file FT loca... | def _make_seqfeature(name, from_res, to_res, description, ft_id): """Construct SeqFeature from feature data from parser (PRIVATE).""" #print name, repr(from_res), repr(to_res), "..." if from_res == "?" and to_res == "?": #If this does happen, will need to think about this some more! raise ValueError("Swiss file FT loca... | 448,329 |
def test_Prank_simple_with_NEXUS_output(self): """Simple round-trip through app with infile, output in NEXUS output.?.??? files written to cwd - no way to redirect """ records = list(SeqIO.parse(open(self.infile1),"fasta")) #Try using keyword argument, cmdline = PrankCommandline(prank_exe, d=self.infile1, noxml=True) #... | def test_Prank_simple_with_NEXUS_output(self): """Simple round-trip through app with infile, output in NEXUS output.?.??? files written to cwd - no way to redirect """ records = list(SeqIO.parse(open(self.infile1),"fasta")) #Try using keyword argument, cmdline = PrankCommandline(prank_exe, d=self.infile1, noxml=True) #... | 448,330 |
def _get_date(self, record) : default = "01-JAN-1980" try : date = record.annotations["date"] except KeyError : return default #Cope with a list of one string: if isinstance(date, list) and len(date)==1 : date = date[0] #TODO - allow a Python date object if not isinstance(date, str) or len(date) != 11 \ or date[2] != "... | def _get_date(self, record) : default = "01-JAN-1980" try : date = record.annotations["date"] except KeyError : return default #Cope with a list of one string: if isinstance(date, list) and len(date)==1 : date = date[0] #TODO - allow a Python date object if not isinstance(date, basestring) or len(date) != 11 \ or date[... | 448,331 |
def compare_motifs (self, motif): if isinstance(motif, MEMEMotif): if not self.pssm: raise ValueError('This motif does not have a PSSM') if not motif.pssm: raise ValueError('The other motif does not have a PSSM') mylen = len(self.pssm) yourlen = len(motif.pssm) myr = None if mylen == yourlen: myr = _corr(self.pssm, mot... | def compare_motifs (self, motif): if isinstance(motif, MEMEMotif): if not self.pssm: raise ValueError('This motif does not have a PSSM') if not motif.pssm: raise ValueError('The other motif does not have a PSSM') mylen = len(self.pssm) yourlen = len(motif.pssm) myr = None if mylen == yourlen: myr = _corr(self.pssm, mot... | 448,332 |
def test_blasp(self): """Pairwise BLASTP search""" global exe_names cline = Applications.NcbiblastpCommandline(exe_names["blastp"], query="Fasta/rose.pro", subject="GenBank/NC_005816.faa", evalue=1) self.assertEqual(str(cline), exe_names["blastp"] \ + " -query Fasta/rose.pro -evalue 1" \ + " -subject GenBank/NC_005816.... | def test_blastp(self): """Pairwise BLASTP search""" global exe_names cline = Applications.NcbiblastpCommandline(exe_names["blastp"], query="Fasta/rose.pro", subject="GenBank/NC_005816.faa", evalue=1) self.assertEqual(str(cline), exe_names["blastp"] \ + " -query Fasta/rose.pro -evalue 1" \ + " -subject GenBank/NC_005816... | 448,333 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,334 |
def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | def check_dict_methods(self, rec_dict, keys, ids): self.assertEqual(set(keys), set(rec_dict.keys())) #This is redundant, I just want to make sure len works: self.assertEqual(len(keys), len(rec_dict)) #Make sure boolean evaluation works self.assertEqual(bool(keys), bool(rec_dict)) for key,id in zip(keys, ids): self.asse... | 448,335 |
def constant(self,matrix=None,delete=[],exclude=[]): """Return a list with all constant characters.""" if not matrix: matrix=self.matrix undelete=[t for t in self.taxlabels if t in matrix and t not in delete] if not undelete: return None elif len(undelete)==1: return [x for x in range(len(matrix[undelete[0]])) if x not... | def constant(self,matrix=None,delete=[],exclude=[]): """Return a list with all constant characters.""" if not matrix: matrix=self.matrix undelete=[t for t in self.taxlabels if t in matrix and t not in delete] if not undelete: return None elif len(undelete)==1: return [x for x in range(len(matrix[undelete[0]])) if x not... | 448,336 |
def crop_matrix(self,matrix=None, delete=[], exclude=[]): """Return a matrix without deleted taxa and excluded characters.""" if not matrix: matrix=self.matrix if [t for t in delete if not self._check_taxlabels(t)]: raise NexusError('Unknown taxa: %s' \ % ', '.join(sets.set(delete).difference(self.taxlabels))) if exclu... | def crop_matrix(self,matrix=None, delete=[], exclude=[]): """Return a matrix without deleted taxa and excluded characters.""" if not matrix: matrix=self.matrix if [t for t in delete if not self._check_taxlabels(t)]: raise NexusError('Unknown taxa: %s' \ % ', '.join(set(delete).difference(self.taxlabels))) if exclude!=[... | 448,337 |
def quicker_apply_on_multi_fasta(file, function, *args): """Apply a function on each sequence in a multiple FASTA file (OBSOLETE). file - filename of a FASTA format file function - the function you wish to invoke on each record *args - any extra arguments you want passed to the function This function will use quick_F... | def quicker_apply_on_multi_fasta(file, function, *args): """Apply a function on each sequence in a multiple FASTA file (OBSOLETE). file - filename of a FASTA format file function - the function you wish to invoke on each record *args - any extra arguments you want passed to the function This function will use quick_F... | 448,338 |
def test_Mafft_simple(self): """Simple round-trip through app with infile. Result passed to stdout. """ #Use a keyword argument at init, cmdline = MafftCommandline(mafft_exe, input=self.infile1) self.assertEqual(str(eval(repr(cmdline))), str(cmdline)) child = subprocess.Popen(str(cmdline), stdout=subprocess.PIPE, stder... | def test_Mafft_simple(self): """Simple round-trip through app with infile. Result passed to stdout. """ #Use a keyword argument at init, cmdline = MafftCommandline(mafft_exe, input=self.infile1) self.assertEqual(str(eval(repr(cmdline))), str(cmdline)) child = subprocess.Popen(str(cmdline), stdout=subprocess.PIPE, stder... | 448,339 |
def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) < max_len: return [text] | def _split_multi_line(self, text, max_len): "Returns a list of strings.""" #TODO - Do the line spliting while preserving white space? text = text.strip() if len(text) < max_len: return [text] | 448,340 |
def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: start_end = identifier.rsplit("/",1)[1] if start_end.count("-")==1: start, end = map(int, start_end.split("-")) name = identifier.split("/",1)[0] return (name, start, end) return (identifi... | def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: name, start_end = identifier.rsplit("/",1) if start_end.count("-")==1: start, end = map(int, start_end.split("-")) name = identifier.split("/",1)[0] return (name, start, end) return (ident... | 448,341 |
def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: start_end = identifier.rsplit("/",1)[1] if start_end.count("-")==1: start, end = map(int, start_end.split("-")) name = identifier.split("/",1)[0] return (name, start, end) return (identifi... | def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: start_end = identifier.rsplit("/",1)[1] if start_end.count("-")==1: start, end = map(int, start_end.split("-")) return (name, start, end) return (identifier, None, None) | 448,342 |
def values(self): """Would be a list of the SeqRecord objects, but not implemented. | def values(self): """Would be a list of the SeqRecord objects, but not implemented. | 448,343 |
def GC(seq): """Calculates G+C content, returns the percentage (float between 0 and 100). Copes mixed case seuqneces, and with the ambiguous nucleotide S (G or C) when counting the G and C content. The percentage is calculated against the full length, e.g.: >>> from Bio.SeqUtils import GC >>> GC("ACTGN") 40.0 Note ... | def GC(seq): """Calculates G+C content, returns the percentage (float between 0 and 100). Copes mixed case sequences, and with the ambiguous nucleotide S (G or C) when counting the G and C content. The percentage is calculated against the full length, e.g.: >>> from Bio.SeqUtils import GC >>> GC("ACTGN") 40.0 Note ... | 448,344 |
def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: start_end = identifier.split("/",1)[1] if start_end.count("-")==1: start, end = map(int, start_end.split("-")) name = identifier.split("/",1)[0] return (name, start, end) return (identifie... | def _identifier_split(self, identifier): """Returns (name,start,end) string tuple from an identier.""" if identifier.find("/")!=-1: start_end = identifier.rsplit("/",1)[1] if start_end.count("-")==1: start, end = map(int, start_end.split("-")) name = identifier.split("/",1)[0] return (name, start, end) return (identifi... | 448,345 |
def remove_population(self, pos, fname): """Removes a population (by position). | def remove_population(self, pos, fname): """Removes a population (by position). | 448,346 |
def remove_population(self, pos, fname): """Removes a population (by position). | def remove_population(self, pos, fname): """Removes a population (by position). | 448,347 |
def remove_population(self, pos, fname): """Removes a population (by position). | def remove_population(self, pos, fname): """Removes a population (by position). | 448,348 |
def _parse_clade(self, parent): """Parse a Clade node and its children, recursively.""" clade = PX.Clade(**parent.attrib) if clade.branch_length is not None: clade.branch_length = float(clade.branch_length) # NB: Only evaluate nodes at the current level tag_stack = [] for event, elem in self.context: namespace, tag = s... | def _parse_clade(self, parent): """Parse a Clade node and its children, recursively.""" clade = PX.Clade(**parent.attrib) if clade.branch_length is not None: clade.branch_length = float(clade.branch_length) # NB: Only evaluate nodes at the current level tag_stack = [] for event, elem in self.context: namespace, tag = s... | 448,349 |
def funct(fn,fmt1, fmt2, alpha): f = lambda x : x.simple_check(fn, fmt1, fmt2, alpha) f.__doc__ = "Convert %s from %s to %s" % (fn, fmt1, fmt2) return f | def funct(fn,fmt1, fmt2, alpha): f = lambda x : x.simple_check(fn, fmt1, fmt2, alpha) f.__doc__ = "Convert %s from %s to %s" % (fn, fmt1, fmt2) return f | 448,350 |
def _sff_do_slow_index(handle): """Generates an index by scanning though all the reads in an SFF file (PRIVATE). This is a slow but generic approach if we can't parse the provided index (if present). Will use the handle seek/tell functions. """ handle.seek(0) header_length, index_offset, index_length, number_of_reads... | def _sff_do_slow_index(handle): """Generates an index by scanning though all the reads in an SFF file (PRIVATE). This is a slow but generic approach if we can't parse the provided index (if present). Will use the handle seek/tell functions. """ handle.seek(0) header_length, index_offset, index_length, number_of_reads... | 448,351 |
def _sff_find_roche_index(handle): """Locate any existing Roche style XML meta data and read index (PRIVATE). Makes a number of hard coded assumptions based on reverse engineered SFF files from Roche 454 machines. Returns a tuple of read count, SFF "index" offset and size, XML offset and size, and the actual read ind... | def _sff_find_roche_index(handle): """Locate any existing Roche style XML meta data and read index (PRIVATE). Makes a number of hard coded assumptions based on reverse engineered SFF files from Roche 454 machines. Returns a tuple of read count, SFF "index" offset and size, XML offset and size, and the actual read ind... | 448,352 |
def _sff_read_roche_index(handle): """Reads any existing Roche style read index provided in the SFF file (PRIVATE). Will use the handle seek/tell functions. This works on ".srt1.00" and ".mft1.00" style Roche SFF index blocks. Roche SFF indices use base 255 not 256, meaning we see bytes in range the range 0 to 254 o... | def _sff_read_roche_index(handle): """Reads any existing Roche style read index provided in the SFF file (PRIVATE). Will use the handle seek/tell functions. This works on ".srt1.00" and ".mft1.00" style Roche SFF index blocks. Roche SFF indices use base 255 not 256, meaning we see bytes in range the range 0 to 254 o... | 448,353 |
def SffIterator(handle, alphabet=Alphabet.generic_dna, trim=False): """Iterate over Standard Flowgram Format (SFF) reads (as SeqRecord objects). handle - input file, an SFF file, e.g. from Roche 454 sequencing. This must NOT be opened in universal read lines mode! alphabet - optional alphabet, defaults to generic DNA.... | def SffIterator(handle, alphabet=Alphabet.generic_dna, trim=False): """Iterate over Standard Flowgram Format (SFF) reads (as SeqRecord objects). handle - input file, an SFF file, e.g. from Roche 454 sequencing. This must NOT be opened in universal read lines mode! alphabet - optional alphabet, defaults to generic DNA.... | 448,354 |
def SffIterator(handle, alphabet=Alphabet.generic_dna, trim=False): """Iterate over Standard Flowgram Format (SFF) reads (as SeqRecord objects). handle - input file, an SFF file, e.g. from Roche 454 sequencing. This must NOT be opened in universal read lines mode! alphabet - optional alphabet, defaults to generic DNA.... | def SffIterator(handle, alphabet=Alphabet.generic_dna, trim=False): """Iterate over Standard Flowgram Format (SFF) reads (as SeqRecord objects).handle - input file, an SFF file, e.g. from Roche 454 sequencing. This must NOT be opened in universal read lines mode! alphabet - optional alphabet, defaults to generic DNA. t... | 448,355 |
def write_record(self, record): """Write a single additional record to the output file. | def write_record(self, record): """Write a single additional record to the output file. | 448,356 |
def gcg(seq): """Returns the GCG checksum (int) for a sequence (string or Seq object). Given a nucleotide or amino-acid secuence (or any string), returns the GCG checksum (int). Checksum used by GCG program. seq type = str. Based on BioPerl GCG_checksum. Adapted by Sebastian Bassi with the help of John Lenton, Pablo Z... | def gcg(seq): """Returns the GCG checksum (int) for a sequence (string or Seq object). Given a nucleotide or amino-acid secuence (or any string), returns the GCG checksum (int). Checksum used by GCG program. seq type = str. Based on BioPerl GCG_checksum. Adapted by Sebastian Bassi with the help of John Lenton, Pablo Z... | 448,357 |
def seguid(seq): """Returns the SEGUID (string) for a sequence (string or Seq object). Given a nucleotide or amino-acid secuence (or any string), returns the SEGUID string (A SEquence Globally Unique IDentifier). seq type = str. For more information about SEGUID, see: http://bioinformatics.anl.gov/seguid/ DOI: 10.1002... | def seguid(seq): """Returns the SEGUID (string) for a sequence (string or Seq object). Given a nucleotide or amino-acid secuence (or any string), returns the SEGUID string (A SEquence Globally Unique IDentifier). seq type = str. For more information about SEGUID, see: http://bioinformatics.anl.gov/seguid/ DOI: 10.1002... | 448,358 |
def seguid(seq): """Returns the SEGUID (string) for a sequence (string or Seq object). Given a nucleotide or amino-acid secuence (or any string), returns the SEGUID string (A SEquence Globally Unique IDentifier). seq type = str. For more information about SEGUID, see: http://bioinformatics.anl.gov/seguid/ DOI: 10.1002... | def seq = seq.tostring() except AttributeError: pass m.update(seq.upper().encode()) try: return base64.encodebytes(m.digest()).decode().replace("\n","").rstrip("=") except AttributeError: pass try: seguid(seq): seq = seq.tostring() except AttributeError: pass m.update(seq.upper().encode()) try: return base64.encod... | 448,359 |
def test_get_alleles(self): """Test get alleles. """ self.assertEqual(self.ctrl.get_alleles(0,"Locus3"), [3, 20]) | def test_get_alleles(self): """Test get alleles. """ self.assertEqual(self.ctrl.get_alleles(0,"Locus3"), [3, 20]) | 448,360 |
def field_size(self, axis): size = {'x': 'width', 'y': 'height'}[axis] side = {'x': 'right', 'y': 'top'}[axis] values = getattr(self, 'get_%s_values' % axis)() max_d = self.data_max(axis) dx = float(max_d - values[-1]) / (values[-1] - values[-2]) graph_size = getattr(self, 'graph_%s' % size) side_font = getattr(self, '... | def field_size(self, axis): size = {'x': 'width', 'y': 'height'}[axis] side = {'x': 'right', 'y': 'top'}[axis] values = getattr(self, 'get_%s_values' % axis)() max_d = self.data_max(axis) dx = len(values) > 1 and float(max_d - values[-1]) / \ (values[-1] - values[-2]) or max_d graph_size = getattr(self, 'graph_%s' % si... | 448,361 |
def push_mark(self): lisp.push_mark() | def push_mark(self): lisp.push_mark() | 448,362 |
def testComment(self): pluginConf.request.setValue(True) # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.irc.takeMsg() se... | def testComment(self): pluginConf.request.setValue(True) # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.irc.takeMsg() se... | 448,363 |
def testPart(self): self.feedBan('troll!user@trollpit.net', mode='p') fetch = self.query("SELECT id,channel,mask,operator FROM bans") self.assertEqual((1, '#test', 'troll!user@trollpit.net', 'op'), fetch[0]) | def testPart(self): self.feedBan('troll!user@trollpit.net', mode='p') fetch = self.query("SELECT id,channel,mask,operator FROM bans") self.assertEqual((1, '#test', 'troll!user@trollpit.net', 'op'), fetch[0]) | 448,364 |
def getBans(chan): data = self.db_run("SELECT mask, removal FROM bans WHERE channel=%s", chan, expect_result=True) return [i[0] for i in data if i[1] == None and "!" in i[0]] | def getBans(chan): data = self.db_run("SELECT mask, removal FROM bans WHERE channel=%s", chan, expect_result=True) return [i[0] for i in data if i[1] == None and "!" in i[0]] | 448,365 |
def __init__(self, irc): self.__parent = super(Bantracker, self) self.__parent.__init__(irc) self.default_irc = irc self.lastMsgs = {} self.lastStates = {} self.replies = {} self.logs = {} self.nicks = {} self.hosts = {} self.bans = {} | def __init__(self, irc): self.__parent = super(Bantracker, self) self.__parent.__init__(irc) self.default_irc = irc self.lastMsgs = {} self.lastStates = {} self.replies = {} self.logs = {} self.nicks = {} self.hosts = {} self.bans = {} | 448,366 |
def die(self): global queue if self.db: try: self.db.close() except: pass try: self.thread_timer.cancel() except: pass queue.clear() try: schedule.removeEvent(self.name) except: pass | def die(self): global queue if self.db: try: self.db.close() except: pass try: self.thread_timer.cancel() except: pass queue.clear() try: schedule.removeEvent(self.name()) except: pass | 448,367 |
def reviewBans(self): try: self.log.debug('Checking for bans that need review ...') now = time.mktime(time.gmtime()) lastreview = self.registryValue('reviewTime') reviewAfterTime = self.registryValue('reviewAfterTime') * 60 # time in mins if not lastreview: # initialize last time reviewed timestamp lastreview = now - r... | def reviewBans(self): try: self.log.debug('Checking for bans that need review ...') now = time.mktime(time.gmtime()) lastreview = self.registryValue('reviewTime') reviewAfterTime = self.registryValue('reviewAfterTime') * 60 # time in mins if not lastreview: # initialize last time reviewed timestamp lastreview = now - r... | 448,368 |
def db_run(self, query, parms, expect_result = False, expect_id = False): if not self.db: self.log.error("Bantracker database not open") return n_tries = 0 try: cur = self.db.cursor() cur.execute(query, parms) except: cur = None if n_tries > 5: print "Tried more than 5 times, aborting" raise n_tries += 1 time.sleep(1) ... | def db_run(self, query, parms, expect_result = False, expect_id = False): if not self.db: self.log.error("Bantracker database not open") return try: cur = self.db.cursor() cur.execute(query, parms) except: cur = None if n_tries > 5: print "Tried more than 5 times, aborting" raise n_tries += 1 time.sleep(1) data = None ... | 448,369 |
def db_run(self, query, parms, expect_result = False, expect_id = False): if not self.db: self.log.error("Bantracker database not open") return n_tries = 0 try: cur = self.db.cursor() cur.execute(query, parms) except: cur = None if n_tries > 5: print "Tried more than 5 times, aborting" raise n_tries += 1 time.sleep(1) ... | def db_run(self, query, parms, expect_result = False, expect_id = False): if not self.db: self.log.error("Bantracker database not open") return n_tries = 0 try: cur = self.db.cursor() cur.execute(query, parms) except: self.log.error("Error while trying to access the Bantracker database.") return None data = None if exp... | 448,370 |
def setUp(self): super(BantrackerTestCase, self).setUp() self.setDb() pluginConf.commentRequest.ignore.set('*') # disable comments | def setUp(self): super(BantrackerTestCase, self).setUp() self.setDb() pluginConf.request.ignore.set('*') pluginConf.request.forward.set('') # disable comments | 448,371 |
def testCommentRequest(self): pluginConf.commentRequest.ignore.set('') # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.ir... | def testCommentRequest(self): pluginConf.request.ignore.set('') # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.irc.takeM... | 448,372 |
def testCommentRequest(self): pluginConf.commentRequest.ignore.set('') # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.ir... | def testCommentRequest(self): pluginConf.commentRequest.ignore.set('') # test bans self.feedBan('asd!*@*') msg = self.irc.takeMsg() self.assertEqual(str(msg).strip(), "PRIVMSG op :Please comment on the ban of asd!*@* in #test, use: @comment 1" " <comment>") # test quiets self.feedBan('dude!*@*', mode='q') msg = self.ir... | 448,373 |
def testReviewResquest(self): pluginConf.commentRequest.ignore.set('') cb = self.getCallback() self.feedBan('asd!*@*') self.irc.takeMsg() # ignore comment request comment pluginConf.reviewAfterTime.setValue(1.0/84600) # one second cb.reviewBans() self.assertFalse(cb.pendingReviews) print 'waiting 4 secs..' time.sleep(2... | def testReviewResquest(self): pluginConf.commentRequest.ignore.set('') cb = self.getCallback() self.feedBan('asd!*@*') self.irc.takeMsg() # ignore comment request comment pluginConf.request.review.setValue(1.0/86400) # one second cb.reviewBans() self.assertFalse(cb.pendingReviews) print 'waiting 4 secs..' time.sleep(2)... | 448,374 |
def testQuiet(self): self.feedBan('asd!*@*', mode='q') fetch = self.query("SELECT id,channel,mask,operator FROM bans") self.assertEqual((1, '#test', '%asd!*@*', 'op'), fetch[0]) | def testQuiet(self): self.feedBan('asd!*@*', mode='q') fetch = self.query("SELECT id,channel,mask,operator FROM bans") self.assertEqual((1, '#test', '%asd!*@*', 'op'), fetch[0]) | 448,375 |
def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) | 448,376 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.request.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.request.review._default)) | 448,377 |
def doMode(self, irc, msg): channel = msg.args[0] if irc.isChannel(channel) and msg.args[1:]: self.doLog(irc, channel, '*** %s sets mode: %s %s\n' % (msg.nick or msg.prefix, msg.args[1], ' '.join(msg.args[2:]))) modes = ircutils.separateModes(msg.args[1:]) for param in modes: realname = '' mode = param[0] mask = '' com... | def doMode(self, irc, msg): channel = msg.args[0] if irc.isChannel(channel) and msg.args[1:]: self.doLog(irc, channel, '*** %s sets mode: %s %s\n' % (msg.nick or msg.prefix, msg.args[1], ' '.join(msg.args[2:]))) modes = ircutils.separateModes(msg.args[1:]) for param in modes: realname = '' mode = param[0] mask = '' com... | 448,378 |
def _banreviewfix(self): # FIXME workaround until proper fix is done. bag = set() nodups = set() n = 0 for host, reviews in self.pendingReviews.iteritems(): n += len(reviews) for nick, msg in reviews: if nick == 'Automated-Addition': continue chan, m = msg.args[0], msg.args[1] s = m.rpartition(' ')[0] #remove the url i... | def _banreviewfix(self): # FIXME workaround until proper fix is done. bag = set() nodups = set() for host, reviews in self.pendingReviews.iteritems(): n += len(reviews) for nick, msg in reviews: if nick == 'Automated-Addition': continue chan, m = msg.args[0], msg.args[1] s = m.rpartition(' ')[0] #remove the url if (nic... | 448,379 |
def _banreviewfix(self): # FIXME workaround until proper fix is done. bag = set() nodups = set() n = 0 for host, reviews in self.pendingReviews.iteritems(): n += len(reviews) for nick, msg in reviews: if nick == 'Automated-Addition': continue chan, m = msg.args[0], msg.args[1] s = m.rpartition(' ')[0] #remove the url i... | def _banreviewfix(self): # FIXME workaround until proper fix is done. bag = set() nodups = set() n = 0 for host, reviews in self.pendingReviews.iteritems(): for nick, msg in reviews: if nick == 'Automated-Addition': continue chan, m = msg.args[0], msg.args[1] s = m.rpartition(' ')[0] #remove the url if (nick, chan, s) ... | 448,380 |
def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') != 1 or pattern.count('@') != 1: return False if pattern.count('$') == 1: pattern = pattern[:pattern.rfind('$')] if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') != 1 or pattern.count('@') != 1: return False if pattern.count('$') == 1: pattern = pattern.split('$',1)[0] if pattern.startswith('%'): pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | 448,381 |
def setUp(self): super(BantrackerTestCase, self).setUp() pluginConf.request.setValue(False) # disable comments pluginConf.request.ignore.set('') pluginConf.request.forward.set('') pluginConf.request.review.setValue(1.0/86400) # one second self.setDb() # Bantracker for some reason doesn't use Supybot's own methods for c... | def setUp(self): super(BantrackerTestCase, self).setUp() pluginConf.request.setValue(False) # disable comments pluginConf.request.ignore.set('') pluginConf.request.forward.set('') pluginConf.request.review.setValue(1.0/86400) # one second # Bantracker for some reason doesn't use Supybot's own methods for check capabili... | 448,382 |
def nickMatch(nick, pattern): """Checks if a given nick matches a pattern or in a list of patterns.""" if isinstance(pattern, str): pattern = [pattern] nick = nick.lower() for s in pattern: if fnmatch(nick, s): return True return False | def nickMatch(nick, pattern): """Checks if a given nick matches a pattern or in a list of patterns.""" if isinstance(pattern, str): pattern = [pattern] nick = nick.lower() for s in pattern: if fnmatch(nick, s.lower()): return True return False | 448,383 |
def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') != 1 or pattern.count('@') != 1: return False if pattern.count('$') == 1: pattern = "$".join(pattern.split('$')[:-1]) if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') != 1 or pattern.count('@') != 1: return False if pattern.count('$') == 1: pattern = pattern[:pattern.rfind('$')] if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | 448,384 |
def check_auth(self, irc, msg, args, cap='bantracker'): hasIRCLogin = False for cb in self.callPrecedence(irc)[0]: if cb.name() == "IRCLogin": hasIRCLogin = True if hasIRCLogin and not msg.tagged('identified'): irc.error(conf.supybot.replies.incorrectAuthentication()) return False try: user = ircdb.users.getUser(msg.pr... | def check_auth(self, irc, msg, args, cap='bantracker'): hasIRCLogin = False for cb in self.callPrecedence(irc)[0]: if cb.name() == "IRCLogin": hasIRCLogin = True if hasIRCLogin and not msg.tagged('identified'): irc.error(conf.supybot.replies.incorrectAuthentication()) return False try: user = ircdb.users.getUser(msg.pr... | 448,385 |
def configure(advanced): from supybot.question import yn, something, output import sqlite import re import os from supybot.utils.str import format def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) conf.registerPlugin(... | def configure(advanced): from supybot.questions import yn, something, output import sqlite import re import os from supybot.utils.str import format def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) conf.registerPlugin... | 448,386 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,387 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,388 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,389 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,390 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,391 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,392 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,393 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,394 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,395 |
def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | def getReviewTime(): output("How many days should the bot wait before requesting a ban/quiet review?") review = something("Can be an integer or decimal value. Zero disables reviews.", default=str(Bantracker.review._default)) | 448,396 |
def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') not in (1, 2) or pattern.count('@') != 1: return False if pattern.count('!') == 2: pattern = "!".join(pattern.split('!')[:-1]) if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') != 1 or pattern.count('@') != 1: return False if pattern.count('!') == 2: pattern = "!".join(pattern.split('!')[:-1]) if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | 448,397 |
def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') not in (1, 2) or pattern.count('@') != 1: return False if pattern.count('!') == 2: pattern = "!".join(pattern.split('!')[:-1]) if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | def hostmaskPatternEqual(pattern, hostmask): if pattern.count('!') not in (1, 2) or pattern.count('@') != 1: return False if pattern.count('$') == 1: pattern = "$".join(pattern.split('$')[:-1]) if pattern[0] == '%': pattern = pattern[1:] return ircutils.hostmaskPatternEqual(pattern, hostmask) | 448,398 |
def doPart(self, irc, msg): for channel in msg.args[0].split(','): self.doLog(irc, channel, '*** %s (%s) has left %s (%s)\n' % (msg.nick, msg.prefix, channel, len(msg.args) > 1 and msg.args[1] or '')) if len(msg.args) > 1 and msg.args[1].startswith('requested by'): args = msg.args[1].split() self.doKickban(irc, channel... | def doPart(self, irc, msg): for channel in msg.args[0].split(','): self.doLog(irc, channel, '*** %s (%s) has left %s (%s)\n' % (msg.nick, msg.prefix, channel, len(msg.args) > 1 and msg.args[1] or '')) if len(msg.args) > 1 and msg.args[1].startswith('requested by'): args = msg.args[1].split() self.doKickban(irc, channel... | 448,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.