sequence stringlengths 546 16.2k | code stringlengths 108 19.3k |
|---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:databasesKEGG; 3, parameters; 3, 4; 3, 5; 4, identifier:organism; 5, identifier:ens_ids; 6, block; 6, 7; 6, 9; 6, 22; 6, 31; 6, 35; 6, 173; 6, 184; 6, 195; 6, 212; 6, 221; 6, 283; 7, expression_statement; 7, 8; 8, comment; 9, expression_stateme... | def databasesKEGG(organism,ens_ids):
"""
Finds KEGG database identifiers for a respective organism given example ensembl ids.
:param organism: an organism as listed in organismsKEGG()
:param ens_ids: a list of ensenbl ids of the respective organism
:returns: nothing if no database was found, or a... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:process; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:form; 6, identifier:post; 7, block; 7, 8; 7, 10; 7, 23; 7, 32; 7, 38; 7, 448; 7, 449; 7, 450; 7, 472; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 1... | def process(self, form, post):
""" Process the given WTForm Form object.
Itterate over the POST values and check each field
against the configuration that was made.
For each field that is valid, check all the validator
parameters for possible %field% replacement, then bind
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:distinct_values; 3, parameters; 3, 4; 3, 5; 4, identifier:t_old; 5, identifier:t_new; 6, block; 6, 7; 6, 9; 6, 13; 6, 21; 6, 125; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, ide... | def distinct_values(t_old, t_new):
"""
for all columns, check which values are not in
the other table
"""
res = []
res.append([' -- NOT IN check -- '])
for new_col in t_new.header:
dist_new = t_new.get_distinct_values_from_cols([new_col])
#print('NEW Distinct values for '... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:most_similar_catchments; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:self; 5, identifier:subject_catchment; 6, identifier:similarity_dist_function; 7, default_parameter; 7, 8; 7, 9; 8, identifier:records_limit; 9, integer:500; ... | def most_similar_catchments(self, subject_catchment, similarity_dist_function, records_limit=500,
include_subject_catchment='auto'):
"""
Return a list of catchments sorted by hydrological similarity defined by `similarity_distance_function`
:param subject_catchme... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:readSAM; 3, parameters; 3, 4; 3, 5; 4, identifier:SAMfile; 5, default_parameter; 5, 6; 5, 7; 6, identifier:header; 7, False; 8, block; 8, 9; 8, 11; 8, 59; 8, 77; 8, 99; 8, 113; 8, 119; 8, 129; 8, 141; 8, 151; 8, 207; 8, 224; 9, expression_state... | def readSAM(SAMfile,header=False):
"""
Reads and parses a sam file.
:param SAMfile: /path/to/file.sam
:param header: logical, if True, reads the header information
:returns: a pandas dataframe with the respective SAM columns: 'QNAME','FLAG','RNAME','POS','MAPQ','CIGAR','RNEXT','PNEXT','TLEN','SEQ'... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:SAMflags; 3, parameters; 3, 4; 4, identifier:x; 5, block; 5, 6; 5, 8; 5, 12; 5, 27; 5, 34; 5, 49; 5, 56; 5, 71; 5, 78; 5, 93; 5, 100; 5, 115; 5, 122; 5, 137; 5, 144; 5, 159; 5, 166; 5, 181; 5, 188; 5, 203; 5, 210; 5, 225; 5, 232; 5, 247; 5, 254... | def SAMflags(x):
"""
Explains a SAM flag.
:param x: flag
:returns: complete SAM flag explanaition
"""
flags=[]
if x & 1:
l="1: Read paired"
else:
l="0: Read unpaired"
flags.append(l)
if x & 2 :
l="1: Read mapped in proper pair"
else:
l="0: ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 74; 2, function_name:BLASTquery; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 11; 3, 14; 3, 17; 3, 18; 3, 21; 3, 24; 3, 25; 3, 28; 3, 31; 3, 32; 3, 35; 3, 38; 3, 39; 3, 42; 3, 43; 3, 46; 3, 49; 3, 50; 3, 53; 3, 56; 3, 57; 3, 60; 3, 63; 3, 64; 3, 67; 3, 70; 3, ... | def BLASTquery(query,database,program,filter=None,\
format_type=None, expect=None,\
nucl_reward=None, nucl_penalty=None,\
gapcosts=None, matrix=None,\
hitlist_size=None, descriptions=None,\
alignments=None,\
ncbi_gi=None, threshol... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:run_star; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:fastqs; 6, identifier:univ_options; 7, identifier:star_options; 8, block; 8, 9; 8, 11; 8, 19; 8, 27; 8, 46; 8, 58; 8, 59; 8, 71; 8, 102; 8, 103; 8, 115; 8, 116; 8... | def run_star(job, fastqs, univ_options, star_options):
"""
Align a pair of fastqs with STAR.
:param list fastqs: The input fastqs for alignment
:param dict univ_options: Dict of universal options used by almost all tools
:param dict star_options: Options specific to star
:return: Dict containin... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sort_and_index_star; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:star_bams; 6, identifier:univ_options; 7, identifier:star_options; 8, block; 8, 9; 8, 11; 8, 21; 8, 49; 8, 84; 8, 91; 8, 98; 9, expression_statement; 9... | def sort_and_index_star(job, star_bams, univ_options, star_options):
"""
A wrapper for sorting and indexing the genomic star bam generated by run_star. It is required
since run_star returns a dict of 2 bams
:param dict star_bams: The bams from run_star
:param dict univ_options: Dict of universal op... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:evaluate; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 17; 5, 21; 5, 74; 5, 75; 5, 92; 5, 93; 5, 97; 5, 204; 5, 217; 5, 225; 5, 226; 5, 243; 6, expression_statement; 6, 7; 7, comment; 8, co... | def evaluate(self):
""" Converts the current expression into a single matcher, applying
coordination operators to operands according to their binding rules
"""
# Apply Shunting Yard algorithm to convert the infix expression
# into Reverse Polish Notation. Since we have a ver... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_ensure_patient_group_is_ok; 3, parameters; 3, 4; 3, 5; 4, identifier:patient_object; 5, default_parameter; 5, 6; 5, 7; 6, identifier:patient_name; 7, None; 8, block; 8, 9; 8, 11; 8, 18; 8, 31; 8, 32; 8, 39; 8, 73; 9, expression_statement; 9, 1... | def _ensure_patient_group_is_ok(patient_object, patient_name=None):
"""
Ensure that the provided entries for the patient groups is formatted properly.
:param set|dict patient_object: The values passed to the samples patient group
:param str patient_name: Optional name for the set
:raises ParameterE... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_add_default_entries; 3, parameters; 3, 4; 3, 5; 4, identifier:input_dict; 5, identifier:defaults_dict; 6, block; 6, 7; 6, 9; 6, 99; 7, expression_statement; 7, 8; 8, comment; 9, for_statement; 9, 10; 9, 13; 9, 18; 10, pattern_list; 10, 11; 10,... | def _add_default_entries(input_dict, defaults_dict):
"""
Add the entries in defaults dict into input_dict if they don't exist in input_dict
This is based on the accepted answer at
http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
:param dict input_dict... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:main; 3, parameters; 4, block; 4, 5; 4, 7; 4, 26; 4, 37; 4, 58; 4, 80; 4, 107; 4, 108; 4, 109; 4, 110; 4, 111; 4, 121; 4, 256; 5, expression_statement; 5, 6; 6, comment; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:p... | def main():
"""
This is the main function for ProTECT.
"""
parser = argparse.ArgumentParser(prog='ProTECT',
description='Prediction of T-Cell Epitopes for Cancer Therapy',
epilog='Contact Arjun Rao (aarao@ucsc.edu) if you encounte... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:align_dna; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:job; 5, identifier:fastqs; 6, identifier:sample_type; 7, identifier:univ_options; 8, identifier:bwa_options; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 15; 9, 48; 9, 83; 9, 84;... | def align_dna(job, fastqs, sample_type, univ_options, bwa_options):
"""
A wrapper for the entire dna alignment subgraph.
:param list fastqs: The input fastqs for alignment
:param str sample_type: Description of the sample to inject into the filename
:param dict univ_options: Dict of universal optio... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:create; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:entry; 6, block; 6, 7; 6, 9; 6, 10; 6, 85; 6, 86; 6, 87; 6, 94; 6, 120; 6, 121; 6, 122; 6, 137; 6, 138; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, try_statement... | def create(cls, entry):
"""
Factory that creates an bot config from an entry in INSTALLED_APPS.
"""
# trading_bots.example.bot.ExampleBot
try:
# If import_module succeeds, entry is a path to a bot module,
# which may specify a bot class with a default_bot ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:populate; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:installed_bots; 7, None; 8, block; 8, 9; 8, 11; 8, 17; 8, 18; 8, 19; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12;... | def populate(self, installed_bots=None):
"""
Load bots.
Import each bot module.
It is thread-safe and idempotent, but not re-entrant.
"""
if self.ready:
return
# populate() might be called by two threads in parallel on servers
# that create th... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:get_initkwargs; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 17; 4, identifier:cls; 5, identifier:form_list; 6, default_parameter; 6, 7; 6, 8; 7, identifier:initial_dict; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:i... | def get_initkwargs(cls, form_list, initial_dict=None,
instance_dict=None, condition_dict=None, *args, **kwargs):
"""
Creates a dict with all needed parameters for the form wizard instances.
* `form_list` - is a list of forms. The list entries can be single form
classes or tupl... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:post; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 15; 9, 29; 9, 91; 9, 92; 9, 108; 9, 12... | def post(self, *args, **kwargs):
"""
This method handles POST requests.
The wizard will render either the current step (if form validation
wasn't successful), the next step (if the current step was stored
successful) or the done view (if no more steps are available)
"""
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:parse_config_file; 3, parameters; 3, 4; 3, 5; 4, identifier:job; 5, identifier:config_file; 6, block; 6, 7; 6, 9; 6, 18; 6, 29; 6, 47; 6, 48; 6, 54; 6, 60; 6, 66; 6, 67; 6, 246; 6, 247; 6, 262; 6, 263; 6, 279; 6, 299; 6, 300; 6, 320; 7, express... | def parse_config_file(job, config_file):
"""
This module will parse the config file withing params and set up the variables that will be
passed to the various tools in the pipeline.
ARGUMENTS
config_file: string containing path to a config file. An example config
file is available... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:run_star; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:fastqs; 6, identifier:univ_options; 7, identifier:star_options; 8, block; 8, 9; 8, 11; 8, 19; 8, 32; 8, 42; 8, 61; 8, 73; 8, 110; 8, 155; 8, 161; 8, 187; 8, 198; ... | def run_star(job, fastqs, univ_options, star_options):
"""
This module uses STAR to align the RNA fastqs to the reference
ARGUMENTS
1. fastqs: REFER RETURN VALUE of run_cutadapt()
2. univ_options: Dict of universal arguments used by almost all tools
univ_options
+- 'dockerhub... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:run_bwa; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:job; 5, identifier:fastqs; 6, identifier:sample_type; 7, identifier:univ_options; 8, identifier:bwa_options; 9, block; 9, 10; 9, 12; 9, 27; 9, 37; 9, 46; 9, 73; 9, 85; 9, 116; ... | def run_bwa(job, fastqs, sample_type, univ_options, bwa_options):
"""
This module aligns the SAMPLE_TYPE dna fastqs to the reference
ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor'/'normal'
1. fastqs: Dict of list of input WGS/WXS fastqs
fastqs
+- '<ST>_dna': [... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:merge_radia; 3, parameters; 3, 4; 3, 5; 4, identifier:job; 5, identifier:perchrom_rvs; 6, block; 6, 7; 6, 9; 6, 18; 6, 28; 6, 29; 6, 30; 6, 53; 6, 65; 6, 91; 6, 240; 6, 241; 6, 278; 6, 284; 6, 314; 7, expression_statement; 7, 8; 8, comment; 9, ... | def merge_radia(job, perchrom_rvs):
"""
This module will merge the per-chromosome radia files created by spawn_radia into a genome vcf.
It will make 2 vcfs, one for PASSing non-germline calls, and one for all calls.
ARGUMENTS
1. perchrom_rvs: REFER RETURN VALUE of spawn_radia()
RETURN VALUES
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:merge_mutect; 3, parameters; 3, 4; 3, 5; 4, identifier:job; 5, identifier:perchrom_rvs; 6, block; 6, 7; 6, 9; 6, 18; 6, 28; 6, 29; 6, 30; 6, 53; 6, 65; 6, 91; 6, 336; 6, 349; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9... | def merge_mutect(job, perchrom_rvs):
"""
This module will merge the per-chromosome mutect files created by spawn_mutect into a genome
vcf. It will make 2 vcfs, one for PASSing non-germline calls, and one for all calls.
ARGUMENTS
1. perchrom_rvs: REFER RETURN VALUE of spawn_mutect()
RETURN VAL... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:run_mutation_aggregator; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:job; 5, identifier:fusion_output; 6, identifier:radia_output; 7, identifier:mutect_output; 8, identifier:indel_output; 9, identifier:univ_options; 10, bl... | def run_mutation_aggregator(job, fusion_output, radia_output, mutect_output, indel_output,
univ_options):
"""
This module will aggregate all the mutations called in the previous steps and will then call
snpeff on the results.
ARGUMENTS
1. fusion_output: <JSid for vcf gen... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:merge_phlat_calls; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:tumor_phlat; 6, identifier:normal_phlat; 7, identifier:rna_phlat; 8, block; 8, 9; 8, 11; 8, 20; 8, 30; 8, 43; 8, 52; 8, 134; 8, 135; 8, 289; 8, 295; 8, 3... | def merge_phlat_calls(job, tumor_phlat, normal_phlat, rna_phlat):
"""
This module will merge the results form running PHLAT on the 3 input fastq
pairs.
ARGUMENTS
1. tumor_phlat: <JSid for tumor DNA called alleles>
2. normal_phlat: <JSid for normal DNA called alleles>
3. rna_phlat: <JSid for... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:docker_call; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:tool; 5, identifier:tool_parameters; 6, identifier:work_dir; 7, default_parameter; 7, 8; 7, 9; 8, identifier:java_opts; 9, None; 10, default_parameter; 10, ... | def docker_call(tool, tool_parameters, work_dir, java_opts=None, outfile=None,
dockerhub='aarjunrao', interactive=False):
"""
Makes subprocess call of a command to a docker container. work_dir MUST BE AN ABSOLUTE PATH or
the call will fail. outfile is an open file descriptor to a writeable ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_file_from_gdc; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:gdc_url; 6, identifier:gdc_download_token; 7, default_parameter; 7, 8; 7, 9; 8, identifier:write_to_jobstore; 9, True; 10, block; 10, 11; 10, 13; 10, 23... | def get_file_from_gdc(job, gdc_url, gdc_download_token, write_to_jobstore=True):
"""
Download a supplied "URL" that points to a file in the NCBI GDC database. The path to the gdc
download token must be provided. The file is downloaded and written to the jobstore if
requested.
:param str gdc_url: ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:make_key_hippie; 3, parameters; 3, 4; 3, 5; 4, identifier:obj; 5, default_parameter; 5, 6; 5, 7; 6, identifier:typed; 7, True; 8, block; 8, 9; 8, 11; 8, 21; 8, 36; 8, 37; 8, 38; 8, 52; 8, 73; 8, 108; 9, expression_statement; 9, 10; 10, comment;... | def make_key_hippie(obj, typed=True):
"""Return hashable structure from non-hashable structure using hippie means
dict and set are sorted and their content subjected to same hippie means.
Note that the key identifies the current content of the structure.
"""
ftype = type if typed else lambda o: N... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:run_radia; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:job; 5, identifier:rna_bam; 6, identifier:tumor_bam; 7, identifier:normal_bam; 8, identifier:univ_options; 9, identifier:radia_options; 10, block; 10, 11; 10, 13; 10, ... | def run_radia(job, rna_bam, tumor_bam, normal_bam, univ_options, radia_options):
"""
Spawn a RADIA job for each chromosome on the input bam trios.
:param dict rna_bam: Dict of bam and bai for tumor DNA-Seq. It can be one of two formats
rna_bam: # Just the genomic bam and bai
|... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort_bamfile; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:job; 5, identifier:bamfile; 6, identifier:sample_type; 7, identifier:univ_options; 8, identifier:samtools_options; 9, block; 9, 10; 9, 12; 9, 20; 9, 31; 9, 42; 9, 49; 9, 6... | def sort_bamfile(job, bamfile, sample_type, univ_options, samtools_options):
"""
Sort `bamfile` using samtools
:param toil.fileStore.FileID bamfile: fsID for the bam file
:param str sample_type: Description of the sample to inject into the filename
:param dict univ_options: Dict of universal option... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:recursive_sort; 3, parameters; 3, 4; 4, identifier:data_structure; 5, block; 5, 6; 5, 8; 5, 9; 5, 185; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, if_statement; 9, 10; 9, 16; 10, not_operator; 10, 11; 11, call; 11, 12; 11, 13; 12,... | def recursive_sort(data_structure):
"""Sort a recursive data_structure.
:param data_structure: The structure to convert.
data_structure must be already sortable or you must use freeze() or dump().
The function will work with many kinds of input. Dictionaries will be
converted to lists of tuples.... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:tree_diff; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:a; 5, identifier:b; 6, default_parameter; 6, 7; 6, 8; 7, identifier:n; 8, integer:5; 9, default_parameter; 9, 10; 9, 11; 10, identifier:sort; 11, False; 12, block; 12, 13; 12, 15;... | def tree_diff(a, b, n=5, sort=False):
"""Dump any data-structure or object, traverse
it depth-first in-order and apply a unified diff.
Depth-first in-order is just like structure would be printed.
:param a: data_structure a
:param b: data_structure b
:param ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:merge_perchrom_mutations; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:job; 5, identifier:chrom; 6, identifier:mutations; 7, identifier:univ_options; 8, block; 8, 9; 8, 11; 8, 19; 8, 26; 8, 33; 8, 40; 8, 47; 8, 54; 8, 61; 8, 71; 8, 81; ... | def merge_perchrom_mutations(job, chrom, mutations, univ_options):
"""
Merge the mutation calls for a single chromosome.
:param str chrom: Chromosome to process
:param dict mutations: dict of dicts of the various mutation caller names as keys, and a dict of
per chromosome job store ids for v... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:check; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:domain; 5, identifier:prefix; 6, identifier:code; 7, default_parameter; 7, 8; 7, 9; 8, identifier:strategies; 9, string:'*'; 10, block; 10, 11; 10, 13; 10, 32; 10, 51; 10, 70; 10, 89;... | def check(domain, prefix, code, strategies='*'):
"""
Check the ownership of a domain by going thru a serie of strategies.
If at least one strategy succeed, the domain is considered verified,
and this methods returns true.
The prefix is a fixed DNS safe string like "yourservice-domain-verification"
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:register_cache_buster; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:app; 6, default_parameter; 6, 7; 6, 8; 7, identifier:config; 8, None; 9, block; 9, 10; 9, 12; 9, 30; 9, 34; 9, 35; 9, 39; 9, 40; 9, 41; 9, 50; 9, 51; 9, 1... | def register_cache_buster(self, app, config=None):
"""
Register `app` in cache buster so that `url_for` adds a unique prefix
to URLs generated for the `'static'` endpoint. Also make the app able
to serve cache-busted static files.
This allows setting long cache expiration values... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:parse_inventory; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:inventory_output; 6, None; 7, block; 7, 8; 7, 10; 7, 29; 7, 36; 7, 37; 7, 41; 7, 45; 7, 103; 7, 116; 7, 135; 7, 148; 7, 167; 7, 180; 7, 194; 7, 207; 7, 221; 7... | def parse_inventory(inventory_output=None):
"""Parse the inventory text and return udi dict."""
udi = {
"name": "",
"description": "",
"pid": "",
"vid": "",
"sn": ""
}
if inventory_output is None:
return udi
# find the record with chassis text in name... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:yaml_file_to_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:script_name; 5, default_parameter; 5, 6; 5, 7; 6, identifier:path; 7, None; 8, block; 8, 9; 8, 11; 8, 50; 8, 108; 8, 124; 8, 138; 8, 159; 8, 166; 8, 195; 8, 218; 8, 246; 9, expression_... | def yaml_file_to_dict(script_name, path=None):
"""Read yaml file and return the dict.
It assumes the module file exists with the defaults.
If the CONDOOR_{SCRIPT_NAME} env is set then the user file from the env is loaded and merged with the default
There can be user file located in ~/.condoor director... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:make_hop_info_from_url; 3, parameters; 3, 4; 3, 5; 4, identifier:url; 5, default_parameter; 5, 6; 5, 7; 6, identifier:verify_reachability; 7, None; 8, block; 8, 9; 8, 11; 8, 18; 8, 34; 8, 35; 8, 51; 8, 52; 8, 74; 8, 95; 8, 104; 9, expression_st... | def make_hop_info_from_url(url, verify_reachability=None):
"""Build HopInfo object from url.
It allows only telnet and ssh as a valid protocols.
Args:
url (str): The url string describing the node. i.e.
telnet://username@1.1.1.1. The protocol, username and address
portion o... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:sendmail; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 4, identifier:self; 5, identifier:sender; 6, identifier:recipients; 7, identifier:message; 8, default_parameter; 8, 9; 8, 10; 9, identifier:mail_options; 10, None; 11, default_param... | async def sendmail(
self, sender, recipients, message, mail_options=None, rcpt_options=None
):
"""
Performs an entire e-mail transaction.
Example:
>>> try:
>>> with SMTP() as client:
>>> try:
>>> r = client.sen... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:run_fsm; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:self; 5, identifier:name; 6, identifier:command; 7, identifier:events; 8, identifier:transitions; 9, identifier:timeout; 10, default_parameter; 10, 11; 10, 12; 11... | def run_fsm(self, name, command, events, transitions, timeout, max_transitions=20):
"""Instantiate and run the Finite State Machine for the current device connection.
Here is the example of usage::
test_dir = "rw_test"
dir = "disk0:" + test_dir
REMOVE_DIR = re.compi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_get_view_details; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:urlpatterns; 6, default_parameter; 6, 7; 6, 8; 7, identifier:parent; 8, string:''; 9, block; 9, 10; 9, 12; 10, expression_statement; 10, 11; 11, comment; 12, ... | def _get_view_details(self, urlpatterns, parent=''):
"""Recursive function to extract all url details"""
for pattern in urlpatterns:
if isinstance(pattern, (URLPattern, RegexURLPattern)):
try:
d = describe_pattern(pattern)
docstr = patt... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:scan_module; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:modpath; 6, identifier:node; 7, block; 7, 8; 7, 10; 7, 24; 7, 93; 7, 190; 7, 238; 7, 269; 7, 275; 7, 281; 7, 321; 8, expression_statement; 8, 9; 9, comment; 10, exp... | def scan_module(self, modpath, node):
"""Scans a module, collecting all used origins, assuming that modules
are obtained only by dotted paths and no other kinds of expressions."""
used_origins = self.map.setdefault(modpath, set())
def get_origins(modpath, name):
"""Returns ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:operations; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:op_types; 7, None; 8, block; 8, 9; 8, 11; 8, 24; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12; 11, 14; 12, not_o... | def operations(self, op_types=None):
"""Process operation stream."""
if not op_types:
op_types = ['message', 'action', 'sync', 'viewlock', 'savedchapter']
while self._handle.tell() < self._eof:
current_time = mgz.util.convert_to_timestamp(self._time / 1000)
tr... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:run; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 22; 5, 26; 5, 32; 5, 46; 5, 405; 5, 406; 5, 413; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:ctx; 1... | def run(self):
"""Start the FSM.
Returns:
boolean: True if FSM reaches the last state or false if the exception or error message was raised
"""
ctx = FSM.Context(self.name, self.device)
transition_counter = 0
timeout = self.timeout
self.log("{} Start... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:build; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:port; 6, integer:8000; 7, default_parameter; 7, 8; 7, 9; 8, identifier:fixtures; 9, None; 10, block; 10, 11; 10, 13; 10, 19; 10, 29; 10, 35; 10, 41; 10, 48; 10, ... | def build(port=8000, fixtures=None):
"""
Builds a server file.
1. Extract mock response details from all valid docstrings in existing views
2. Parse and generate mock values
3. Create a store of all endpoints and data
4. Construct server file
"""
extractor = Extractor()
parser = Par... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:gpg_decrypt; 3, parameters; 3, 4; 3, 5; 4, identifier:cfg; 5, default_parameter; 5, 6; 5, 7; 6, identifier:gpg_config; 7, None; 8, block; 8, 9; 8, 11; 8, 221; 8, 308; 9, expression_statement; 9, 10; 10, comment; 11, function_definition; 11, 12;... | def gpg_decrypt(cfg, gpg_config=None):
"""Decrypt GPG objects in configuration.
Args:
cfg (dict): configuration dictionary
gpg_config (dict): gpg configuration
dict of arguments for gpg including:
homedir, binary, and keyring (require all if any)
example:... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_teams; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 5, 25; 5, 194; 5, 202; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, subscript; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, iden... | def get_teams(self):
"""Get teams."""
if self._cache['teams']:
return self._cache['teams']
teams = []
for j, player in enumerate(self._header.initial.players):
added = False
for i in range(0, len(self._header.initial.players)):
if playe... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_settings; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:postgame; 11, call; 11, 12; 11, 15; 12, at... | def get_settings(self):
"""Get settings."""
postgame = self.get_postgame()
return {
'type': (
self._header.lobby.game_type_id,
self._header.lobby.game_type
),
'difficulty': (
self._header.scenario.game_settings.d... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_map; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 5, 33; 5, 45; 5, 64; 5, 74; 5, 78; 5, 82; 5, 86; 5, 90; 5, 91; 5, 169; 5, 170; 5, 209; 5, 217; 5, 225; 5, 226; 5, 259; 5, 260; 5, 270; 5, 274; 5, 289; 5, 290; 5, 299... | def get_map(self):
"""Get the map metadata."""
if self._cache['map']:
return self._cache['map']
map_id = self._header.scenario.game_settings.map_id
instructions = self._header.scenario.messages.instructions
size = mgz.const.MAP_SIZES.get(self._header.map_info.size_x)
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:update; 3, parameters; 3, 4; 3, 5; 3, 7; 3, 12; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:sources; 7, typed_default_parameter; 7, 8; 7, 9; 7, 11; 8, identifier:follow_symlinks; 9, type; 9, 10; 10, identifier:bool; 11, Fals... | def update(self, *sources, follow_symlinks: bool=False,
maximum_depth: int=20):
"""Add one or more ClassFile sources to the class loader.
If a given source is a directory path, it is traversed up to the
maximum set depth and all files under it are added to the class loader
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:error_view; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:template_dir; 6, None; 7, block; 7, 8; 7, 10; 7, 18; 7, 24; 7, 216; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 13; 11, not_operator; ... | def error_view(template_dir=None):
"""
Create the Error view
Must be instantiated
import error_view
ErrorView = error_view()
:param template_dir: The directory containing the view pages
:return:
"""
if not template_dir:
template_dir = "Pylot/Error"
template_page = "%s/... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:update_device_list; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:sessions; 6, block; 6, 7; 6, 9; 6, 22; 6, 26; 6, 30; 6, 34; 6, 223; 6, 224; 6, 270; 6, 271; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 1... | def update_device_list(self, sessions):
""" Update device list. """
if sessions is None:
_LOGGER.error('Error updating Emby devices.')
return
new_devices = []
active_devices = []
dev_update = False
for device in sessions:
dev_name = '{... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:main; 3, parameters; 4, block; 4, 5; 4, 7; 4, 13; 4, 21; 4, 22; 4, 28; 4, 36; 4, 46; 4, 56; 4, 146; 4, 187; 4, 188; 4, 201; 4, 202; 4, 208; 4, 304; 4, 305; 4, 336; 4, 347; 4, 348; 4, 363; 4, 364; 5, expression_statement; 5, 6; 6, comment; 7, ex... | def main():
"""Entry point for f2format."""
parser = get_parser()
args = parser.parse_args()
# set up variables
ARCHIVE = args.archive_path
archive = (not args.no_archive)
os.environ['F2FORMAT_VERSION'] = args.python
os.environ['F2FORMAT_ENCODING'] = args.encoding
def find(root):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:random_useragent; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:filename; 6, True; 7, block; 7, 8; 7, 10; 7, 13; 7, 19; 7, 37; 7, 49; 7, 92; 7, 214; 8, expression_statement; 8, 9; 9, comment; 10, import_statement; 10, 11;... | def random_useragent(filename=True):
"""Returns a User-Agent string randomly from file.
:arg string filename: (Optional) Path to the file from which a random
useragent is generated. By default it's ``True``, a file shipped
with this module will be used.
:returns: An user-agent string.
"... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:encode_multipart; 3, parameters; 3, 4; 3, 5; 4, identifier:data; 5, identifier:files; 6, block; 6, 7; 6, 9; 6, 15; 6, 21; 6, 30; 6, 41; 6, 156; 6, 332; 6, 346; 6, 352; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 1... | def encode_multipart(data, files):
"""Encode multipart.
:arg dict data: Data to be encoded
:arg dict files: Files to be encoded
:returns: Encoded binary string
:raises: :class:`UrlfetchException`
"""
body = BytesIO()
boundary = choose_boundary()
part_boundary = b('--%s\r\n' % bounda... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:assemble; 3, parameters; 3, 4; 4, identifier:code; 5, block; 5, 6; 5, 8; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 173; 5, 177; 5, 178; 5, 182; 5, 213; 5, 214; 5, 215; 5, 219; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9... | def assemble(code):
"""
Assemble the given iterable of mnemonics, operands, and lables.
A convienience over constructing individual Instruction and Operand
objects, the output of this function can be directly piped to
:class:`~jawa.attributes.code.CodeAttribute.assemble()` to produce
executable... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_add_new; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:host_object; 6, block; 6, 7; 6, 9; 6, 18; 6, 45; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:i;... | def _add_new(self, host_object):
"""Add a new host to the collection.
Before a new hostname can be added, all its subdomains already
present in the collection must be removed. Since the collection
is sorted, we can limit our search for them to a slice of
the collection starting ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:write_instruction; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:fout; 5, identifier:start_pos; 6, identifier:ins; 7, block; 7, 8; 7, 10; 7, 22; 7, 30; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assignment... | def write_instruction(fout, start_pos, ins):
"""
Writes a single instruction of `opcode` with `operands` to `fout`.
:param fout: Any file-like object providing ``write()``.
:param start_pos: The current position in the stream.
:param ins: The `Instruction` to write.
"""
opcode, operands = i... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:read_instruction; 3, parameters; 3, 4; 3, 5; 4, identifier:fio; 5, identifier:start_pos; 6, block; 6, 7; 6, 9; 6, 18; 6, 24; 6, 31; 6, 37; 6, 43; 6, 49; 6, 53; 6, 54; 6, 411; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9... | def read_instruction(fio, start_pos):
"""
Reads a single instruction from `fio` and returns it, or ``None`` if
the stream is empty.
:param fio: Any file-like object providing ``read()``.
:param start_pos: The current position in the stream.
"""
op = fio.read(1)
if not op:
retur... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_by_type; 3, parameters; 3, 4; 4, identifier:file_list; 5, block; 5, 6; 5, 8; 5, 15; 5, 47; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:ret_dict; 11, call; 11, 12; 11... | def sort_by_type(file_list):
"""
Sorts a list of files into types.
:param file_list: List of file paths.
:return: {extension: [<list of file paths with that extension>]}
"""
ret_dict = defaultdict(list)
for filepath in file_list:
_, ext = os.path.splitext(filepath)
ret_dict[... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_check_triple; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:triple; 6, block; 6, 7; 6, 9; 6, 16; 6, 42; 6, 46; 6, 55; 6, 64; 6, 85; 6, 97; 6, 116; 6, 148; 6, 157; 6, 171; 6, 172; 6, 173; 6, 174; 6, 175; 6, 176; 6, 188; 6, 195; 6... | def _check_triple(self, triple):
"""compare triple to ontology, return error or None"""
subj, pred, obj = triple
if self._should_ignore_predicate(pred):
log.info("Ignoring triple with predicate '{}'"
.format(self._field_name_from_uri(pred)))
return
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_ontology; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 29; 5, 161; 5, 174; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:start; 11, call; ... | def parse_ontology(self):
"""place the ontology graph into a set of custom data structures
for use by the validator"""
start = time.clock()
log.info("Parsing ontology file for %s" % self.__class__.__name__)
for subj, pred, obj in self._schema_nodes():
if subj not in s... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:new_frame_event; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 28; 5, 29; 5, 33; 5, 111; 5, 202; 5, 203; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 18; 10, identifier:out_... | def new_frame_event(self):
"""Called by the event loop when a new input or output frame is
available.
Inputs are correlated by comparing their frame numbers. If there
is a complete set of inputs, and all output frame pools are
ready, the :py:meth:`process_frame` method is called... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:GaussianFilterCore; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:x_sigma; 6, float:0.0; 7, default_parameter; 7, 8; 7, 9; 8, identifier:y_sigma; 9, float:0.0; 10, block; 10, 11; 10, 13; 10, 140; 10, 148; 10, 156; ... | def GaussianFilterCore(x_sigma=0.0, y_sigma=0.0):
"""Gaussian filter generator core.
Alternative to the :py:class:`GaussianFilter` component that can be
used to make a non-reconfigurable resizer::
resize = Resize()
resize.filter(GaussianFilterCore(x_sigma=1.5))
...
start(..... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:either; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, comment; 10, if_statement; 10, 11; 10, 17; 10, 26; 11, not_operator; 11, 12; 12, call; 12, 13; 12, 14;... | def either(self):
"""Transform pattern into an equivalent, with only top-level Either."""
# Currently the pattern will not be equivalent, but more "narrow",
# although good enough to reason about list arguments.
if not hasattr(self, 'children'):
return Either(Required(self))
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:TranslateManagedObject; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:mObj; 5, identifier:xlateOrg; 6, identifier:xlateMap; 7, block; 7, 8; 7, 10; 7, 17; 7, 22; 7, 30; 7, 41; 7, 204; 7, 362; 8, expression_statement; 8, 9; 9, comment; 10, impor... | def TranslateManagedObject(mObj, xlateOrg, xlateMap):
""" Method used to translate a managedobject. This method is used in CompareManagedObject. """
from UcsBase import UcsUtils, WriteUcsWarning
from Mos import OrgOrg
xMO = mObj.Clone()
xMO.SetHandle(mObj.GetHandle())
if (xlateOrg != None):
matchObj = re.match... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:ImportUcsSession; 3, parameters; 3, 4; 3, 5; 4, identifier:filePath; 5, identifier:key; 6, block; 6, 7; 6, 9; 6, 18; 6, 19; 6, 29; 6, 30; 6, 40; 6, 41; 6, 70; 6, 71; 6, 84; 6, 90; 6, 91; 6, 106; 7, expression_statement; 7, 8; 8, comment; 9, imp... | def ImportUcsSession(filePath, key):
"""
This operation will do a login to each UCS which is present in credential file.
- filePath specifies the path of the credential file.
- key specifies string used for secure encryption while ExportUcsSession operation.
"""
from UcsBase import UcsUtils, WriteUcs... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:ImportUcsBackup; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:path; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:merge; 10, False; 11, default_parameter; 11, 12; 11, 1... | def ImportUcsBackup(self, path=None, merge=False, dumpXml=False):
"""
Imports backUp.
This operation will upload the UCSM backup taken earlier via GUI or BackupUcs operation for all configuration, system configuration, and
logical configuration files. User can perform an import while the system is up and ru... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_set_suffix_links; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 6, expression_statement; 6, 7; 7, string:'''
Sets all suffix links in all nodes in this trie.
'''; 8, expression_statement; 8, 9; 9, assign... | def _set_suffix_links(self):
'''
Sets all suffix links in all nodes in this trie.
'''
self._suffix_links_set = True
for current, parent in self.bfs():
# skip the root node
if parent is None:
continue
current.longest_prefix = par... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_write_mo; 3, parameters; 3, 4; 4, identifier:mo; 5, block; 5, 6; 5, 8; 5, 9; 5, 13; 5, 30; 5, 34; 5, 38; 5, 76; 5, 87; 5, 220; 5, 274; 5, 301; 5, 305; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, a... | def _write_mo(mo):
""" Method to return string representation of a managed object. """
# from UcsBase import UcsUtils
classNotFound = False
if (UcsUtils.FindClassIdInMoMetaIgnoreCase(mo.classId) == None):
classNotFound = True
tabsize = 8
outstr = "\n"
if classNotFound:
outstr += "Managed Object\t\t\t:\t" + ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:LoadFromXml; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:node; 6, identifier:handle; 7, block; 7, 8; 7, 10; 7, 17; 7, 191; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, call; 11, 12; 11,... | def LoadFromXml(self, node, handle):
""" Method updates the object from the xml representation of the managed object. """
self.SetHandle(handle)
if node.hasAttributes():
# attributes = node._get_attributes()
# attCount = attributes._get_length()
attributes = node.attributes
attCount = len(attributes)
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:GetJavaInstallationPath; 3, parameters; 4, block; 4, 5; 4, 7; 4, 12; 4, 13; 4, 14; 5, expression_statement; 5, 6; 6, comment; 7, import_statement; 7, 8; 7, 10; 8, dotted_name; 8, 9; 9, identifier:os; 10, dotted_name; 10, 11; 11, identifier:plat... | def GetJavaInstallationPath():
""" Method returns the java installation path in the windows or Linux environment. """
import os, platform
# Get JavaPath for Ubuntu
# if os.name == "posix":
if platform.system() == "Linux":
path = os.environ.get('JAVA_HOME')
if not path:
raise UcsValidationException(... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:GetSyncMoConfig; 3, parameters; 3, 4; 4, identifier:ConfigDoc; 5, block; 5, 6; 5, 8; 5, 12; 5, 21; 5, 248; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:moConfigMap; 11, di... | def GetSyncMoConfig(ConfigDoc):
""" Internal support method for SyncManagedObject. """
moConfigMap = {}
configList = ConfigDoc.getElementsByTagName("mo")
for moConfigNode in configList:
classId = None
noun = None
version = None
actionVersion = None
action = None
ignoreReason = None
status ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:duration; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:t; 5, default_parameter; 5, 6; 5, 7; 6, identifier:now; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:precision; 10, integer:1; 11, default_parameter; 11... | def duration(t, now=None, precision=1, pad=', ', words=None,
justnow=datetime.timedelta(seconds=10)):
'''
Time delta compared to ``t``. You can override ``now`` to specify what time
to compare to.
:param t: timestamp, :class:`datetime.date` or :class:`datetime.datetime`
objec... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:search; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:query_string; 6, block; 6, 7; 6, 9; 6, 17; 6, 18; 6, 26; 6, 32; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, ... | def search(self, query_string):
"""Performs a search against the index using lunr query syntax.
Results will be returned sorted by their score, the most relevant
results will be returned first.
For more programmatic querying use `lunr.Index.query`.
Args:
query_stri... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:wrap_error; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:self; 5, identifier:data; 6, identifier:renderer_context; 7, identifier:keys_are_fields; 8, identifier:issue_is_title; 9, block; 9, 10; 9, 12; 9, 22; 9, 33; 9, 37; 9, 129; 9... | def wrap_error(
self, data, renderer_context, keys_are_fields, issue_is_title):
"""Convert error native data to the JSON API Error format
JSON API has a different format for errors, but Django REST Framework
doesn't have a separate rendering path for errors. This results in
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:lunr; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:ref; 5, identifier:fields; 6, identifier:documents; 7, default_parameter; 7, 8; 7, 9; 8, identifier:languages; 9, None; 10, block; 10, 11; 10, 13; 10, 117; 10, 124; 10, 152; 10, 188; 1... | def lunr(ref, fields, documents, languages=None):
"""A convenience function to configure and construct a lunr.Index.
Args:
ref (str): The key in the documents to be used a the reference.
fields (list): A list of strings defining fields in the documents to
index. Optionally a list of... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:build_trie; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:pattern_filename; 5, identifier:pattern_format; 6, identifier:encoding; 7, identifier:on_word_boundaries; 8, block; 8, 9; 8, 11; 8, 15; 8, 34; 8, 52; 8, 62; 8, 66; 8, 360; 8, 373;... | def build_trie(pattern_filename, pattern_format, encoding, on_word_boundaries):
'''
Constructs a finite state machine for performing string rewriting.
Arguments:
- `pattern_filename`:
- `pattern_format`:
- `encoding`:
- `on_word_boundaries`:
'''
boundaries = on_word_boundaries
i... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:make_parser; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:add_help; 6, True; 7, default_parameter; 7, 8; 7, 9; 8, identifier:exclude_args; 9, None; 10, block; 10, 11; 10, 13; 10, 22; 10, 33; 10, 42; 10, 60; 10, 86... | def make_parser(add_help=True, exclude_args=None):
"""Return an argparse.ArgumentParser object with losser's arguments.
Other projects can call this to get an ArgumentParser with losser's
command line interface to use as a parent parser for their own parser.
For example::
parent_parser = losse... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:parse; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:parser; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:args; 9, None; 10, block; 10, 11; 10, 13; 10, 23; 10, 47; 10, 72; 10, 118; 10, 171; 11, expressi... | def parse(parser=None, args=None):
"""Parse the command line arguments, return an argparse namespace object.
Other projects can call this function and pass in their own ArgumentParser
object (which should have a losser ArgumentParser from make_parser() above
as parent) to do the argument parsing and ge... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:read_value; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:ftype; 5, identifier:prompt; 6, default_parameter; 6, 7; 6, 8; 7, identifier:default; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:minval; 11,... | def read_value(ftype, prompt, default=None, minval=None, maxval=None,
allowed_single_chars=None, question_mark=True):
"""Return value read from keyboard
Parameters
----------
ftype : int() or float()
Function defining the expected type.
prompt : str
Prompt string.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:select_configuration; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:obresult; 6, block; 6, 7; 6, 9; 6, 18; 6, 25; 6, 26; 6, 34; 6, 44; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10,... | def select_configuration(self, obresult):
"""Select instrument configuration based on OB"""
logger = logging.getLogger(__name__)
logger.debug('calling default configuration selector')
# get first possible image
ref = obresult.get_sample_frame()
extr = self.datamodel.ext... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:pause_debugplot; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:debugplot; 5, default_parameter; 5, 6; 5, 7; 6, identifier:optional_prompt; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:pltshow; 10, False; 11, default_parame... | def pause_debugplot(debugplot, optional_prompt=None, pltshow=False,
tight_layout=True):
"""Ask the user to press RETURN to continue after plotting.
Parameters
----------
debugplot : int
Determines whether intermediate computations and/or plots
are displayed:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:mode_half_sample; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, default_parameter; 5, 6; 5, 7; 6, identifier:is_sorted; 7, False; 8, block; 8, 9; 8, 11; 8, 20; 8, 39; 8, 46; 9, expression_statement; 9, 10; 10, string:'''
Estimate the mode ... | def mode_half_sample(a, is_sorted=False):
'''
Estimate the mode using the Half Sample mode.
A method to estimate the mode, as described in
D. R. Bickel and R. Frühwirth (contributed equally),
"On a fast, robust estimator of the mode: Comparisons to other
robust estimators with applications,"
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:author_id_normalize_and_schema; 3, parameters; 3, 4; 3, 5; 4, identifier:uid; 5, default_parameter; 5, 6; 5, 7; 6, identifier:schema; 7, None; 8, block; 8, 9; 8, 11; 8, 49; 8, 72; 8, 85; 8, 111; 8, 119; 8, 151; 8, 158; 8, 159; 9, expression_sta... | def author_id_normalize_and_schema(uid, schema=None):
"""Detect and normalize an author UID schema.
Args:
uid (string): a UID string
schema (string): try to resolve to schema
Returns:
Tuple[string, string]: a tuple (uid, schema) where:
- uid: the UID normalized to comply wi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_schema_path; 3, parameters; 3, 4; 3, 5; 4, identifier:schema; 5, default_parameter; 5, 6; 5, 7; 6, identifier:resolved; 7, False; 8, block; 8, 9; 8, 11; 8, 43; 8, 107; 8, 114; 8, 186; 9, expression_statement; 9, 10; 10, comment; 11, functio... | def get_schema_path(schema, resolved=False):
"""Retrieve the installed path for the given schema.
Args:
schema(str): relative or absolute url of the schema to validate, for
example, 'records/authors.json' or 'jobs.json', or just the name of the
schema, like 'jobs'.
resol... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_license_from_url; 3, parameters; 3, 4; 4, identifier:url; 5, block; 5, 6; 5, 8; 5, 13; 5, 23; 5, 169; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 11; 9, not_operator; 9, 10; 10, identifier:url; 11, block; 11, 12; 12... | def get_license_from_url(url):
"""Get the license abbreviation from an URL.
Args:
url(str): canonical url of the license.
Returns:
str: the corresponding license abbreviation.
Raises:
ValueError: when the url is not recognized
"""
if not url:
return
split_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:convert_old_publication_info_to_new; 3, parameters; 3, 4; 4, identifier:publication_infos; 5, block; 5, 6; 5, 8; 5, 12; 5, 16; 5, 282; 5, 304; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11... | def convert_old_publication_info_to_new(publication_infos):
"""Convert a ``publication_info`` value from the old format to the new.
On Legacy different series of the same journal were modeled by adding the
letter part of the name to the journal volume. For example, a paper published
in Physical Review ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:construct_reference_system; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:symbols; 5, default_parameter; 5, 6; 5, 7; 6, identifier:candidates; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:options; 10, None; 11, block; 11, 12; 11,... | def construct_reference_system(
symbols,
candidates=None,
options=None,
):
"""Take a list of symbols and construct gas phase
references system, when possible avoiding O2.
Candidates can be rearranged, where earlier candidates
get higher preference than later candidates
assume symbols so... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:gen_triplets_master; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:wv_master; 5, default_parameter; 5, 6; 5, 7; 6, identifier:geometry; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:debugplot; 10, integer:0; 11, block; 11, 12; 11,... | def gen_triplets_master(wv_master, geometry=None, debugplot=0):
"""Compute information associated to triplets in master table.
Determine all the possible triplets that can be generated from the
array `wv_master`. In addition, the relative position of the
central line of each triplet is also computed.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:match_wv_arrays; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:wv_master; 5, identifier:wv_expected_all_peaks; 6, identifier:delta_wv_max; 7, block; 7, 8; 7, 10; 7, 11; 7, 20; 7, 21; 7, 22; 7, 34; 7, 35; 7, 36; 7, 48; 7, 54; 7, 55; 7, 56; 7, 3... | def match_wv_arrays(wv_master, wv_expected_all_peaks, delta_wv_max):
"""Match two lists with wavelengths.
Assign individual wavelengths from wv_master to each expected
wavelength when the latter is within the maximum allowed range.
Parameters
----------
wv_master : numpy array
Array co... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 41; 2, function_name:add_publication_info; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:year; 7, None; 8, default_parameter; 8, 9; 8, 10; ... | def add_publication_info(
self,
year=None,
cnum=None,
artid=None,
page_end=None,
page_start=None,
journal_issue=None,
journal_title=None,
journal_volume=None,
pubinfo_freetext=None,
material=None,
parent_record=None,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:compute_operation; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, identifier:file1; 5, identifier:file2; 6, identifier:operation; 7, identifier:output; 8, identifier:display; 9, identifier:args_z1z2; 10, identifier:... | def compute_operation(file1, file2, operation, output, display,
args_z1z2, args_bbox, args_keystitle, args_geometry):
"""Compute output = file1 operation file2.
Parameters
----------
file1 : file object
First FITS file.
file2 : file object
Second FITS file.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:summary; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:x; 5, default_parameter; 5, 6; 5, 7; 6, identifier:rm_nan; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:debug; 10, False; 11, block; 11, 12; 11, 14; 11, 15; 11, 67; 11, 88; ... | def summary(x, rm_nan=False, debug=False):
"""Compute basic statistical parameters.
Parameters
----------
x : 1d numpy array, float
Input array with values which statistical properties are
requested.
rm_nan : bool
If True, filter out NaN values before computing statistics.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:find_peaks_spectrum; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:sx; 5, identifier:nwinwidth; 6, default_parameter; 6, 7; 6, 8; 7, identifier:threshold; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:debugplot; 11, i... | def find_peaks_spectrum(sx, nwinwidth, threshold=0, debugplot=0):
"""Find peaks in array.
The algorithm imposes that the signal at both sides of the peak
decreases monotonically.
Parameters
----------
sx : 1d numpy array, floats
Input array.
nwinwidth : int
Width of the win... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:shortlex; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:start; 5, identifier:other; 6, default_parameter; 6, 7; 6, 8; 7, identifier:excludestart; 8, False; 9, block; 9, 10; 9, 12; 9, 19; 9, 31; 10, expression_statement; 10, 11; 11, comment; 12... | def shortlex(start, other, excludestart=False):
"""Yield all unions of start with other in shortlex order.
>>> ['{:03b}'.format(s) for s in shortlex(0, [0b100, 0b010, 0b001])]
['000', '100', '010', '001', '110', '101', '011', '111']
>>> ', '.join(''.join(sorted(s))
... for s in shortlex(set(), [{'... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:reverse_shortlex; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:end; 5, identifier:other; 6, default_parameter; 6, 7; 6, 8; 7, identifier:excludeend; 8, False; 9, block; 9, 10; 9, 12; 9, 19; 9, 31; 10, expression_statement; 10, 11; 11, comment... | def reverse_shortlex(end, other, excludeend=False):
"""Yield all intersections of end with other in reverse shortlex order.
>>> ['{:03b}'.format(s) for s in reverse_shortlex(0b111, [0b011, 0b101, 0b110])]
['111', '011', '101', '110', '001', '010', '100', '000']
>>> ', '.join(''.join(sorted(s))
...... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:gnuplot; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:script_name; 5, default_parameter; 5, 6; 5, 7; 6, identifier:args_dict; 7, dictionary; 8, default_parameter; 8, 9; 8, 10; 9, identifier:data; 10, list:[]; 11, default_parameter; 11... | def gnuplot(script_name, args_dict={}, data=[], silent=True):
'''
Call a Gnuplot script, passing it arguments and
datasets.
Args:
scipt_name(str): The name of the Gnuplot script.
args_dict(dict): A dictionary of parameters to pass
to the script. The `key` is the name of the... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:read; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:skip; 7, list:[]; 8, default_parameter; 8, 9; 8, 10; 9, identifier:goto_metal; 10, None; 11, default_parameter; 11, 12; 11, 13; 1... | def read(self, skip=[], goto_metal=None, goto_reaction=None):
"""
Get reactions from folders.
Parameters
----------
skip: list of str
list of folders not to read
goto_reaction: str
Skip ahead to this metal
goto_reaction:
Skip a... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:location; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:wave_field; 6, default_parameter; 6, 7; 6, 8; 7, identifier:depth; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:index; 11, None; 12, block; 12, 1... | def location(self, wave_field, depth=None, index=None):
"""Create a Location for a specific depth.
Parameters
----------
wave_field: str
Wave field. See :class:`Location` for possible values.
depth: float, optional
Depth corresponding to the :class`Locati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.