sequence stringlengths 492 15.9k | code stringlengths 75 8.58k |
|---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_regulate_amounts; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 10; 5, 21; 5, 25; 5, 37; 5, 41; 5, 52; 5, 64; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:qstr; 9, string:"$.events.frames[(@.type is ... | def get_regulate_amounts(self):
qstr = "$.events.frames[(@.type is 'transcription')]"
res = self.tree.execute(qstr)
all_res = []
if res is not None:
all_res += list(res)
qstr = "$.events.frames[(@.type is 'amount')]"
res = self.tree.execute(qstr)
if re... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_entity_coordinates; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:entity_term; 6, block; 6, 7; 6, 16; 6, 23; 6, 29; 6, 40; 6, 47; 6, 61; 6, 70; 6, 77; 6, 86; 6, 93; 6, 102; 6, 111; 6, 122; 6, 131; 6, 140; 6, 151; 7, expressi... | def _get_entity_coordinates(self, entity_term):
sent_id = entity_term.get('sentence')
if sent_id is None:
return None
qstr = "$.sentences.frames[(@.frame_id is \'%s')]" % sent_id
res = self.tree.execute(qstr)
if res is None:
return None
try:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_evidence; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:relation; 6, block; 6, 7; 6, 16; 6, 20; 6, 24; 6, 211; 6, 226; 6, 249; 6, 253; 6, 262; 6, 271; 6, 280; 6, 295; 6, 312; 6, 333; 7, expression_statement; 7, 8; 8, assignme... | def get_evidence(self, relation):
provenance = relation.get('provenance')
text = None
context = None
if provenance:
sentence_tag = provenance[0].get('sentence')
if sentence_tag and '@id' in sentence_tag:
sentence_id = sentence_tag['@id']
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_groundings; 3, parameters; 3, 4; 4, identifier:entity; 5, block; 5, 6; 5, 77; 5, 86; 5, 95; 5, 101; 5, 160; 6, function_definition; 6, 7; 6, 8; 6, 10; 7, function_name:get_grounding_entries; 8, parameters; 8, 9; 9, identifier:grounding; 10,... | def get_groundings(entity):
def get_grounding_entries(grounding):
if not grounding:
return None
entries = []
values = grounding.get('values', [])
if values:
for entry in values:
ont_concept = entry.get('ontologyC... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:make_model; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:grounding_ontology; 7, string:'UN'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:grounding_threshold; 10, None; 11, block; 11,... | def make_model(self, grounding_ontology='UN', grounding_threshold=None):
if grounding_threshold is not None:
self.grounding_threshold = grounding_threshold
self.grounding_ontology = grounding_ontology
statements = [stmt for stmt in self.statements if
isinstance(... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:process_directory_statements_sorted_by_pmid; 3, parameters; 3, 4; 4, identifier:directory_name; 5, block; 5, 6; 5, 13; 5, 23; 5, 46; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:s_dict; 9, call; 9, 10; 9, 11; 10, iden... | def process_directory_statements_sorted_by_pmid(directory_name):
s_dict = defaultdict(list)
mp = process_directory(directory_name, lazy=True)
for statement in mp.iter_statements():
s_dict[statement.evidence[0].pmid].append(statement)
return s_dict |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:process_file_sorted_by_pmid; 3, parameters; 3, 4; 4, identifier:file_name; 5, block; 5, 6; 5, 13; 5, 23; 5, 46; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:s_dict; 9, call; 9, 10; 9, 11; 10, identifier:defaultdict; 1... | def process_file_sorted_by_pmid(file_name):
s_dict = defaultdict(list)
mp = process_file(file_name, lazy=True)
for statement in mp.iter_statements():
s_dict[statement.evidence[0].pmid].append(statement)
return s_dict |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:extract_context; 3, parameters; 3, 4; 3, 5; 4, identifier:annotations; 5, identifier:annot_manager; 6, block; 6, 7; 6, 71; 6, 77; 6, 85; 6, 115; 6, 139; 6, 217; 6, 225; 7, function_definition; 7, 8; 7, 9; 7, 12; 8, function_name:get_annot; 9, p... | def extract_context(annotations, annot_manager):
def get_annot(annotations, key):
val = annotations.pop(key, None)
if val:
val_list = [v for v, tf in val.items() if tf]
if len(val_list) > 1:
logger.warning('More than one "%s" in annotations' % key)
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_format_evidence_text; 3, parameters; 3, 4; 4, identifier:stmt; 5, block; 5, 6; 5, 80; 5, 84; 5, 308; 6, function_definition; 6, 7; 6, 8; 6, 10; 7, function_name:get_role; 8, parameters; 8, 9; 9, identifier:ag_ix; 10, block; 10, 11; 11, if_stat... | def _format_evidence_text(stmt):
def get_role(ag_ix):
if isinstance(stmt, Complex) or \
isinstance(stmt, SelfModification) or \
isinstance(stmt, ActiveForm) or isinstance(stmt, Conversion) or\
isinstance(stmt, Translocation):
return 'other... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get_full_text; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:paper_id; 5, identifier:idtype; 6, default_parameter; 6, 7; 6, 8; 7, identifier:preferred_content_type; 8, string:'text/xml'; 9, block; 9, 10; 9, 26; 9, 34; 9, 43; 9, 52; 9, 61; 9, 8... | def get_full_text(paper_id, idtype, preferred_content_type='text/xml'):
if preferred_content_type not in \
('text/xml', 'text/plain', 'application/pdf'):
raise ValueError("preferred_content_type must be one of 'text/xml', "
"'text/plain', or 'application/pdf'.")
ids ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:process_text; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:text; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pmid; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:python2_path; 10, None; 11, block; 11, 12; 11, 65; 11, 79; 11, 9... | def process_text(text, pmid=None, python2_path=None):
if python2_path is None:
for path in os.environ["PATH"].split(os.pathsep):
proposed_python2_path = os.path.join(path, 'python2.7')
if os.path.isfile(proposed_python2_path):
python2_path = proposed_python2_path
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:run_on_text; 3, parameters; 3, 4; 3, 5; 4, identifier:text; 5, identifier:python2_path; 6, block; 6, 7; 6, 14; 6, 135; 6, 151; 6, 155; 6, 166; 6, 181; 6, 368; 6, 375; 6, 382; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identif... | def run_on_text(text, python2_path):
tees_path = get_config('TEES_PATH')
if tees_path is None:
for cpath in tees_candidate_paths:
cpath = os.path.expanduser(cpath)
if os.path.isdir(cpath):
has_expected_files = True
for f in tees_installation_files:... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:extract_output; 3, parameters; 3, 4; 4, identifier:output_dir; 5, block; 5, 6; 5, 18; 5, 27; 5, 56; 5, 62; 5, 91; 5, 102; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:sentences_glob; 9, call; 9, 10; 9, 15; 10, attribu... | def extract_output(output_dir):
sentences_glob = os.path.join(output_dir, '*-preprocessed.xml.gz')
sentences_filename_candidates = glob.glob(sentences_glob)
if len(sentences_filename_candidates) != 1:
m = 'Looking for exactly one file matching %s but found %d matches'
raise Exception(m % (
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_drug_inhibition_stmts; 3, parameters; 3, 4; 4, identifier:drug; 5, block; 5, 6; 5, 17; 5, 28; 5, 61; 5, 71; 5, 87; 5, 94; 5, 100; 5, 107; 5, 115; 5, 122; 5, 138; 5, 142; 5, 270; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, i... | def get_drug_inhibition_stmts(drug):
chebi_id = drug.db_refs.get('CHEBI')
mesh_id = drug.db_refs.get('MESH')
if chebi_id:
drug_chembl_id = chebi_client.get_chembl_id(chebi_id)
elif mesh_id:
drug_chembl_id = get_chembl_id(mesh_id)
else:
logger.error('Drug missing ChEBI or MESH... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:merge_groundings; 3, parameters; 3, 4; 4, identifier:stmts_in; 5, block; 5, 6; 5, 117; 5, 293; 5, 297; 5, 323; 6, function_definition; 6, 7; 6, 8; 6, 10; 7, function_name:surface_grounding; 8, parameters; 8, 9; 9, identifier:stmt; 10, block; 10... | def merge_groundings(stmts_in):
def surface_grounding(stmt):
for idx, concept in enumerate(stmt.agent_list()):
if concept is None:
continue
aggregate_groundings = {}
for ev in stmt.evidence:
if 'agents' in ev.annotations:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:merge_deltas; 3, parameters; 3, 4; 4, identifier:stmts_in; 5, block; 5, 6; 5, 10; 5, 298; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:stmts_out; 9, list:[]; 10, for_statement; 10, 11; 10, 12; 10, 13; 11, identifier:s... | def merge_deltas(stmts_in):
stmts_out = []
for stmt in stmts_in:
if not isinstance(stmt, Influence):
stmts_out.append(stmt)
continue
deltas = {}
for role in ('subj', 'obj'):
for info in ('polarity', 'adjectives'):
key = (role, info)
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:map_sequence; 3, parameters; 3, 4; 3, 5; 4, identifier:stmts_in; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 17; 7, 29; 7, 36; 7, 58; 7, 69; 7, 73; 7, 106; 7, 112; 7, 124; 7, 133; 7, 142; 7, 144; 8, import_from_s... | def map_sequence(stmts_in, **kwargs):
from indra.preassembler.sitemapper import SiteMapper, default_site_map
logger.info('Mapping sites on %d statements...' % len(stmts_in))
kwarg_list = ['do_methionine_offset', 'do_orthology_mapping',
'do_isoform_mapping']
sm = SiteMapper(default_site... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:filter_by_type; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:stmts_in; 5, identifier:stmt_type; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 19; 8, 39; 8, 74; 8, 86; 8, 95; 8, 104; 9, expression_statement; 9, 10... | def filter_by_type(stmts_in, stmt_type, **kwargs):
invert = kwargs.get('invert', False)
logger.info('Filtering %d statements for type %s%s...' %
(len(stmts_in), 'not ' if invert else '',
stmt_type.__name__))
if not invert:
stmts_out = [st for st in stmts_in if isinst... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:filter_grounded_only; 3, parameters; 3, 4; 3, 5; 4, identifier:stmts_in; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 18; 7, 30; 7, 34; 7, 43; 7, 127; 7, 139; 7, 148; 7, 157; 8, expression_statement; 8, 9; 9, assi... | def filter_grounded_only(stmts_in, **kwargs):
remove_bound = kwargs.get('remove_bound', False)
logger.info('Filtering %d statements for grounded agents...' %
len(stmts_in))
stmts_out = []
score_threshold = kwargs.get('score_threshold')
for st in stmts_in:
grounded = True
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:filter_genes_only; 3, parameters; 3, 4; 3, 5; 4, identifier:stmts_in; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 18; 7, 27; 7, 39; 7, 43; 7, 120; 7, 132; 7, 141; 7, 150; 8, expression_statement; 8, 9; 9, assignm... | def filter_genes_only(stmts_in, **kwargs):
remove_bound = 'remove_bound' in kwargs and kwargs['remove_bound']
specific_only = kwargs.get('specific_only')
logger.info('Filtering %d statements for ones containing genes only...' %
len(stmts_in))
stmts_out = []
for st in stmts_in:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:filter_gene_list; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:stmts_in; 5, identifier:gene_list; 6, identifier:policy; 7, default_parameter; 7, 8; 7, 9; 8, identifier:allow_families; 9, False; 10, dictionary_splat_pattern; 10, ... | def filter_gene_list(stmts_in, gene_list, policy, allow_families=False,
**kwargs):
invert = kwargs.get('invert', False)
remove_bound = kwargs.get('remove_bound', False)
if policy not in ('one', 'all'):
logger.error('Policy %s is invalid, not applying filter.' % policy)
else:... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:filter_by_db_refs; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:stmts_in; 5, identifier:namespace; 6, identifier:values; 7, identifier:policy; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 21; 10... | def filter_by_db_refs(stmts_in, namespace, values, policy, **kwargs):
invert = kwargs.get('invert', False)
match_suffix = kwargs.get('match_suffix', False)
if policy not in ('one', 'all'):
logger.error('Policy %s is invalid, not applying filter.' % policy)
return
else:
name_str =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:filter_human_only; 3, parameters; 3, 4; 3, 5; 4, identifier:stmts_in; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 14; 7, 33; 7, 42; 7, 54; 7, 58; 7, 91; 7, 155; 7, 167; 7, 176; 8, import_from_statement; 8, 9; 8, ... | def filter_human_only(stmts_in, **kwargs):
from indra.databases import uniprot_client
if 'remove_bound' in kwargs and kwargs['remove_bound']:
remove_bound = True
else:
remove_bound = False
dump_pkl = kwargs.get('save')
logger.info('Filtering %d statements for human genes only...' %
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:filter_direct; 3, parameters; 3, 4; 3, 5; 4, identifier:stmts_in; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 60; 7, 72; 7, 76; 7, 93; 7, 105; 7, 114; 7, 123; 8, function_definition; 8, 9; 8, 10; 8, 12; 9, functi... | def filter_direct(stmts_in, **kwargs):
def get_is_direct(stmt):
any_indirect = False
for ev in stmt.evidence:
if ev.epistemics.get('direct') is True:
return True
elif ev.epistemics.get('direct') is False:
any_indirect = True
if any_indi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:filter_evidence_source; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:stmts_in; 5, identifier:source_apis; 6, default_parameter; 6, 7; 6, 8; 7, identifier:policy; 8, string:'one'; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwarg... | def filter_evidence_source(stmts_in, source_apis, policy='one', **kwargs):
logger.info('Filtering %d statements to evidence source "%s" of: %s...' %
(len(stmts_in), policy, ', '.join(source_apis)))
stmts_out = []
for st in stmts_in:
sources = set([ev.source_api for ev in st.evidence]... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:filter_inconsequential_mods; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:stmts_in; 5, default_parameter; 5, 6; 5, 7; 6, identifier:whitelist; 7, None; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 20; 10, 3... | def filter_inconsequential_mods(stmts_in, whitelist=None, **kwargs):
if whitelist is None:
whitelist = {}
logger.info('Filtering %d statements to remove' % len(stmts_in) +
' inconsequential modifications...')
states_used = whitelist
for stmt in stmts_in:
for agent in stmt... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:filter_inconsequential_acts; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:stmts_in; 5, default_parameter; 5, 6; 5, 7; 6, identifier:whitelist; 7, None; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 20; 10, 3... | def filter_inconsequential_acts(stmts_in, whitelist=None, **kwargs):
if whitelist is None:
whitelist = {}
logger.info('Filtering %d statements to remove' % len(stmts_in) +
' inconsequential activations...')
states_used = whitelist
for stmt in stmts_in:
for agent in stmt.a... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:render_stmt_graph; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:statements; 5, default_parameter; 5, 6; 5, 7; 6, identifier:reduce; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:english; 10, False; 11, default_param... | def render_stmt_graph(statements, reduce=True, english=False, rankdir=None,
agent_style=None):
from indra.assemblers.english import EnglishAssembler
if agent_style is None:
agent_style = {'color': 'lightgray', 'style': 'filled',
'fontname': 'arial'}
nodes... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:flatten_stmts; 3, parameters; 3, 4; 4, identifier:stmts; 5, block; 5, 6; 5, 13; 5, 40; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:total_stmts; 9, call; 9, 10; 9, 11; 10, identifier:set; 11, argument_list; 11, 12; 12... | def flatten_stmts(stmts):
total_stmts = set(stmts)
for stmt in stmts:
if stmt.supported_by:
children = flatten_stmts(stmt.supported_by)
total_stmts = total_stmts.union(children)
return list(total_stmts) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:combine_duplicate_stmts; 3, parameters; 3, 4; 4, identifier:stmts; 5, block; 5, 6; 5, 38; 5, 42; 5, 329; 6, function_definition; 6, 7; 6, 8; 6, 10; 7, function_name:_ev_keys; 8, parameters; 8, 9; 9, identifier:sts; 10, block; 10, 11; 10, 15; 10... | def combine_duplicate_stmts(stmts):
def _ev_keys(sts):
ev_keys = []
for stmt in sts:
for ev in stmt.evidence:
ev_keys.append(ev.matches_key())
return ev_keys
unique_stmts = []
for _, duplicates in Preassembler._get_stmt_matc... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_get_stmt_by_group; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:stmt_type; 6, identifier:stmts_this_type; 7, identifier:eh; 8, block; 8, 9; 8, 19; 8, 29; 8, 39; 8, 49; 8, 59; 8, 366; 8, 407; 8, 448; 9, expression_st... | def _get_stmt_by_group(self, stmt_type, stmts_this_type, eh):
stmt_by_first = collections.defaultdict(lambda: [])
stmt_by_second = collections.defaultdict(lambda: [])
none_first = collections.defaultdict(lambda: [])
none_second = collections.defaultdict(lambda: [])
stmt_by_group ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:combine_related; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:return_toplevel; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:poolsize; 10, None; 11, default_parameter; ... | def combine_related(self, return_toplevel=True, poolsize=None,
size_cutoff=100):
if self.related_stmts is not None:
if return_toplevel:
return self.related_stmts
else:
assert self.unique_stmts is not None
return self... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:find_contradicts; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 24; 5, 49; 5, 57; 5, 67; 5, 73; 5, 79; 5, 83; 5, 191; 5, 197; 5, 247; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:eh; 9, subscript;... | def find_contradicts(self):
eh = self.hierarchies['entity']
stmts_by_type = collections.defaultdict(lambda: [])
for idx, stmt in enumerate(self.stmts):
stmts_by_type[indra_stmt_type(stmt)].append((idx, stmt))
pos_stmts = AddModification.__subclasses__()
neg_stmts = [m... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_text_content_for_pmids; 3, parameters; 3, 4; 4, identifier:pmids; 5, block; 5, 6; 5, 21; 5, 25; 5, 62; 5, 66; 5, 72; 5, 109; 5, 120; 5, 124; 5, 151; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:pmc_pmids; 9, call;... | def get_text_content_for_pmids(pmids):
pmc_pmids = set(pmc_client.filter_pmids(pmids, source_type='fulltext'))
pmc_ids = []
for pmid in pmc_pmids:
pmc_id = pmc_client.id_lookup(pmid, idtype='pmid')['pmcid']
if pmc_id:
pmc_ids.append(pmc_id)
else:
pmc_pmids.dis... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:export_sbgn; 3, parameters; 3, 4; 4, identifier:model; 5, block; 5, 6; 5, 10; 5, 14; 5, 20; 5, 27; 5, 36; 5, 41; 5, 47; 5, 51; 5, 92; 5, 314; 5, 327; 6, import_statement; 6, 7; 7, dotted_name; 7, 8; 7, 9; 8, identifier:lxml; 9, identifier:etree... | def export_sbgn(model):
import lxml.etree
import lxml.builder
from pysb.bng import generate_equations
from indra.assemblers.sbgn import SBGNAssembler
logger.info('Generating reaction network with BNG for SBGN export. ' +
'This could take a long time.')
generate_equations(model)
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_profile_data; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:study_id; 5, identifier:gene_list; 6, identifier:profile_filter; 7, default_parameter; 7, 8; 7, 9; 8, identifier:case_set_filter; 9, None; 10, block; 10, 11; 10, 19; 10, 32... | def get_profile_data(study_id, gene_list,
profile_filter, case_set_filter=None):
genetic_profiles = get_genetic_profiles(study_id, profile_filter)
if genetic_profiles:
genetic_profile = genetic_profiles[0]
else:
return {}
gene_list_str = ','.join(gene_list)
case_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:print_cx; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pretty; 7, True; 8, block; 8, 9; 8, 64; 8, 70; 8, 80; 8, 94; 8, 100; 8, 123; 8, 141; 8, 154; 8, 171; 8, 197; 9, function_definition; 9, 10;... | def print_cx(self, pretty=True):
def _get_aspect_metadata(aspect):
count = len(self.cx.get(aspect)) if self.cx.get(aspect) else 0
if not count:
return None
data = {'name': aspect,
'idCounter': self._id_counter,
'consiste... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:set_context; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:cell_type; 6, block; 6, 7; 6, 21; 6, 32; 6, 43; 6, 52; 6, 61; 6, 79; 6, 97; 6, 105; 6, 122; 6, 126; 6, 241; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, ... | def set_context(self, cell_type):
node_names = [node['n'] for node in self.cx['nodes']]
res_expr = context_client.get_protein_expression(node_names,
[cell_type])
res_mut = context_client.get_mutations(node_names,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_ids; 3, parameters; 3, 4; 3, 5; 4, identifier:search_term; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 18; 7, 25; 7, 44; 7, 51; 7, 59; 7, 66; 7, 92; 7, 132; 7, 146; 7, 155; 7, 162; 7, 172; 7, 195; 8, expressi... | def get_ids(search_term, **kwargs):
use_text_word = kwargs.pop('use_text_word', True)
if use_text_word:
search_term += '[tw]'
params = {'term': search_term,
'retmax': 100000,
'retstart': 0,
'db': 'pubmed',
'sort': 'pub+date'}
params.update(... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_ids_for_gene; 3, parameters; 3, 4; 3, 5; 4, identifier:hgnc_name; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 17; 7, 27; 7, 36; 7, 46; 7, 59; 7, 66; 7, 74; 7, 81; 7, 107; 7, 116; 7, 123; 7, 139; 8, expression... | def get_ids_for_gene(hgnc_name, **kwargs):
hgnc_id = hgnc_client.get_hgnc_id(hgnc_name)
if hgnc_id is None:
raise ValueError('Invalid HGNC name.')
entrez_id = hgnc_client.get_entrez_id(hgnc_id)
if entrez_id is None:
raise ValueError('Entrez ID not found in HGNC table.')
params = {'db... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_im; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:force_update; 7, False; 8, block; 8, 9; 8, 21; 8, 32; 8, 123; 8, 134; 8, 289; 8, 310; 8, 317; 8, 330; 8, 342; 8, 408; 9, if_statement; 9, 10;... | def get_im(self, force_update=False):
if self._im and not force_update:
return self._im
if not self.model:
raise Exception("Cannot get influence map if there is no model.")
def add_obs_for_agent(agent):
obj_mps = list(pa.grounded_monomer_patterns(self.model, a... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:check_statement; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:stmt; 6, default_parameter; 6, 7; 6, 8; 7, identifier:max_paths; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:max_path_length; 11, in... | def check_statement(self, stmt, max_paths=1, max_path_length=5):
self.get_im()
if not isinstance(stmt, (Modification, RegulateAmount,
RegulateActivity, Influence)):
return PathResult(False, 'STATEMENT_TYPE_NOT_HANDLED',
max_paths... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:score_paths; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 4, identifier:self; 5, identifier:paths; 6, identifier:agents_values; 7, default_parameter; 7, 8; 7, 9; 8, identifier:loss_of_function; 9, False; 10, default_parameter; 10, 11; ... | def score_paths(self, paths, agents_values, loss_of_function=False,
sigma=0.15, include_final_node=False):
obs_model = lambda x: scipy.stats.norm(x, sigma)
obs_dict = {}
for ag, val in agents_values.items():
obs_list = self.agent_to_obs[ag]
if obs_list... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prune_influence_map; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 21; 5, 25; 5, 63; 5, 70; 5, 78; 5, 85; 5, 89; 5, 111; 5, 118; 5, 130; 5, 144; 5, 156; 5, 160; 5, 253; 5, 265; 6, expression_statement; 6, 7; 7, assignment; ... | def prune_influence_map(self):
im = self.get_im()
logger.info('Removing self loops')
edges_to_remove = []
for e in im.edges():
if e[0] == e[1]:
logger.info('Removing self loop: %s', e)
edges_to_remove.append((e[0], e[1]))
im.remove_edge... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:send_request; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:ndex_service_url; 5, identifier:params; 6, default_parameter; 6, 7; 6, 8; 7, identifier:is_json; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:use_get; 11, False;... | def send_request(ndex_service_url, params, is_json=True, use_get=False):
if use_get:
res = requests.get(ndex_service_url, json=params)
else:
res = requests.post(ndex_service_url, json=params)
status = res.status_code
if status == 200:
if is_json:
return res.json()
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_hash; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:shallow; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:refresh; 10, False; 11, block; 11, 12; 11, 114; 12, if_statement;... | def get_hash(self, shallow=True, refresh=False):
if shallow:
if not hasattr(self, '_shallow_hash') or self._shallow_hash is None\
or refresh:
self._shallow_hash = make_hash(self.matches_key(), 14)
ret = self._shallow_hash
else:
if n... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:to_json; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:use_sbo; 7, False; 8, block; 8, 9; 8, 18; 8, 31; 8, 55; 8, 64; 8, 72; 8, 97; 8, 107; 8, 129; 8, 151; 8, 200; 8, 220; 9, expression_statement... | def to_json(self, use_sbo=False):
stmt_type = type(self).__name__
all_stmts = [self] + self.supports + self.supported_by
for st in all_stmts:
if not hasattr(st, 'uuid'):
st.uuid = '%s' % uuid.uuid4()
json_dict = _o(type=stmt_type)
json_dict['belief'] =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:to_graph; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 225; 5, 233; 5, 241; 5, 253; 6, function_definition; 6, 7; 6, 8; 6, 12; 7, function_name:json_node; 8, parameters; 8, 9; 8, 10; 8, 11; 9, identifier:graph; 10, identifier:ele... | def to_graph(self):
def json_node(graph, element, prefix):
if not element:
return None
node_id = '|'.join(prefix)
if isinstance(element, list):
graph.add_node(node_id, label='')
for i, sub_element in enumerate(element):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_bel_stmts; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:filter; 7, False; 8, block; 8, 9; 8, 24; 8, 121; 8, 147; 9, if_statement; 9, 10; 9, 15; 10, comparison_operator:is; 10, 11; 10, 14; 11... | def get_bel_stmts(self, filter=False):
if self.basename is not None:
bel_stmt_path = '%s_bel_stmts.pkl' % self.basename
if self.basename is not None and os.path.isfile(bel_stmt_path):
logger.info("Loading BEL statements from %s" % bel_stmt_path)
with open(bel_stmt_pat... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:get_biopax_stmts; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:filter; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:query; 10, string:'pathsbetween'; 11, default_para... | def get_biopax_stmts(self, filter=False, query='pathsbetween',
database_filter=None):
if self.basename is not None:
biopax_stmt_path = '%s_biopax_stmts.pkl' % self.basename
biopax_ras_owl_path = '%s_pc_pathsbetween.owl' % self.basename
if self.basename is... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:run_preassembly; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:stmts; 6, default_parameter; 6, 7; 6, 8; 7, identifier:print_summary; 8, True; 9, block; 9, 10; 9, 18; 9, 25; 9, 31; 9, 38; 9, 51; 9, 55; 9, 87; 9, 93; 9, 101; ... | def run_preassembly(self, stmts, print_summary=True):
pa1 = Preassembler(hierarchies, stmts)
logger.info("Combining duplicates")
pa1.combine_duplicates()
logger.info("Mapping sites")
(valid, mapped) = sm.map_sites(pa1.unique_stmts)
correctly_mapped_stmts = []
for ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_get_grounding; 3, parameters; 3, 4; 4, identifier:entity; 5, block; 5, 6; 5, 15; 5, 24; 5, 30; 5, 100; 5, 117; 5, 121; 5, 146; 5, 186; 5, 195; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:db_refs; 9, dictionary; 9, 1... | def _get_grounding(entity):
db_refs = {'TEXT': entity['text']}
groundings = entity.get('grounding')
if not groundings:
return db_refs
def get_ont_concept(concept):
if concept.startswith('/'):
concept = concept[1:]
concept = concept.replace(' ', '_')
wh... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_is_statement_in_list; 3, parameters; 3, 4; 3, 5; 4, identifier:new_stmt; 5, identifier:old_stmt_list; 6, block; 6, 7; 6, 252; 7, for_statement; 7, 8; 7, 9; 7, 10; 8, identifier:old_stmt; 9, identifier:old_stmt_list; 10, block; 10, 11; 11, if_s... | def _is_statement_in_list(new_stmt, old_stmt_list):
for old_stmt in old_stmt_list:
if old_stmt.equals(new_stmt):
return True
elif old_stmt.evidence_equals(new_stmt) and old_stmt.matches(new_stmt):
if isinstance(new_stmt, Complex):
agent_pairs = zip(old_stmt.so... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_urn_to_db_refs; 3, parameters; 3, 4; 4, identifier:urn; 5, block; 5, 6; 5, 15; 5, 24; 5, 33; 5, 43; 5, 47; 5, 51; 5, 227; 5, 233; 5, 263; 5, 305; 5, 311; 5, 324; 5, 351; 6, if_statement; 6, 7; 6, 10; 7, comparison_operator:is; 7, 8; 7, 9; 8, i... | def _urn_to_db_refs(urn):
if urn is None:
return {}, None
m = URN_PATT.match(urn)
if m is None:
return None, None
urn_type, urn_id = m.groups()
db_refs = {}
db_name = None
if urn_type == 'agi-cas':
chebi_id = get_chebi_id_from_cas(urn_id)
if chebi_id:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:symmetricsys; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:dep_tr; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:indep_tr; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identifier:Su... | def symmetricsys(dep_tr=None, indep_tr=None, SuperClass=TransformedSys, **kwargs):
if dep_tr is not None:
if not callable(dep_tr[0]) or not callable(dep_tr[1]):
raise ValueError("Exceptected dep_tr to be a pair of callables")
if indep_tr is not None:
if not callable(indep_tr[0]) or n... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:from_other; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:ori; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 45; 8, 66; 8, 87; 8, 120; 8, 153; 8, 172; 8, 185; 8, 193; 8, 217; 9, for_statement; 9... | def from_other(cls, ori, **kwargs):
for k in cls._attrs_to_copy + ('params', 'roots', 'init_indep', 'init_dep'):
if k not in kwargs:
val = getattr(ori, k)
if val is not None:
kwargs[k] = val
if 'lower_bounds' not in kwargs and getattr(ori, ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:from_linear_invariants; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:cls; 5, identifier:ori_sys; 6, default_parameter; 6, 7; 6, 8; 7, identifier:preferred; 8, None; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwargs; 11, block; ... | def from_linear_invariants(cls, ori_sys, preferred=None, **kwargs):
_be = ori_sys.be
A = _be.Matrix(ori_sys.linear_invariants)
rA, pivots = A.rref()
if len(pivots) < A.shape[0]:
raise NotImplementedError("Linear invariants contain linear dependencies.")
per_row_cols =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:chained_parameter_variation; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:subject; 5, identifier:durations; 6, identifier:y0; 7, identifier:varied_params; 8, default_parameter; 8, 9; 8, 10; 9, identifi... | def chained_parameter_variation(subject, durations, y0, varied_params, default_params=None,
integrate_kwargs=None, x0=None, npoints=1, numpy=None):
assert len(durations) > 0, 'need at least 1 duration (preferably many)'
assert npoints > 0, 'need at least 1 point per duration'
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:integrate; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:self; 5, identifier:x; 6, identifier:y0; 7, default_parameter; 7, 8; 7, 9; 8, identifier:params; 9, tuple; 10, default_parameter; 10, 11; 10, 12; 11, identifi... | def integrate(self, x, y0, params=(), atol=1e-8, rtol=1e-8, **kwargs):
arrs = self.to_arrays(x, y0, params)
_x, _y, _p = _arrs = self.pre_process(*arrs)
ndims = [a.ndim for a in _arrs]
if ndims == [1, 1, 1]:
twodim = False
elif ndims == [2, 2, 2]:
twodim =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sort_data; 3, parameters; 3, 4; 3, 5; 4, identifier:data; 5, identifier:cols; 6, block; 6, 7; 7, return_statement; 7, 8; 8, call; 8, 9; 8, 22; 9, attribute; 9, 10; 9, 21; 10, subscript; 10, 11; 10, 17; 11, call; 11, 12; 11, 15; 12, attribute; 1... | def sort_data(data, cols):
return data.sort_values(cols)[cols + ['value']].reset_index(drop=True) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:filter_by_meta; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:data; 5, identifier:df; 6, default_parameter; 6, 7; 6, 8; 7, identifier:join_meta; 8, False; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwargs; 11, block; 11, 12; 11,... | def filter_by_meta(data, df, join_meta=False, **kwargs):
if not set(META_IDX).issubset(data.index.names + list(data.columns)):
raise ValueError('missing required index dimensions or columns!')
meta = pd.DataFrame(df.meta[list(set(kwargs) - set(META_IDX))].copy())
keep = np.array([True] * len(meta))
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:append; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:other; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ignore_meta_conflict; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:inplace; 11, Fals... | def append(self, other, ignore_meta_conflict=False, inplace=False,
**kwargs):
if not isinstance(other, IamDataFrame):
other = IamDataFrame(other, **kwargs)
ignore_meta_conflict = True
if self.time_col is not other.time_col:
raise ValueError('incompatibl... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:pivot_table; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:self; 5, identifier:index; 6, identifier:columns; 7, default_parameter; 7, 8; 7, 9; 8, identifier:values; 9, string:'value'; 10, default_parameter; 10, 11; ... | def pivot_table(self, index, columns, values='value',
aggfunc='count', fill_value=None, style=None):
index = [index] if isstr(index) else index
columns = [columns] if isstr(columns) else columns
df = self.data
if isstr(aggfunc):
if aggfunc == 'count':
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:check_internal_consistency; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 12; 7, 68; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:inconsi... | def check_internal_consistency(self, **kwargs):
inconsistent_vars = {}
for variable in self.variables():
diff_agg = self.check_aggregate(variable, **kwargs)
if diff_agg is not None:
inconsistent_vars[variable + "-aggregate"] = diff_agg
diff_regional = ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_apply_filters; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:filters; 7, block; 7, 8; 7, 18; 7, 35; 7, 432; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:regexp; 11... | def _apply_filters(self, **filters):
regexp = filters.pop('regexp', False)
keep = np.array([True] * len(self.data))
for col, values in filters.items():
if values is None:
continue
if col in self.meta.columns:
matches = pattern_match(self.me... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:load_metadata; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 8; 4, identifier:self; 5, identifier:path; 6, list_splat_pattern; 6, 7; 7, identifier:args; 8, dictionary_splat_pattern; 8, 9; 9, identifier:kwargs; 10, block; 10, 11; 10, 31; 10, 96; 10, 103;... | def load_metadata(self, path, *args, **kwargs):
if not os.path.exists(path):
raise ValueError("no metadata file '" + path + "' found!")
if path.endswith('csv'):
df = pd.read_csv(path, *args, **kwargs)
else:
xl = pd.ExcelFile(path)
if len(xl.sheet_n... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:assign_style_props; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:df; 5, default_parameter; 5, 6; 5, 7; 6, identifier:color; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:marker; 10, None; 11, default_parameter; 11, ... | def assign_style_props(df, color=None, marker=None, linestyle=None,
cmap=None):
if color is None and cmap is not None:
raise ValueError('`cmap` must be provided with the `color` argument')
n = len(df[color].unique()) if color in df.columns else \
len(df[list(set(df.columns... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 38; 2, function_name:scatter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 3, 33; 3, 36; 4, identifier:df; 5, identifier:x; 6, identifier:y; 7, default_parameter; 7, 8; 7, 9; 8, identifier:ax; 9, None; 10, default_paramet... | def scatter(df, x, y, ax=None, legend=None, title=None,
color=None, marker='o', linestyle=None, cmap=None,
groupby=['model', 'scenario'], with_lines=False, **kwargs):
if ax is None:
fig, ax = plt.subplots()
props = assign_style_props(df, color=color, marker=marker,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:config_create; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:kernel; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:label; 10, None; 11, default_para... | def config_create(self, kernel=None, label=None, devices=[], disks=[],
volumes=[], **kwargs):
from .volume import Volume
hypervisor_prefix = 'sd' if self.hypervisor == 'kvm' else 'xvd'
device_names = [hypervisor_prefix + string.ascii_lowercase[i] for i in range(0, 8)]
device_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:clone; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:to_linode; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:region; 10, None; 11, de... | def clone(self, to_linode=None, region=None, service=None, configs=[], disks=[],
label=None, group=None, with_backups=None):
if to_linode and region:
raise ValueError('You may only specify one of "to_linode" and "region"')
if region and not service:
raise ValueError('... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_populate; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:json; 6, block; 6, 7; 6, 12; 6, 20; 6, 404; 6, 412; 7, if_statement; 7, 8; 7, 10; 8, not_operator; 8, 9; 9, identifier:json; 10, block; 10, 11; 11, return_statement; 12, ex... | def _populate(self, json):
if not json:
return
self._set('_raw_json', json)
for key in json:
if key in (k for k in type(self).properties.keys()
if not type(self).properties[k].identifier):
if type(self).properties[key].relationship \
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:_api_call; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:endpoint; 6, default_parameter; 6, 7; 6, 8; 7, identifier:model; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:method; 11, None; 12... | def _api_call(self, endpoint, model=None, method=None, data=None, filters=None):
if not self.token:
raise RuntimeError("You do not have an API token!")
if not method:
raise ValueError("Method is required for API calls!")
if model:
endpoint = endpoint.format(**... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:tag_create; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:label; 6, default_parameter; 6, 7; 6, 8; 7, identifier:instances; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:domains; 11... | def tag_create(self, label, instances=None, domains=None, nodebalancers=None,
volumes=None, entities=[]):
linode_ids, nodebalancer_ids, domain_ids, volume_ids = [], [], [], []
sorter = zip((linode_ids, nodebalancer_ids, domain_ids, volume_ids),
(instances, nodebal... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:validate_anneal_schedule; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:anneal_schedule; 6, block; 6, 7; 6, 19; 6, 25; 6, 49; 6, 96; 6, 116; 6, 143; 6, 161; 6, 174; 6, 184; 6, 236; 6, 242; 7, if_statement; 7, 8; 7, 13; 8, compari... | def validate_anneal_schedule(self, anneal_schedule):
if 'anneal_schedule' not in self.parameters:
raise RuntimeError("anneal_schedule is not an accepted parameter for this sampler")
properties = self.properties
try:
min_anneal_time, max_anneal_time = properties['annealing... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:target_to_source; 3, parameters; 3, 4; 3, 5; 4, identifier:target_adjacency; 5, identifier:embedding; 6, block; 6, 7; 6, 19; 6, 23; 6, 57; 6, 112; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:source_adjacency; 10, di... | def target_to_source(target_adjacency, embedding):
source_adjacency = {v: set() for v in embedding}
reverse_embedding = {}
for v, chain in iteritems(embedding):
for u in chain:
if u in reverse_embedding:
raise ValueError("target node {} assigned to more than one source no... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:insert_graph; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:cur; 5, identifier:nodelist; 6, identifier:edgelist; 7, default_parameter; 7, 8; 7, 9; 8, identifier:encoded_data; 9, None; 10, block; 10, 11; 10, 20; 10, 34; 10, 48; 10, 69; 1... | def insert_graph(cur, nodelist, edgelist, encoded_data=None):
if encoded_data is None:
encoded_data = {}
if 'num_nodes' not in encoded_data:
encoded_data['num_nodes'] = len(nodelist)
if 'num_edges' not in encoded_data:
encoded_data['num_edges'] = len(edgelist)
if 'edges' not in e... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:draw_chimera_bqm; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:bqm; 5, default_parameter; 5, 6; 5, 7; 6, identifier:width; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:height; 10, None; 11, block; 11, 12; 11, 22; 11, 32; 11, 67;... | def draw_chimera_bqm(bqm, width=None, height=None):
linear = bqm.linear.keys()
quadratic = bqm.quadratic.keys()
if width is None and height is None:
graph_size = ceil(sqrt((max(linear) + 1) / 8.0))
width = graph_size
height = graph_size
if not width or not height:
raise E... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:embed_bqm; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:source_bqm; 5, identifier:embedding; 6, identifier:target_adjacency; 7, default_parameter; 7, 8; 7, 9; 8, identifier:chain_strength; 9, float:1.0; 10, default_parameter; 10... | def embed_bqm(source_bqm, embedding, target_adjacency, chain_strength=1.0,
smear_vartype=None):
if smear_vartype is dimod.SPIN and source_bqm.vartype is dimod.BINARY:
return embed_bqm(source_bqm.spin, embedding, target_adjacency,
chain_strength=chain_strength, smear_va... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:embed_ising; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:source_h; 5, identifier:source_J; 6, identifier:embedding; 7, identifier:target_adjacency; 8, default_parameter; 8, 9; 8, 10; 9, identifier:chain_strength; 10, float:1.0; ... | def embed_ising(source_h, source_J, embedding, target_adjacency, chain_strength=1.0):
source_bqm = dimod.BinaryQuadraticModel.from_ising(source_h, source_J)
target_bqm = embed_bqm(source_bqm, embedding, target_adjacency, chain_strength=chain_strength)
target_h, target_J, __ = target_bqm.to_ising()
retur... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:unembed_sampleset; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:target_sampleset; 5, identifier:embedding; 6, identifier:source_bqm; 7, default_parameter; 7, 8; 7, 9; 8, identifier:chain_break_method; 9, None; 10, default_parame... | def unembed_sampleset(target_sampleset, embedding, source_bqm,
chain_break_method=None, chain_break_fraction=False):
if chain_break_method is None:
chain_break_method = majority_vote
variables = list(source_bqm)
try:
chains = [embedding[v] for v in variables]
except... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:nativeCliqueEmbed; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:width; 6, block; 6, 7; 6, 11; 6, 23; 6, 27; 6, 31; 6, 35; 6, 153; 6, 157; 6, 193; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:maxCWR; 1... | def nativeCliqueEmbed(self, width):
maxCWR = {}
M, N = self.M, self.N
maxscore = None
count = 0
key = None
for w in range(width + 2):
h = width - w - 2
for ymin in range(N - h):
ymax = ymin + h
for xmin in range(M - ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:find_clique_embedding; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:k; 5, identifier:m; 6, default_parameter; 6, 7; 6, 8; 7, identifier:n; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:t; 11, None; 12, default_para... | def find_clique_embedding(k, m, n=None, t=None, target_edges=None):
import random
_, nodes = k
m, n, t, target_edges = _chimera_input(m, n, t, target_edges)
if len(nodes) == 1:
qubits = set().union(*target_edges)
qubit = random.choice(tuple(qubits))
embedding = [[qubit]]
elif... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:find_grid_embedding; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:dim; 5, identifier:m; 6, default_parameter; 6, 7; 6, 8; 7, identifier:n; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:t; 11, integer:4; 12, block; 12, 13;... | def find_grid_embedding(dim, m, n=None, t=4):
m, n, t, target_edges = _chimera_input(m, n, t, None)
indexer = dnx.generators.chimera.chimera_coordinates(m, n, t)
dim = list(dim)
num_dim = len(dim)
if num_dim == 1:
def _key(row, col, aisle): return row
dim.extend([1, 1])
elif num_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sample; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:bqm; 6, dictionary_splat_pattern; 6, 7; 7, identifier:parameters; 8, block; 8, 9; 8, 15; 8, 21; 8, 27; 8, 33; 8, 54; 8, 100; 8, 115; 8, 122; 8, 152; 8, 173; 8, 203; 8, 2... | def sample(self, bqm, **parameters):
child = self.child
cutoff = self._cutoff
cutoff_vartype = self._cutoff_vartype
comp = self._comparison
if cutoff_vartype is dimod.SPIN:
original = bqm.spin
else:
original = bqm.binary
new = type(bqm)(ori... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sample_poly; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:poly; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 15; 8, 21; 8, 27; 8, 33; 8, 64; 8, 104; 8, 128; 8, 144; 8, 171; 8, 192; 8, 222; 8,... | def sample_poly(self, poly, **kwargs):
child = self.child
cutoff = self._cutoff
cutoff_vartype = self._cutoff_vartype
comp = self._comparison
if cutoff_vartype is dimod.SPIN:
original = poly.to_spin(copy=False)
else:
original = poly.to_binary(copy=... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:diagnose_embedding; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:emb; 5, identifier:source; 6, identifier:target; 7, block; 7, 8; 7, 25; 7, 42; 7, 46; 7, 52; 7, 169; 7, 177; 7, 204; 8, if_statement; 8, 9; 8, 15; 9, not_operator; 9, 10; 10, ca... | def diagnose_embedding(emb, source, target):
if not hasattr(source, 'edges'):
source = nx.Graph(source)
if not hasattr(target, 'edges'):
target = nx.Graph(target)
label = {}
embedded = set()
for x in source:
try:
embx = emb[x]
missing_chain = len(embx)... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:response; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 13; 3, 16; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:model; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:code; 10, attribute; 10, 11; 10, 12; 11, identifier:H... | def response(self, model=None, code=HTTPStatus.OK, description=None, **kwargs):
code = HTTPStatus(code)
if code is HTTPStatus.NO_CONTENT:
assert model is None
if model is None and code not in {HTTPStatus.ACCEPTED, HTTPStatus.NO_CONTENT}:
if code.value not in http_exceptio... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:enrich_items; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:ocean_backend; 6, default_parameter; 6, 7; 6, 8; 7, identifier:events; 8, False; 9, block; 9, 10; 9, 18; 9, 22; 9, 26; 9, 30; 9, 38; 9, 42; 9, 52; 9, 68; 9, 236; 9... | def enrich_items(self, ocean_backend, events=False):
max_items = self.elastic.max_items_bulk
current = 0
total = 0
bulk_json = ""
items = ocean_backend.fetch()
images_items = {}
url = self.elastic.index_url + '/items/_bulk'
logger.debug("Adding items to %s... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:add_identity; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:cls; 5, identifier:db; 6, identifier:identity; 7, identifier:backend; 8, block; 8, 9; 8, 13; 8, 154; 8, 204; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, ... | def add_identity(cls, db, identity, backend):
uuid = None
try:
uuid = api.add_identity(db, backend, identity['email'],
identity['name'], identity['username'])
logger.debug("New sortinghat identity %s %s,%s,%s ",
uuid, i... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:add_identities; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:cls; 5, identifier:db; 6, identifier:identities; 7, identifier:backend; 8, block; 8, 9; 8, 16; 8, 20; 8, 55; 9, expression_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attr... | def add_identities(cls, db, identities, backend):
logger.info("Adding the identities to SortingHat")
total = 0
for identity in identities:
try:
cls.add_identity(db, identity, backend)
total += 1
except Exception as e:
logger... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:remove_identity; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:sh_db; 6, identifier:ident_id; 7, block; 7, 8; 7, 12; 7, 51; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:success; 11, False; 12, t... | def remove_identity(cls, sh_db, ident_id):
success = False
try:
api.delete_identity(sh_db, ident_id)
logger.debug("Identity %s deleted", ident_id)
success = True
except Exception as e:
logger.debug("Identity not deleted due to %s", str(e))
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:remove_unique_identity; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:sh_db; 6, identifier:uuid; 7, block; 7, 8; 7, 12; 7, 51; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:success; 11, False; 12... | def remove_unique_identity(cls, sh_db, uuid):
success = False
try:
api.delete_unique_identity(sh_db, uuid)
logger.debug("Unique identity %s deleted", uuid)
success = True
except Exception as e:
logger.debug("Unique identity not deleted due to %s", ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:unique_identities; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:sh_db; 6, block; 6, 7; 7, try_statement; 7, 8; 7, 21; 8, block; 8, 9; 9, for_statement; 9, 10; 9, 11; 9, 17; 10, identifier:unique_identity; 11, call; 11, 12; 11, 15... | def unique_identities(cls, sh_db):
try:
for unique_identity in api.unique_identities(sh_db):
yield unique_identity
except Exception as e:
logger.debug("Unique identities not returned from SortingHat due to %s", str(e)) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:refresh_identities; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:enrich_backend; 5, default_parameter; 5, 6; 5, 7; 6, identifier:author_field; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:author_values; 10, None; 11, block; 11, ... | def refresh_identities(enrich_backend, author_field=None, author_values=None):
def update_items(new_filter_author):
for eitem in enrich_backend.fetch(new_filter_author):
roles = None
try:
roles = enrich_backend.roles
except AttributeError:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 13; 2, function_name:get_ocean_backend; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 4, identifier:backend_cmd; 5, identifier:enrich_backend; 6, identifier:no_incremental; 7, default_parameter; 7, 8; 7, 9; 8, identifier:filter_raw; 9, None; 10, default_parameter;... | def get_ocean_backend(backend_cmd, enrich_backend, no_incremental,
filter_raw=None, filter_raw_should=None):
if no_incremental:
last_enrich = None
else:
last_enrich = get_last_enrich(backend_cmd, enrich_backend, filter_raw=filter_raw)
logger.debug("Last enrichment: %s",... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:delete_orphan_unique_identities; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:es; 5, identifier:sortinghat_db; 6, identifier:current_data_source; 7, identifier:active_data_sources; 8, block; 8, 9; 8, 73; 8, 107; 8, 153; 8, 183; 8, 187; ... | def delete_orphan_unique_identities(es, sortinghat_db, current_data_source, active_data_sources):
def get_uuids_in_index(target_uuids):
page = es.search(
index=IDENTITIES_INDEX,
scroll="360m",
size=SIZE_SCROLL_IDENTITIES_INDEX,
body={
"query": ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:delete_inactive_unique_identities; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:es; 5, identifier:sortinghat_db; 6, identifier:before_date; 7, block; 7, 8; 7, 40; 7, 46; 7, 54; 7, 69; 7, 73; 7, 144; 8, expression_statement; 8, 9; 9, assignmen... | def delete_inactive_unique_identities(es, sortinghat_db, before_date):
page = es.search(
index=IDENTITIES_INDEX,
scroll="360m",
size=SIZE_SCROLL_IDENTITIES_INDEX,
body={
"query": {
"range": {
"last_seen": {
"lte"... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:retain_identities; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:retention_time; 5, identifier:es_enrichment_url; 6, identifier:sortinghat_db; 7, identifier:data_source; 8, identifier:active_data_sources; 9, block; 9, 10; 9, 19; 9,... | def retain_identities(retention_time, es_enrichment_url, sortinghat_db, data_source, active_data_sources):
before_date = get_diff_current_date(minutes=retention_time)
before_date_str = before_date.isoformat()
es = Elasticsearch([es_enrichment_url], timeout=120, max_retries=20, retry_on_timeout=True, verify_... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_review_sh; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:revision; 6, identifier:item; 7, block; 7, 8; 7, 17; 7, 32; 7, 42; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:identity; 11, call; ... | def get_review_sh(self, revision, item):
identity = self.get_sh_identity(revision)
update = parser.parse(item[self.get_field_date()])
erevision = self.get_item_sh_fields(identity, update)
return erevision |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:get_item_sh; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:item; 6, default_parameter; 6, 7; 6, 8; 7, identifier:roles; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:date_field; 11, None; 12, block; 12,... | def get_item_sh(self, item, roles=None, date_field=None):
eitem_sh = {}
author_field = self.get_field_author()
if not roles:
roles = [author_field]
if not date_field:
item_date = str_to_datetime(item[self.get_field_date()])
else:
item_date = st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.