repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
rackerlabs/fastfood | fastfood/exc.py | get_friendly_title | def get_friendly_title(err):
"""Turn class, instance, or name (str) into an eyeball-friendly title.
E.g. FastfoodStencilSetNotListed --> 'Stencil Set Not Listed'
"""
if isinstance(err, basestring):
string = err
else:
try:
string = err.__name__
except AttributeErr... | python | def get_friendly_title(err):
"""Turn class, instance, or name (str) into an eyeball-friendly title.
E.g. FastfoodStencilSetNotListed --> 'Stencil Set Not Listed'
"""
if isinstance(err, basestring):
string = err
else:
try:
string = err.__name__
except AttributeErr... | [
"def",
"get_friendly_title",
"(",
"err",
")",
":",
"if",
"isinstance",
"(",
"err",
",",
"basestring",
")",
":",
"string",
"=",
"err",
"else",
":",
"try",
":",
"string",
"=",
"err",
".",
"__name__",
"except",
"AttributeError",
":",
"string",
"=",
"err",
... | Turn class, instance, or name (str) into an eyeball-friendly title.
E.g. FastfoodStencilSetNotListed --> 'Stencil Set Not Listed' | [
"Turn",
"class",
"instance",
"or",
"name",
"(",
"str",
")",
"into",
"an",
"eyeball",
"-",
"friendly",
"title",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/exc.py#L55-L73 |
rackerlabs/fastfood | fastfood/pack.py | TemplatePack._validate | def _validate(self, key, cls=None):
"""Verify the manifest schema."""
if key not in self.manifest:
raise ValueError("Manifest %s requires '%s'."
% (self.manifest_path, key))
if cls:
if not isinstance(self.manifest[key], cls):
r... | python | def _validate(self, key, cls=None):
"""Verify the manifest schema."""
if key not in self.manifest:
raise ValueError("Manifest %s requires '%s'."
% (self.manifest_path, key))
if cls:
if not isinstance(self.manifest[key], cls):
r... | [
"def",
"_validate",
"(",
"self",
",",
"key",
",",
"cls",
"=",
"None",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"manifest",
":",
"raise",
"ValueError",
"(",
"\"Manifest %s requires '%s'.\"",
"%",
"(",
"self",
".",
"manifest_path",
",",
"key",
")",... | Verify the manifest schema. | [
"Verify",
"the",
"manifest",
"schema",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/pack.py#L48-L56 |
rackerlabs/fastfood | fastfood/pack.py | TemplatePack.stencil_sets | def stencil_sets(self):
"""List of stencil sets."""
if not self._stencil_sets:
self._stencil_sets = self.manifest['stencil_sets']
return self._stencil_sets | python | def stencil_sets(self):
"""List of stencil sets."""
if not self._stencil_sets:
self._stencil_sets = self.manifest['stencil_sets']
return self._stencil_sets | [
"def",
"stencil_sets",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_stencil_sets",
":",
"self",
".",
"_stencil_sets",
"=",
"self",
".",
"manifest",
"[",
"'stencil_sets'",
"]",
"return",
"self",
".",
"_stencil_sets"
] | List of stencil sets. | [
"List",
"of",
"stencil",
"sets",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/pack.py#L67-L71 |
rackerlabs/fastfood | fastfood/pack.py | TemplatePack.load_stencil_set | def load_stencil_set(self, stencilset_name):
"""Return the Stencil Set from this template pack."""
if stencilset_name not in self._stencil_sets:
if stencilset_name not in self.manifest['stencil_sets'].keys():
raise exc.FastfoodStencilSetNotListed(
"Stencil... | python | def load_stencil_set(self, stencilset_name):
"""Return the Stencil Set from this template pack."""
if stencilset_name not in self._stencil_sets:
if stencilset_name not in self.manifest['stencil_sets'].keys():
raise exc.FastfoodStencilSetNotListed(
"Stencil... | [
"def",
"load_stencil_set",
"(",
"self",
",",
"stencilset_name",
")",
":",
"if",
"stencilset_name",
"not",
"in",
"self",
".",
"_stencil_sets",
":",
"if",
"stencilset_name",
"not",
"in",
"self",
".",
"manifest",
"[",
"'stencil_sets'",
"]",
".",
"keys",
"(",
")... | Return the Stencil Set from this template pack. | [
"Return",
"the",
"Stencil",
"Set",
"from",
"this",
"template",
"pack",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/pack.py#L89-L100 |
rackerlabs/fastfood | fastfood/templating.py | qstring | def qstring(option):
"""Custom quoting method for jinja."""
if (re.match(NODE_ATTR_RE, option) is None and
re.match(CHEF_CONST_RE, option) is None):
return "'%s'" % option
else:
return option | python | def qstring(option):
"""Custom quoting method for jinja."""
if (re.match(NODE_ATTR_RE, option) is None and
re.match(CHEF_CONST_RE, option) is None):
return "'%s'" % option
else:
return option | [
"def",
"qstring",
"(",
"option",
")",
":",
"if",
"(",
"re",
".",
"match",
"(",
"NODE_ATTR_RE",
",",
"option",
")",
"is",
"None",
"and",
"re",
".",
"match",
"(",
"CHEF_CONST_RE",
",",
"option",
")",
"is",
"None",
")",
":",
"return",
"\"'%s'\"",
"%",
... | Custom quoting method for jinja. | [
"Custom",
"quoting",
"method",
"for",
"jinja",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/templating.py#L31-L37 |
rackerlabs/fastfood | fastfood/templating.py | render_templates_generator | def render_templates_generator(*files, **template_map):
"""Render jinja templates according to template_map.
Yields (path, result)
"""
for path in files:
if not os.path.isfile(path):
raise ValueError("Template file %s not found"
% os.path.relpath(path))
... | python | def render_templates_generator(*files, **template_map):
"""Render jinja templates according to template_map.
Yields (path, result)
"""
for path in files:
if not os.path.isfile(path):
raise ValueError("Template file %s not found"
% os.path.relpath(path))
... | [
"def",
"render_templates_generator",
"(",
"*",
"files",
",",
"*",
"*",
"template_map",
")",
":",
"for",
"path",
"in",
"files",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"raise",
"ValueError",
"(",
"\"Template file %s not fo... | Render jinja templates according to template_map.
Yields (path, result) | [
"Render",
"jinja",
"templates",
"according",
"to",
"template_map",
"."
] | train | https://github.com/rackerlabs/fastfood/blob/543970c4cedbb3956e84a7986469fdd7e4ee8fc8/fastfood/templating.py#L51-L75 |
moltob/pymultigen | multigen/generator.py | Generator.generate | def generate(self, model, outfolder):
"""
Generate artifacts for given model.
Attributes:
model:
Model for which to generate code.
outfolder:
Folder where code files are created.
"""
_logger.info('Generating code t... | python | def generate(self, model, outfolder):
"""
Generate artifacts for given model.
Attributes:
model:
Model for which to generate code.
outfolder:
Folder where code files are created.
"""
_logger.info('Generating code t... | [
"def",
"generate",
"(",
"self",
",",
"model",
",",
"outfolder",
")",
":",
"_logger",
".",
"info",
"(",
"'Generating code to {!r}.'",
".",
"format",
"(",
"outfolder",
")",
")",
"for",
"task",
"in",
"self",
".",
"tasks",
":",
"for",
"element",
"in",
"task"... | Generate artifacts for given model.
Attributes:
model:
Model for which to generate code.
outfolder:
Folder where code files are created. | [
"Generate",
"artifacts",
"for",
"given",
"model",
".",
"Attributes",
":",
"model",
":",
"Model",
"for",
"which",
"to",
"generate",
"code",
".",
"outfolder",
":",
"Folder",
"where",
"code",
"files",
"are",
"created",
"."
] | train | https://github.com/moltob/pymultigen/blob/3095c7579ab29199cb421b2e70d3088067a450bd/multigen/generator.py#L25-L39 |
moltob/pymultigen | multigen/generator.py | Task.run | def run(self, element, outfolder):
"""Apply this task to model element."""
filepath = self.relative_path_for_element(element)
if outfolder and not os.path.isabs(filepath):
filepath = os.path.join(outfolder, filepath)
_logger.debug('{!r} --> {!r}'.format(element, filepath))
... | python | def run(self, element, outfolder):
"""Apply this task to model element."""
filepath = self.relative_path_for_element(element)
if outfolder and not os.path.isabs(filepath):
filepath = os.path.join(outfolder, filepath)
_logger.debug('{!r} --> {!r}'.format(element, filepath))
... | [
"def",
"run",
"(",
"self",
",",
"element",
",",
"outfolder",
")",
":",
"filepath",
"=",
"self",
".",
"relative_path_for_element",
"(",
"element",
")",
"if",
"outfolder",
"and",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"filepath",
")",
":",
"filepath"... | Apply this task to model element. | [
"Apply",
"this",
"task",
"to",
"model",
"element",
"."
] | train | https://github.com/moltob/pymultigen/blob/3095c7579ab29199cb421b2e70d3088067a450bd/multigen/generator.py#L56-L65 |
moltob/pymultigen | multigen/generator.py | TemplateFileTask.create_template_context | def create_template_context(self, element, **kwargs):
"""Code generation context, specific to template and current element."""
context = dict(element=element, **kwargs)
if self.global_context:
context.update(**self.global_context)
return context | python | def create_template_context(self, element, **kwargs):
"""Code generation context, specific to template and current element."""
context = dict(element=element, **kwargs)
if self.global_context:
context.update(**self.global_context)
return context | [
"def",
"create_template_context",
"(",
"self",
",",
"element",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"dict",
"(",
"element",
"=",
"element",
",",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"global_context",
":",
"context",
".",
"update",
... | Code generation context, specific to template and current element. | [
"Code",
"generation",
"context",
"specific",
"to",
"template",
"and",
"current",
"element",
"."
] | train | https://github.com/moltob/pymultigen/blob/3095c7579ab29199cb421b2e70d3088067a450bd/multigen/generator.py#L113-L118 |
podhmo/swagger-marshmallow-codegen | examples/05custom/myschema.py | ObjectId._validated | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
if isinstance(value, bson.ObjectId):
return value
try:
return bson.ObjectId(value)
except (ValueError, Attri... | python | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
if isinstance(value, bson.ObjectId):
return value
try:
return bson.ObjectId(value)
except (ValueError, Attri... | [
"def",
"_validated",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"bson",
".",
"ObjectId",
")",
":",
"return",
"value",
"try",
":",
"return",
"bson",
".",
"ObjectId",
... | Format the value or raise a :exc:`ValidationError` if an error occurs. | [
"Format",
"the",
"value",
"or",
"raise",
"a",
":",
"exc",
":",
"ValidationError",
"if",
"an",
"error",
"occurs",
"."
] | train | https://github.com/podhmo/swagger-marshmallow-codegen/blob/16d3373991c247b09e10b6f8f524db0c498283e8/examples/05custom/myschema.py#L16-L25 |
moltob/pymultigen | multigen/jinja.py | JinjaGenerator.create_environment | def create_environment(self, **kwargs):
"""
Return a new Jinja environment.
Derived classes may override method to pass additional parameters or to change the template
loader type.
"""
return jinja2.Environment(
loader=jinja2.FileSystemLoader(self.tem... | python | def create_environment(self, **kwargs):
"""
Return a new Jinja environment.
Derived classes may override method to pass additional parameters or to change the template
loader type.
"""
return jinja2.Environment(
loader=jinja2.FileSystemLoader(self.tem... | [
"def",
"create_environment",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"jinja2",
".",
"Environment",
"(",
"loader",
"=",
"jinja2",
".",
"FileSystemLoader",
"(",
"self",
".",
"templates_path",
")",
",",
"*",
"*",
"kwargs",
")"
] | Return a new Jinja environment.
Derived classes may override method to pass additional parameters or to change the template
loader type. | [
"Return",
"a",
"new",
"Jinja",
"environment",
".",
"Derived",
"classes",
"may",
"override",
"method",
"to",
"pass",
"additional",
"parameters",
"or",
"to",
"change",
"the",
"template",
"loader",
"type",
"."
] | train | https://github.com/moltob/pymultigen/blob/3095c7579ab29199cb421b2e70d3088067a450bd/multigen/jinja.py#L18-L28 |
gabrielelanaro/chemview | chemview/gg.py | pairs | def pairs(a):
"""Return array of pairs of adjacent elements in a.
>>> pairs([1, 2, 3, 4])
array([[1, 2],
[2, 3],
[3, 4]])
"""
a = np.asarray(a)
return as_strided(a, shape=(a.size - 1, 2), strides=a.strides * 2) | python | def pairs(a):
"""Return array of pairs of adjacent elements in a.
>>> pairs([1, 2, 3, 4])
array([[1, 2],
[2, 3],
[3, 4]])
"""
a = np.asarray(a)
return as_strided(a, shape=(a.size - 1, 2), strides=a.strides * 2) | [
"def",
"pairs",
"(",
"a",
")",
":",
"a",
"=",
"np",
".",
"asarray",
"(",
"a",
")",
"return",
"as_strided",
"(",
"a",
",",
"shape",
"=",
"(",
"a",
".",
"size",
"-",
"1",
",",
"2",
")",
",",
"strides",
"=",
"a",
".",
"strides",
"*",
"2",
")"
... | Return array of pairs of adjacent elements in a.
>>> pairs([1, 2, 3, 4])
array([[1, 2],
[2, 3],
[3, 4]]) | [
"Return",
"array",
"of",
"pairs",
"of",
"adjacent",
"elements",
"in",
"a",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/gg.py#L240-L250 |
openvax/topiary | topiary/cli/protein_changes.py | transcript_sort_key | def transcript_sort_key(transcript):
"""
Key function used to sort transcripts. Taking the negative of
protein sequence length and nucleotide sequence length so that
the transcripts with longest sequences come first in the list. This couldn't
be accomplished with `reverse=True` since we're also sort... | python | def transcript_sort_key(transcript):
"""
Key function used to sort transcripts. Taking the negative of
protein sequence length and nucleotide sequence length so that
the transcripts with longest sequences come first in the list. This couldn't
be accomplished with `reverse=True` since we're also sort... | [
"def",
"transcript_sort_key",
"(",
"transcript",
")",
":",
"return",
"(",
"-",
"len",
"(",
"transcript",
".",
"protein_sequence",
")",
",",
"-",
"len",
"(",
"transcript",
".",
"sequence",
")",
",",
"transcript",
".",
"name",
")"
] | Key function used to sort transcripts. Taking the negative of
protein sequence length and nucleotide sequence length so that
the transcripts with longest sequences come first in the list. This couldn't
be accomplished with `reverse=True` since we're also sorting by
transcript name (which places TP53-001... | [
"Key",
"function",
"used",
"to",
"sort",
"transcripts",
".",
"Taking",
"the",
"negative",
"of",
"protein",
"sequence",
"length",
"and",
"nucleotide",
"sequence",
"length",
"so",
"that",
"the",
"transcripts",
"with",
"longest",
"sequences",
"come",
"first",
"in",... | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/cli/protein_changes.py#L44-L56 |
openvax/topiary | topiary/cli/protein_changes.py | best_transcript | def best_transcript(transcripts):
"""
Given a set of coding transcripts, choose the one with the longest
protein sequence and in cases of ties use the following tie-breaking
criteria:
- transcript sequence (including UTRs)
- transcript name (so TP53-001 should come before TP53-202)
"... | python | def best_transcript(transcripts):
"""
Given a set of coding transcripts, choose the one with the longest
protein sequence and in cases of ties use the following tie-breaking
criteria:
- transcript sequence (including UTRs)
- transcript name (so TP53-001 should come before TP53-202)
"... | [
"def",
"best_transcript",
"(",
"transcripts",
")",
":",
"assert",
"len",
"(",
"transcripts",
")",
">",
"0",
"sorted_list",
"=",
"sorted",
"(",
"transcripts",
",",
"key",
"=",
"transcript_sort_key",
")",
"return",
"sorted_list",
"[",
"0",
"]"
] | Given a set of coding transcripts, choose the one with the longest
protein sequence and in cases of ties use the following tie-breaking
criteria:
- transcript sequence (including UTRs)
- transcript name (so TP53-001 should come before TP53-202) | [
"Given",
"a",
"set",
"of",
"coding",
"transcripts",
"choose",
"the",
"one",
"with",
"the",
"longest",
"protein",
"sequence",
"and",
"in",
"cases",
"of",
"ties",
"use",
"the",
"following",
"tie",
"-",
"breaking",
"criteria",
":",
"-",
"transcript",
"sequence"... | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/cli/protein_changes.py#L58-L68 |
openvax/topiary | topiary/cli/args.py | predict_epitopes_from_args | def predict_epitopes_from_args(args):
"""
Returns an epitope collection from the given commandline arguments.
Parameters
----------
args : argparse.Namespace
Parsed commandline arguments for Topiary
"""
mhc_model = mhc_binding_predictor_from_args(args)
variants = variant_collect... | python | def predict_epitopes_from_args(args):
"""
Returns an epitope collection from the given commandline arguments.
Parameters
----------
args : argparse.Namespace
Parsed commandline arguments for Topiary
"""
mhc_model = mhc_binding_predictor_from_args(args)
variants = variant_collect... | [
"def",
"predict_epitopes_from_args",
"(",
"args",
")",
":",
"mhc_model",
"=",
"mhc_binding_predictor_from_args",
"(",
"args",
")",
"variants",
"=",
"variant_collection_from_args",
"(",
"args",
")",
"gene_expression_dict",
"=",
"rna_gene_expression_dict_from_args",
"(",
"a... | Returns an epitope collection from the given commandline arguments.
Parameters
----------
args : argparse.Namespace
Parsed commandline arguments for Topiary | [
"Returns",
"an",
"epitope",
"collection",
"from",
"the",
"given",
"commandline",
"arguments",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/cli/args.py#L68-L94 |
gabfl/password-generator-py | src/pwgenerator.py | get_random_word | def get_random_word(dictionary, min_word_length=3, max_word_length=8):
"""
Returns a random word from the dictionary
"""
while True:
# Choose a random word
word = choice(dictionary)
# Stop looping as soon as we have a valid candidate
if len(word) >= min_word_length a... | python | def get_random_word(dictionary, min_word_length=3, max_word_length=8):
"""
Returns a random word from the dictionary
"""
while True:
# Choose a random word
word = choice(dictionary)
# Stop looping as soon as we have a valid candidate
if len(word) >= min_word_length a... | [
"def",
"get_random_word",
"(",
"dictionary",
",",
"min_word_length",
"=",
"3",
",",
"max_word_length",
"=",
"8",
")",
":",
"while",
"True",
":",
"# Choose a random word",
"word",
"=",
"choice",
"(",
"dictionary",
")",
"# Stop looping as soon as we have a valid candida... | Returns a random word from the dictionary | [
"Returns",
"a",
"random",
"word",
"from",
"the",
"dictionary"
] | train | https://github.com/gabfl/password-generator-py/blob/cd59078fd3e6ea85b7acd9bfcf6d04014c0f7220/src/pwgenerator.py#L26-L38 |
gabfl/password-generator-py | src/pwgenerator.py | pw | def pw(min_word_length=3, max_word_length=8, max_int_value=1000, number_of_elements=4, no_special_characters=False):
"""
Generate a password
"""
# Set the position of the integer
int_position = set_int_position(number_of_elements)
# Load dictionary
dictionary = load_dictionary()
p... | python | def pw(min_word_length=3, max_word_length=8, max_int_value=1000, number_of_elements=4, no_special_characters=False):
"""
Generate a password
"""
# Set the position of the integer
int_position = set_int_position(number_of_elements)
# Load dictionary
dictionary = load_dictionary()
p... | [
"def",
"pw",
"(",
"min_word_length",
"=",
"3",
",",
"max_word_length",
"=",
"8",
",",
"max_int_value",
"=",
"1000",
",",
"number_of_elements",
"=",
"4",
",",
"no_special_characters",
"=",
"False",
")",
":",
"# Set the position of the integer",
"int_position",
"=",... | Generate a password | [
"Generate",
"a",
"password"
] | train | https://github.com/gabfl/password-generator-py/blob/cd59078fd3e6ea85b7acd9bfcf6d04014c0f7220/src/pwgenerator.py#L71-L96 |
gabfl/password-generator-py | src/pwgenerator.py | main | def main():
"""
Main method
"""
# Options
global args
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--min_word_length", type=int,
help="Minimum length for each word", default=3)
parser.add_argument("-x", "--max_word_length", type=int,
... | python | def main():
"""
Main method
"""
# Options
global args
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--min_word_length", type=int,
help="Minimum length for each word", default=3)
parser.add_argument("-x", "--max_word_length", type=int,
... | [
"def",
"main",
"(",
")",
":",
"# Options",
"global",
"args",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"-n\"",
",",
"\"--min_word_length\"",
",",
"type",
"=",
"int",
",",
"help",
"=",
"\"Minimum length ... | Main method | [
"Main",
"method"
] | train | https://github.com/gabfl/password-generator-py/blob/cd59078fd3e6ea85b7acd9bfcf6d04014c0f7220/src/pwgenerator.py#L99-L124 |
openvax/topiary | topiary/sequence_helpers.py | protein_subsequences_around_mutations | def protein_subsequences_around_mutations(effects, padding_around_mutation):
"""
From each effect get a mutant protein sequence and pull out a subsequence
around the mutation (based on the given padding). Returns a dictionary
of subsequences and a dictionary of subsequence start offsets.
"""
pro... | python | def protein_subsequences_around_mutations(effects, padding_around_mutation):
"""
From each effect get a mutant protein sequence and pull out a subsequence
around the mutation (based on the given padding). Returns a dictionary
of subsequences and a dictionary of subsequence start offsets.
"""
pro... | [
"def",
"protein_subsequences_around_mutations",
"(",
"effects",
",",
"padding_around_mutation",
")",
":",
"protein_subsequences",
"=",
"{",
"}",
"protein_subsequence_start_offsets",
"=",
"{",
"}",
"for",
"effect",
"in",
"effects",
":",
"protein_sequence",
"=",
"effect",... | From each effect get a mutant protein sequence and pull out a subsequence
around the mutation (based on the given padding). Returns a dictionary
of subsequences and a dictionary of subsequence start offsets. | [
"From",
"each",
"effect",
"get",
"a",
"mutant",
"protein",
"sequence",
"and",
"pull",
"out",
"a",
"subsequence",
"around",
"the",
"mutation",
"(",
"based",
"on",
"the",
"given",
"padding",
")",
".",
"Returns",
"a",
"dictionary",
"of",
"subsequences",
"and",
... | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/sequence_helpers.py#L19-L50 |
openvax/topiary | topiary/sequence_helpers.py | check_padding_around_mutation | def check_padding_around_mutation(given_padding, epitope_lengths):
"""
If user doesn't provide any padding around the mutation we need
to at least include enough of the surrounding non-mutated
esidues to construct candidate epitopes of the specified lengths.
"""
min_required_padding = max(epitop... | python | def check_padding_around_mutation(given_padding, epitope_lengths):
"""
If user doesn't provide any padding around the mutation we need
to at least include enough of the surrounding non-mutated
esidues to construct candidate epitopes of the specified lengths.
"""
min_required_padding = max(epitop... | [
"def",
"check_padding_around_mutation",
"(",
"given_padding",
",",
"epitope_lengths",
")",
":",
"min_required_padding",
"=",
"max",
"(",
"epitope_lengths",
")",
"-",
"1",
"if",
"not",
"given_padding",
":",
"return",
"min_required_padding",
"else",
":",
"require_intege... | If user doesn't provide any padding around the mutation we need
to at least include enough of the surrounding non-mutated
esidues to construct candidate epitopes of the specified lengths. | [
"If",
"user",
"doesn",
"t",
"provide",
"any",
"padding",
"around",
"the",
"mutation",
"we",
"need",
"to",
"at",
"least",
"include",
"enough",
"of",
"the",
"surrounding",
"non",
"-",
"mutated",
"esidues",
"to",
"construct",
"candidate",
"epitopes",
"of",
"the... | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/sequence_helpers.py#L52-L70 |
openvax/topiary | topiary/sequence_helpers.py | peptide_mutation_interval | def peptide_mutation_interval(
peptide_start_in_protein,
peptide_length,
mutation_start_in_protein,
mutation_end_in_protein):
"""
Half-open interval of mutated residues in the peptide, determined
from the mutation interval in the original protein sequence.
Parameters
... | python | def peptide_mutation_interval(
peptide_start_in_protein,
peptide_length,
mutation_start_in_protein,
mutation_end_in_protein):
"""
Half-open interval of mutated residues in the peptide, determined
from the mutation interval in the original protein sequence.
Parameters
... | [
"def",
"peptide_mutation_interval",
"(",
"peptide_start_in_protein",
",",
"peptide_length",
",",
"mutation_start_in_protein",
",",
"mutation_end_in_protein",
")",
":",
"if",
"peptide_start_in_protein",
">",
"mutation_end_in_protein",
":",
"raise",
"ValueError",
"(",
"\"Peptid... | Half-open interval of mutated residues in the peptide, determined
from the mutation interval in the original protein sequence.
Parameters
----------
peptide_start_in_protein : int
Position of the first peptide residue within the protein
(starting from 0)
peptide_length : int
m... | [
"Half",
"-",
"open",
"interval",
"of",
"mutated",
"residues",
"in",
"the",
"peptide",
"determined",
"from",
"the",
"mutation",
"interval",
"in",
"the",
"original",
"protein",
"sequence",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/sequence_helpers.py#L83-L121 |
trustar/trustar-python | trustar/models/indicator.py | Indicator.from_dict | def from_dict(cls, indicator):
"""
Create an indicator object from a dictionary.
:param indicator: The dictionary.
:return: The indicator object.
"""
tags = indicator.get('tags')
if tags is not None:
tags = [Tag.from_dict(tag) for tag in tags]
... | python | def from_dict(cls, indicator):
"""
Create an indicator object from a dictionary.
:param indicator: The dictionary.
:return: The indicator object.
"""
tags = indicator.get('tags')
if tags is not None:
tags = [Tag.from_dict(tag) for tag in tags]
... | [
"def",
"from_dict",
"(",
"cls",
",",
"indicator",
")",
":",
"tags",
"=",
"indicator",
".",
"get",
"(",
"'tags'",
")",
"if",
"tags",
"is",
"not",
"None",
":",
"tags",
"=",
"[",
"Tag",
".",
"from_dict",
"(",
"tag",
")",
"for",
"tag",
"in",
"tags",
... | Create an indicator object from a dictionary.
:param indicator: The dictionary.
:return: The indicator object. | [
"Create",
"an",
"indicator",
"object",
"from",
"a",
"dictionary",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/indicator.py#L71-L96 |
trustar/trustar-python | trustar/models/indicator.py | Indicator.to_dict | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the indicator.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the indicator.
"""
if ... | python | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the indicator.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the indicator.
"""
if ... | [
"def",
"to_dict",
"(",
"self",
",",
"remove_nones",
"=",
"False",
")",
":",
"if",
"remove_nones",
":",
"return",
"super",
"(",
")",
".",
"to_dict",
"(",
"remove_nones",
"=",
"True",
")",
"tags",
"=",
"None",
"if",
"self",
".",
"tags",
"is",
"not",
"N... | Creates a dictionary representation of the indicator.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the indicator. | [
"Creates",
"a",
"dictionary",
"representation",
"of",
"the",
"indicator",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/indicator.py#L98-L127 |
trustar/trustar-python | trustar/examples/ingest_fireeye_alerts.py | filter_false_positive | def filter_false_positive(df, process_time):
"""
method that takes in FireEye (FE) alerts and filters FE-tests and False Positives
:param process_time:
:param df:
:return:
"""
result = []
track = []
count = 0
for o in df['alerts']:
count += 1
if 'closedState' in o... | python | def filter_false_positive(df, process_time):
"""
method that takes in FireEye (FE) alerts and filters FE-tests and False Positives
:param process_time:
:param df:
:return:
"""
result = []
track = []
count = 0
for o in df['alerts']:
count += 1
if 'closedState' in o... | [
"def",
"filter_false_positive",
"(",
"df",
",",
"process_time",
")",
":",
"result",
"=",
"[",
"]",
"track",
"=",
"[",
"]",
"count",
"=",
"0",
"for",
"o",
"in",
"df",
"[",
"'alerts'",
"]",
":",
"count",
"+=",
"1",
"if",
"'closedState'",
"in",
"o",
"... | method that takes in FireEye (FE) alerts and filters FE-tests and False Positives
:param process_time:
:param df:
:return: | [
"method",
"that",
"takes",
"in",
"FireEye",
"(",
"FE",
")",
"alerts",
"and",
"filters",
"FE",
"-",
"tests",
"and",
"False",
"Positives",
":",
"param",
"process_time",
":",
":",
"param",
"df",
":",
":",
"return",
":"
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/examples/ingest_fireeye_alerts.py#L21-L67 |
trustar/trustar-python | trustar/examples/ingest_fireeye_alerts.py | filter_webapp_attack | def filter_webapp_attack(df, process_time):
"""
A function that filters out the BASH SHELLSHOCK alert data obtained from FireEye
:param df: a DataFrame object
:param process_time:
:return:
"""
result = []
track = []
for o in df:
if 'METHODOLOGY - WEB APP ATTACK' in o['message... | python | def filter_webapp_attack(df, process_time):
"""
A function that filters out the BASH SHELLSHOCK alert data obtained from FireEye
:param df: a DataFrame object
:param process_time:
:return:
"""
result = []
track = []
for o in df:
if 'METHODOLOGY - WEB APP ATTACK' in o['message... | [
"def",
"filter_webapp_attack",
"(",
"df",
",",
"process_time",
")",
":",
"result",
"=",
"[",
"]",
"track",
"=",
"[",
"]",
"for",
"o",
"in",
"df",
":",
"if",
"'METHODOLOGY - WEB APP ATTACK'",
"in",
"o",
"[",
"'message'",
"]",
":",
"track",
".",
"append",
... | A function that filters out the BASH SHELLSHOCK alert data obtained from FireEye
:param df: a DataFrame object
:param process_time:
:return: | [
"A",
"function",
"that",
"filters",
"out",
"the",
"BASH",
"SHELLSHOCK",
"alert",
"data",
"obtained",
"from",
"FireEye",
":",
"param",
"df",
":",
"a",
"DataFrame",
"object",
":",
"param",
"process_time",
":",
":",
"return",
":"
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/examples/ingest_fireeye_alerts.py#L114-L133 |
trustar/trustar-python | trustar/examples/ingest_fireeye_alerts.py | process_alert | def process_alert(file_name):
"""
A function that removes the alerts property from the FireEye alert and transform the data into a JSON ready format
:param file_name:
:return:
"""
processed_line = open(file_name, 'r').read()
char_pos = processed_line.find("}")
new_line = "{" + processed... | python | def process_alert(file_name):
"""
A function that removes the alerts property from the FireEye alert and transform the data into a JSON ready format
:param file_name:
:return:
"""
processed_line = open(file_name, 'r').read()
char_pos = processed_line.find("}")
new_line = "{" + processed... | [
"def",
"process_alert",
"(",
"file_name",
")",
":",
"processed_line",
"=",
"open",
"(",
"file_name",
",",
"'r'",
")",
".",
"read",
"(",
")",
"char_pos",
"=",
"processed_line",
".",
"find",
"(",
"\"}\"",
")",
"new_line",
"=",
"\"{\"",
"+",
"processed_line",... | A function that removes the alerts property from the FireEye alert and transform the data into a JSON ready format
:param file_name:
:return: | [
"A",
"function",
"that",
"removes",
"the",
"alerts",
"property",
"from",
"the",
"FireEye",
"alert",
"and",
"transform",
"the",
"data",
"into",
"a",
"JSON",
"ready",
"format",
":",
"param",
"file_name",
":",
":",
"return",
":"
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/examples/ingest_fireeye_alerts.py#L136-L146 |
openvax/topiary | topiary/filters.py | apply_filter | def apply_filter(
filter_fn,
collection,
result_fn=None,
filter_name="",
collection_name=""):
"""
Apply filter to effect collection and print number of dropped elements
Parameters
----------
"""
n_before = len(collection)
filtered = [x for x in collec... | python | def apply_filter(
filter_fn,
collection,
result_fn=None,
filter_name="",
collection_name=""):
"""
Apply filter to effect collection and print number of dropped elements
Parameters
----------
"""
n_before = len(collection)
filtered = [x for x in collec... | [
"def",
"apply_filter",
"(",
"filter_fn",
",",
"collection",
",",
"result_fn",
"=",
"None",
",",
"filter_name",
"=",
"\"\"",
",",
"collection_name",
"=",
"\"\"",
")",
":",
"n_before",
"=",
"len",
"(",
"collection",
")",
"filtered",
"=",
"[",
"x",
"for",
"... | Apply filter to effect collection and print number of dropped elements
Parameters
---------- | [
"Apply",
"filter",
"to",
"effect",
"collection",
"and",
"print",
"number",
"of",
"dropped",
"elements"
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/filters.py#L24-L47 |
openvax/topiary | topiary/filters.py | filter_silent_and_noncoding_effects | def filter_silent_and_noncoding_effects(effects):
"""
Keep only variant effects which result in modified proteins.
Parameters
----------
effects : varcode.EffectCollection
"""
return apply_filter(
filter_fn=lambda effect: isinstance(effect, NonsilentCodingMutation),
collecti... | python | def filter_silent_and_noncoding_effects(effects):
"""
Keep only variant effects which result in modified proteins.
Parameters
----------
effects : varcode.EffectCollection
"""
return apply_filter(
filter_fn=lambda effect: isinstance(effect, NonsilentCodingMutation),
collecti... | [
"def",
"filter_silent_and_noncoding_effects",
"(",
"effects",
")",
":",
"return",
"apply_filter",
"(",
"filter_fn",
"=",
"lambda",
"effect",
":",
"isinstance",
"(",
"effect",
",",
"NonsilentCodingMutation",
")",
",",
"collection",
"=",
"effects",
",",
"result_fn",
... | Keep only variant effects which result in modified proteins.
Parameters
----------
effects : varcode.EffectCollection | [
"Keep",
"only",
"variant",
"effects",
"which",
"result",
"in",
"modified",
"proteins",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/filters.py#L49-L61 |
openvax/topiary | topiary/filters.py | apply_variant_expression_filters | def apply_variant_expression_filters(
variants,
gene_expression_dict,
gene_expression_threshold,
transcript_expression_dict,
transcript_expression_threshold):
"""
Filter a collection of variants by gene and transcript expression thresholds
Parameters
----------
... | python | def apply_variant_expression_filters(
variants,
gene_expression_dict,
gene_expression_threshold,
transcript_expression_dict,
transcript_expression_threshold):
"""
Filter a collection of variants by gene and transcript expression thresholds
Parameters
----------
... | [
"def",
"apply_variant_expression_filters",
"(",
"variants",
",",
"gene_expression_dict",
",",
"gene_expression_threshold",
",",
"transcript_expression_dict",
",",
"transcript_expression_threshold",
")",
":",
"if",
"gene_expression_dict",
":",
"variants",
"=",
"apply_filter",
... | Filter a collection of variants by gene and transcript expression thresholds
Parameters
----------
variants : varcode.VariantCollection
gene_expression_dict : dict
gene_expression_threshold : float
transcript_expression_dict : dict
transcript_expression_threshold : float | [
"Filter",
"a",
"collection",
"of",
"variants",
"by",
"gene",
"and",
"transcript",
"expression",
"thresholds"
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/filters.py#L64-L107 |
openvax/topiary | topiary/filters.py | apply_effect_expression_filters | def apply_effect_expression_filters(
effects,
gene_expression_dict,
gene_expression_threshold,
transcript_expression_dict,
transcript_expression_threshold):
"""
Filter collection of varcode effects by given gene
and transcript expression thresholds.
Parameters
... | python | def apply_effect_expression_filters(
effects,
gene_expression_dict,
gene_expression_threshold,
transcript_expression_dict,
transcript_expression_threshold):
"""
Filter collection of varcode effects by given gene
and transcript expression thresholds.
Parameters
... | [
"def",
"apply_effect_expression_filters",
"(",
"effects",
",",
"gene_expression_dict",
",",
"gene_expression_threshold",
",",
"transcript_expression_dict",
",",
"transcript_expression_threshold",
")",
":",
"if",
"gene_expression_dict",
":",
"effects",
"=",
"apply_filter",
"("... | Filter collection of varcode effects by given gene
and transcript expression thresholds.
Parameters
----------
effects : varcode.EffectCollection
gene_expression_dict : dict
gene_expression_threshold : float
transcript_expression_dict : dict
transcript_expression_threshold : float | [
"Filter",
"collection",
"of",
"varcode",
"effects",
"by",
"given",
"gene",
"and",
"transcript",
"expression",
"thresholds",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/filters.py#L109-L151 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.submit_indicators | def submit_indicators(self, indicators, enclave_ids=None, tags=None):
"""
Submit indicators directly. The indicator field ``value`` is required; all other metadata fields are optional:
``firstSeen``, ``lastSeen``, ``sightings``, ``notes``, and ``source``. The submission must specify enclaves fo... | python | def submit_indicators(self, indicators, enclave_ids=None, tags=None):
"""
Submit indicators directly. The indicator field ``value`` is required; all other metadata fields are optional:
``firstSeen``, ``lastSeen``, ``sightings``, ``notes``, and ``source``. The submission must specify enclaves fo... | [
"def",
"submit_indicators",
"(",
"self",
",",
"indicators",
",",
"enclave_ids",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"if",
"enclave_ids",
"is",
"None",
":",
"enclave_ids",
"=",
"self",
".",
"enclave_ids",
"if",
"tags",
"is",
"not",
"None",
":... | Submit indicators directly. The indicator field ``value`` is required; all other metadata fields are optional:
``firstSeen``, ``lastSeen``, ``sightings``, ``notes``, and ``source``. The submission must specify enclaves for
the indicators to be submitted to, and can optionally specify tags to assign to ... | [
"Submit",
"indicators",
"directly",
".",
"The",
"indicator",
"field",
"value",
"is",
"required",
";",
"all",
"other",
"metadata",
"fields",
"are",
"optional",
":",
"firstSeen",
"lastSeen",
"sightings",
"notes",
"and",
"source",
".",
"The",
"submission",
"must",
... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L23-L55 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_indicators | def get_indicators(self, from_time=None, to_time=None, enclave_ids=None,
included_tag_ids=None, excluded_tag_ids=None,
start_page=0, page_size=None):
"""
Creates a generator from the |get_indicators_page| method that returns each successive indicator as an
... | python | def get_indicators(self, from_time=None, to_time=None, enclave_ids=None,
included_tag_ids=None, excluded_tag_ids=None,
start_page=0, page_size=None):
"""
Creates a generator from the |get_indicators_page| method that returns each successive indicator as an
... | [
"def",
"get_indicators",
"(",
"self",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"included_tag_ids",
"=",
"None",
",",
"excluded_tag_ids",
"=",
"None",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=... | Creates a generator from the |get_indicators_page| method that returns each successive indicator as an
|Indicator| object containing values for the 'value' and 'type' attributes only; all
other |Indicator| object attributes will contain Null values.
:param int from_time: start of time window in... | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_indicators_page|",
"method",
"that",
"returns",
"each",
"successive",
"indicator",
"as",
"an",
"|Indicator|",
"object",
"containing",
"values",
"for",
"the",
"value",
"and",
"type",
"attributes",
"only",
";",
"all"... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L57-L90 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient._get_indicators_page_generator | def _get_indicators_page_generator(self, from_time=None, to_time=None, page_number=0, page_size=None,
enclave_ids=None, included_tag_ids=None, excluded_tag_ids=None):
"""
Creates a generator from the |get_indicators_page| method that returns each successive page.
... | python | def _get_indicators_page_generator(self, from_time=None, to_time=None, page_number=0, page_size=None,
enclave_ids=None, included_tag_ids=None, excluded_tag_ids=None):
"""
Creates a generator from the |get_indicators_page| method that returns each successive page.
... | [
"def",
"_get_indicators_page_generator",
"(",
"self",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"page_number",
"=",
"0",
",",
"page_size",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"included_tag_ids",
"=",
"None",
",",
"exclud... | Creates a generator from the |get_indicators_page| method that returns each successive page.
:param int from_time: start of time window in milliseconds since epoch (defaults to 7 days ago)
:param int to_time: end of time window in milliseconds since epoch (defaults to current time)
:param int p... | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_indicators_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L92-L117 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_indicators_page | def get_indicators_page(self, from_time=None, to_time=None, page_number=None, page_size=None,
enclave_ids=None, included_tag_ids=None, excluded_tag_ids=None):
"""
Get a page of indicators matching the provided filters.
:param int from_time: start of time window in mi... | python | def get_indicators_page(self, from_time=None, to_time=None, page_number=None, page_size=None,
enclave_ids=None, included_tag_ids=None, excluded_tag_ids=None):
"""
Get a page of indicators matching the provided filters.
:param int from_time: start of time window in mi... | [
"def",
"get_indicators_page",
"(",
"self",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"page_number",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"included_tag_ids",
"=",
"None",
",",
"excluded_tag_i... | Get a page of indicators matching the provided filters.
:param int from_time: start of time window in milliseconds since epoch (defaults to 7 days ago)
:param int to_time: end of time window in milliseconds since epoch (defaults to current time)
:param int page_number: the page number
:... | [
"Get",
"a",
"page",
"of",
"indicators",
"matching",
"the",
"provided",
"filters",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L119-L148 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.search_indicators | def search_indicators(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
tags=None,
excluded_tags=None):
"""
... | python | def search_indicators(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
tags=None,
excluded_tags=None):
"""
... | [
"def",
"search_indicators",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"indicator_types",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"excluded_tags",
"=",... | Uses the |search_indicators_page| method to create a generator that returns each successive indicator.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used... | [
"Uses",
"the",
"|search_indicators_page|",
"method",
"to",
"create",
"a",
"generator",
"that",
"returns",
"each",
"successive",
"indicator",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L150-L176 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient._search_indicators_page_generator | def _search_indicators_page_generator(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
... | python | def _search_indicators_page_generator(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
... | [
"def",
"_search_indicators_page_generator",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"indicator_types",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"exclud... | Creates a generator from the |search_indicators_page| method that returns each successive page.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used to res... | [
"Creates",
"a",
"generator",
"from",
"the",
"|search_indicators_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L178-L207 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.search_indicators_page | def search_indicators_page(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
tags=None,
ex... | python | def search_indicators_page(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
indicator_types=None,
tags=None,
ex... | [
"def",
"search_indicators_page",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"indicator_types",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"excluded_tags",
... | Search for indicators containing a search term.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used to restrict to indicators found in reports in specific... | [
"Search",
"for",
"indicators",
"containing",
"a",
"search",
"term",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L209-L253 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_related_indicators | def get_related_indicators(self, indicators=None, enclave_ids=None):
"""
Uses the |get_related_indicators_page| method to create a generator that returns each successive report.
:param list(string) indicators: list of indicator values to search for
:param list(string) enclave_ids: list ... | python | def get_related_indicators(self, indicators=None, enclave_ids=None):
"""
Uses the |get_related_indicators_page| method to create a generator that returns each successive report.
:param list(string) indicators: list of indicator values to search for
:param list(string) enclave_ids: list ... | [
"def",
"get_related_indicators",
"(",
"self",
",",
"indicators",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
")",
":",
"return",
"Page",
".",
"get_generator",
"(",
"page_generator",
"=",
"self",
".",
"_get_related_indicators_page_generator",
"(",
"indicators",
"... | Uses the |get_related_indicators_page| method to create a generator that returns each successive report.
:param list(string) indicators: list of indicator values to search for
:param list(string) enclave_ids: list of GUIDs of enclaves to search in
:return: The generator. | [
"Uses",
"the",
"|get_related_indicators_page|",
"method",
"to",
"create",
"a",
"generator",
"that",
"returns",
"each",
"successive",
"report",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L255-L264 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_indicator_metadata | def get_indicator_metadata(self, value):
"""
Provide metadata associated with a single indicators, including value, indicatorType, noteCount,
sightings, lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the
request has READ access to.
... | python | def get_indicator_metadata(self, value):
"""
Provide metadata associated with a single indicators, including value, indicatorType, noteCount,
sightings, lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the
request has READ access to.
... | [
"def",
"get_indicator_metadata",
"(",
"self",
",",
"value",
")",
":",
"result",
"=",
"self",
".",
"get_indicators_metadata",
"(",
"[",
"Indicator",
"(",
"value",
"=",
"value",
")",
"]",
")",
"if",
"len",
"(",
"result",
")",
">",
"0",
":",
"indicator",
... | Provide metadata associated with a single indicators, including value, indicatorType, noteCount,
sightings, lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the
request has READ access to.
:param value: an indicator value to query.
:return... | [
"Provide",
"metadata",
"associated",
"with",
"a",
"single",
"indicators",
"including",
"value",
"indicatorType",
"noteCount",
"sightings",
"lastSeen",
"enclaveIds",
"and",
"tags",
".",
"The",
"metadata",
"is",
"determined",
"based",
"on",
"the",
"enclaves",
"the",
... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L276-L298 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_indicators_metadata | def get_indicators_metadata(self, indicators):
"""
Provide metadata associated with an list of indicators, including value, indicatorType, noteCount, sightings,
lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the request has
READ access to... | python | def get_indicators_metadata(self, indicators):
"""
Provide metadata associated with an list of indicators, including value, indicatorType, noteCount, sightings,
lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the request has
READ access to... | [
"def",
"get_indicators_metadata",
"(",
"self",
",",
"indicators",
")",
":",
"data",
"=",
"[",
"{",
"'value'",
":",
"i",
".",
"value",
",",
"'indicatorType'",
":",
"i",
".",
"type",
"}",
"for",
"i",
"in",
"indicators",
"]",
"resp",
"=",
"self",
".",
"... | Provide metadata associated with an list of indicators, including value, indicatorType, noteCount, sightings,
lastSeen, enclaveIds, and tags. The metadata is determined based on the enclaves the user making the request has
READ access to.
:param indicators: a list of |Indicator| objects to quer... | [
"Provide",
"metadata",
"associated",
"with",
"an",
"list",
"of",
"indicators",
"including",
"value",
"indicatorType",
"noteCount",
"sightings",
"lastSeen",
"enclaveIds",
"and",
"tags",
".",
"The",
"metadata",
"is",
"determined",
"based",
"on",
"the",
"enclaves",
"... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L300-L321 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_indicator_details | def get_indicator_details(self, indicators, enclave_ids=None):
"""
NOTE: This method uses an API endpoint that is intended for internal use only, and is not officially supported.
Provide a list of indicator values and obtain details for all of them, including indicator_type, priority_level,
... | python | def get_indicator_details(self, indicators, enclave_ids=None):
"""
NOTE: This method uses an API endpoint that is intended for internal use only, and is not officially supported.
Provide a list of indicator values and obtain details for all of them, including indicator_type, priority_level,
... | [
"def",
"get_indicator_details",
"(",
"self",
",",
"indicators",
",",
"enclave_ids",
"=",
"None",
")",
":",
"# if the indicators parameter is a string, make it a singleton",
"if",
"isinstance",
"(",
"indicators",
",",
"string_types",
")",
":",
"indicators",
"=",
"[",
"... | NOTE: This method uses an API endpoint that is intended for internal use only, and is not officially supported.
Provide a list of indicator values and obtain details for all of them, including indicator_type, priority_level,
correlation_count, and whether they have been whitelisted. Note that the valu... | [
"NOTE",
":",
"This",
"method",
"uses",
"an",
"API",
"endpoint",
"that",
"is",
"intended",
"for",
"internal",
"use",
"only",
"and",
"is",
"not",
"officially",
"supported",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L323-L348 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.add_terms_to_whitelist | def add_terms_to_whitelist(self, terms):
"""
Add a list of terms to the user's company's whitelist.
:param terms: The list of terms to whitelist.
:return: The list of extracted |Indicator| objects that were whitelisted.
"""
resp = self._client.post("whitelist", json=ter... | python | def add_terms_to_whitelist(self, terms):
"""
Add a list of terms to the user's company's whitelist.
:param terms: The list of terms to whitelist.
:return: The list of extracted |Indicator| objects that were whitelisted.
"""
resp = self._client.post("whitelist", json=ter... | [
"def",
"add_terms_to_whitelist",
"(",
"self",
",",
"terms",
")",
":",
"resp",
"=",
"self",
".",
"_client",
".",
"post",
"(",
"\"whitelist\"",
",",
"json",
"=",
"terms",
")",
"return",
"[",
"Indicator",
".",
"from_dict",
"(",
"indicator",
")",
"for",
"ind... | Add a list of terms to the user's company's whitelist.
:param terms: The list of terms to whitelist.
:return: The list of extracted |Indicator| objects that were whitelisted. | [
"Add",
"a",
"list",
"of",
"terms",
"to",
"the",
"user",
"s",
"company",
"s",
"whitelist",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L359-L368 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.delete_indicator_from_whitelist | def delete_indicator_from_whitelist(self, indicator):
"""
Delete an indicator from the user's company's whitelist.
:param indicator: An |Indicator| object, representing the indicator to delete.
"""
params = indicator.to_dict()
self._client.delete("whitelist", params=par... | python | def delete_indicator_from_whitelist(self, indicator):
"""
Delete an indicator from the user's company's whitelist.
:param indicator: An |Indicator| object, representing the indicator to delete.
"""
params = indicator.to_dict()
self._client.delete("whitelist", params=par... | [
"def",
"delete_indicator_from_whitelist",
"(",
"self",
",",
"indicator",
")",
":",
"params",
"=",
"indicator",
".",
"to_dict",
"(",
")",
"self",
".",
"_client",
".",
"delete",
"(",
"\"whitelist\"",
",",
"params",
"=",
"params",
")"
] | Delete an indicator from the user's company's whitelist.
:param indicator: An |Indicator| object, representing the indicator to delete. | [
"Delete",
"an",
"indicator",
"from",
"the",
"user",
"s",
"company",
"s",
"whitelist",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L370-L378 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_community_trends | def get_community_trends(self, indicator_type=None, days_back=None):
"""
Find indicators that are trending in the community.
:param indicator_type: A type of indicator to filter by. If ``None``, will get all types of indicators except
for MALWARE and CVEs (this convention is for pa... | python | def get_community_trends(self, indicator_type=None, days_back=None):
"""
Find indicators that are trending in the community.
:param indicator_type: A type of indicator to filter by. If ``None``, will get all types of indicators except
for MALWARE and CVEs (this convention is for pa... | [
"def",
"get_community_trends",
"(",
"self",
",",
"indicator_type",
"=",
"None",
",",
"days_back",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'type'",
":",
"indicator_type",
",",
"'daysBack'",
":",
"days_back",
"}",
"resp",
"=",
"self",
".",
"_client",
"."... | Find indicators that are trending in the community.
:param indicator_type: A type of indicator to filter by. If ``None``, will get all types of indicators except
for MALWARE and CVEs (this convention is for parity with the corresponding view on the Dashboard).
:param days_back: The number ... | [
"Find",
"indicators",
"that",
"are",
"trending",
"in",
"the",
"community",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L380-L399 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_whitelist_page | def get_whitelist_page(self, page_number=None, page_size=None):
"""
Gets a paginated list of indicators that the user's company has whitelisted.
:param int page_number: the page number to get.
:param int page_size: the size of the page to be returned.
:return: A |Page| of |Indic... | python | def get_whitelist_page(self, page_number=None, page_size=None):
"""
Gets a paginated list of indicators that the user's company has whitelisted.
:param int page_number: the page number to get.
:param int page_size: the size of the page to be returned.
:return: A |Page| of |Indic... | [
"def",
"get_whitelist_page",
"(",
"self",
",",
"page_number",
"=",
"None",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'pageNumber'",
":",
"page_number",
",",
"'pageSize'",
":",
"page_size",
"}",
"resp",
"=",
"self",
".",
"_client",
".",
... | Gets a paginated list of indicators that the user's company has whitelisted.
:param int page_number: the page number to get.
:param int page_size: the size of the page to be returned.
:return: A |Page| of |Indicator| objects. | [
"Gets",
"a",
"paginated",
"list",
"of",
"indicators",
"that",
"the",
"user",
"s",
"company",
"has",
"whitelisted",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L401-L415 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient.get_related_indicators_page | def get_related_indicators_page(self, indicators=None, enclave_ids=None, page_size=None, page_number=None):
"""
Finds all reports that contain any of the given indicators and returns correlated indicators from those reports.
:param indicators: list of indicator values to search for
:par... | python | def get_related_indicators_page(self, indicators=None, enclave_ids=None, page_size=None, page_number=None):
"""
Finds all reports that contain any of the given indicators and returns correlated indicators from those reports.
:param indicators: list of indicator values to search for
:par... | [
"def",
"get_related_indicators_page",
"(",
"self",
",",
"indicators",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"page_size",
"=",
"None",
",",
"page_number",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'indicators'",
":",
"indicators",
",",
"'enclav... | Finds all reports that contain any of the given indicators and returns correlated indicators from those reports.
:param indicators: list of indicator values to search for
:param enclave_ids: list of IDs of enclaves to search in
:param page_size: number of results per page
:param page_nu... | [
"Finds",
"all",
"reports",
"that",
"contain",
"any",
"of",
"the",
"given",
"indicators",
"and",
"returns",
"correlated",
"indicators",
"from",
"those",
"reports",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L434-L454 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient._get_indicators_for_report_page_generator | def _get_indicators_for_report_page_generator(self, report_id, start_page=0, page_size=None):
"""
Creates a generator from the |get_indicators_for_report_page| method that returns each successive page.
:param str report_id: The ID of the report to get indicators for.
:param int start_pa... | python | def _get_indicators_for_report_page_generator(self, report_id, start_page=0, page_size=None):
"""
Creates a generator from the |get_indicators_for_report_page| method that returns each successive page.
:param str report_id: The ID of the report to get indicators for.
:param int start_pa... | [
"def",
"_get_indicators_for_report_page_generator",
"(",
"self",
",",
"report_id",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=",
"None",
")",
":",
"get_page",
"=",
"functools",
".",
"partial",
"(",
"self",
".",
"get_indicators_for_report_page",
",",
"report_... | Creates a generator from the |get_indicators_for_report_page| method that returns each successive page.
:param str report_id: The ID of the report to get indicators for.
:param int start_page: The page to start on.
:param int page_size: The size of each page.
:return: The generator. | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_indicators_for_report_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L456-L467 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient._get_related_indicators_page_generator | def _get_related_indicators_page_generator(self, indicators=None, enclave_ids=None, start_page=0, page_size=None):
"""
Creates a generator from the |get_related_indicators_page| method that returns each
successive page.
:param indicators: list of indicator values to search for
:... | python | def _get_related_indicators_page_generator(self, indicators=None, enclave_ids=None, start_page=0, page_size=None):
"""
Creates a generator from the |get_related_indicators_page| method that returns each
successive page.
:param indicators: list of indicator values to search for
:... | [
"def",
"_get_related_indicators_page_generator",
"(",
"self",
",",
"indicators",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=",
"None",
")",
":",
"get_page",
"=",
"functools",
".",
"partial",
"(",
"self",
".... | Creates a generator from the |get_related_indicators_page| method that returns each
successive page.
:param indicators: list of indicator values to search for
:param enclave_ids: list of IDs of enclaves to search in
:param start_page: The page to start on.
:param page_size: The ... | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_related_indicators_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L469-L482 |
trustar/trustar-python | trustar/indicator_client.py | IndicatorClient._get_whitelist_page_generator | def _get_whitelist_page_generator(self, start_page=0, page_size=None):
"""
Creates a generator from the |get_whitelist_page| method that returns each successive page.
:param int start_page: The page to start on.
:param int page_size: The size of each page.
:return: The generator... | python | def _get_whitelist_page_generator(self, start_page=0, page_size=None):
"""
Creates a generator from the |get_whitelist_page| method that returns each successive page.
:param int start_page: The page to start on.
:param int page_size: The size of each page.
:return: The generator... | [
"def",
"_get_whitelist_page_generator",
"(",
"self",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=",
"None",
")",
":",
"return",
"Page",
".",
"get_page_generator",
"(",
"self",
".",
"get_whitelist_page",
",",
"start_page",
",",
"page_size",
")"
] | Creates a generator from the |get_whitelist_page| method that returns each successive page.
:param int start_page: The page to start on.
:param int page_size: The size of each page.
:return: The generator. | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_whitelist_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/indicator_client.py#L484-L493 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.points | def points(self, size=1.0, highlight=None, colorlist=None, opacity=1.0):
"""Display the system as points.
:param float size: the size of the points.
"""
if colorlist is None:
colorlist = [get_atom_color(t) for t in self.topology['atom_types']]
if highlight is not N... | python | def points(self, size=1.0, highlight=None, colorlist=None, opacity=1.0):
"""Display the system as points.
:param float size: the size of the points.
"""
if colorlist is None:
colorlist = [get_atom_color(t) for t in self.topology['atom_types']]
if highlight is not N... | [
"def",
"points",
"(",
"self",
",",
"size",
"=",
"1.0",
",",
"highlight",
"=",
"None",
",",
"colorlist",
"=",
"None",
",",
"opacity",
"=",
"1.0",
")",
":",
"if",
"colorlist",
"is",
"None",
":",
"colorlist",
"=",
"[",
"get_atom_color",
"(",
"t",
")",
... | Display the system as points.
:param float size: the size of the points. | [
"Display",
"the",
"system",
"as",
"points",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L29-L56 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.labels | def labels(self, text=None, coordinates=None, colorlist=None, sizes=None, fonts=None, opacity=1.0):
'''Display atomic labels for the system'''
if coordinates is None:
coordinates=self.coordinates
l=len(coordinates)
if text is None:
if len(self.topology.get('atom_t... | python | def labels(self, text=None, coordinates=None, colorlist=None, sizes=None, fonts=None, opacity=1.0):
'''Display atomic labels for the system'''
if coordinates is None:
coordinates=self.coordinates
l=len(coordinates)
if text is None:
if len(self.topology.get('atom_t... | [
"def",
"labels",
"(",
"self",
",",
"text",
"=",
"None",
",",
"coordinates",
"=",
"None",
",",
"colorlist",
"=",
"None",
",",
"sizes",
"=",
"None",
",",
"fonts",
"=",
"None",
",",
"opacity",
"=",
"1.0",
")",
":",
"if",
"coordinates",
"is",
"None",
"... | Display atomic labels for the system | [
"Display",
"atomic",
"labels",
"for",
"the",
"system"
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L58-L78 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.remove_labels | def remove_labels(self):
'''Remove all atomic labels from the system'''
for rep_id in self.representations.keys():
if self.representations[rep_id]['rep_type']=='text' and rep_id not in self._axes_reps:
self.remove_representation(rep_id) | python | def remove_labels(self):
'''Remove all atomic labels from the system'''
for rep_id in self.representations.keys():
if self.representations[rep_id]['rep_type']=='text' and rep_id not in self._axes_reps:
self.remove_representation(rep_id) | [
"def",
"remove_labels",
"(",
"self",
")",
":",
"for",
"rep_id",
"in",
"self",
".",
"representations",
".",
"keys",
"(",
")",
":",
"if",
"self",
".",
"representations",
"[",
"rep_id",
"]",
"[",
"'rep_type'",
"]",
"==",
"'text'",
"and",
"rep_id",
"not",
... | Remove all atomic labels from the system | [
"Remove",
"all",
"atomic",
"labels",
"from",
"the",
"system"
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L80-L84 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.toggle_axes | def toggle_axes(self, parameters = None):
'''Toggle axes [x,y,z] on and off for the current representation
Parameters: dictionary of parameters to control axes:
position/p: origin of axes
length/l: length of axis
offset/o: offset to place axis labels
... | python | def toggle_axes(self, parameters = None):
'''Toggle axes [x,y,z] on and off for the current representation
Parameters: dictionary of parameters to control axes:
position/p: origin of axes
length/l: length of axis
offset/o: offset to place axis labels
... | [
"def",
"toggle_axes",
"(",
"self",
",",
"parameters",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"_axes_reps",
")",
">",
"0",
":",
"for",
"rep_id",
"in",
"self",
".",
"_axes_reps",
":",
"self",
".",
"remove_representation",
"(",
"rep_id",
")... | Toggle axes [x,y,z] on and off for the current representation
Parameters: dictionary of parameters to control axes:
position/p: origin of axes
length/l: length of axis
offset/o: offset to place axis labels
axis_colors/ac: axis colors
te... | [
"Toggle",
"axes",
"[",
"x",
"y",
"z",
"]",
"on",
"and",
"off",
"for",
"the",
"current",
"representation",
"Parameters",
":",
"dictionary",
"of",
"parameters",
"to",
"control",
"axes",
":",
"position",
"/",
"p",
":",
"origin",
"of",
"axes",
"length",
"/",... | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L86-L148 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.lines | def lines(self):
'''Display the system bonds as lines.
'''
if "bonds" not in self.topology:
return
bond_start, bond_end = zip(*self.topology['bonds'])
bond_start = np.array(bond_start)
bond_end = np.array(bond_end)
color_array = np.array([get_atom_c... | python | def lines(self):
'''Display the system bonds as lines.
'''
if "bonds" not in self.topology:
return
bond_start, bond_end = zip(*self.topology['bonds'])
bond_start = np.array(bond_start)
bond_end = np.array(bond_end)
color_array = np.array([get_atom_c... | [
"def",
"lines",
"(",
"self",
")",
":",
"if",
"\"bonds\"",
"not",
"in",
"self",
".",
"topology",
":",
"return",
"bond_start",
",",
"bond_end",
"=",
"zip",
"(",
"*",
"self",
".",
"topology",
"[",
"'bonds'",
"]",
")",
"bond_start",
"=",
"np",
".",
"arra... | Display the system bonds as lines. | [
"Display",
"the",
"system",
"bonds",
"as",
"lines",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L151-L176 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.wireframe | def wireframe(self, pointsize=0.2, opacity=1.0):
'''Display atoms as points of size *pointsize* and bonds as lines.'''
self.points(pointsize, opacity=opacity)
self.lines() | python | def wireframe(self, pointsize=0.2, opacity=1.0):
'''Display atoms as points of size *pointsize* and bonds as lines.'''
self.points(pointsize, opacity=opacity)
self.lines() | [
"def",
"wireframe",
"(",
"self",
",",
"pointsize",
"=",
"0.2",
",",
"opacity",
"=",
"1.0",
")",
":",
"self",
".",
"points",
"(",
"pointsize",
",",
"opacity",
"=",
"opacity",
")",
"self",
".",
"lines",
"(",
")"
] | Display atoms as points of size *pointsize* and bonds as lines. | [
"Display",
"atoms",
"as",
"points",
"of",
"size",
"*",
"pointsize",
"*",
"and",
"bonds",
"as",
"lines",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L178-L181 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.ball_and_sticks | def ball_and_sticks(self, ball_radius=0.05, stick_radius=0.02, colorlist=None, opacity=1.0):
"""Display the system using a ball and stick representation.
"""
# Add the spheres
if colorlist is None:
colorlist = [get_atom_color(t) for t in self.topology['atom_types']]
... | python | def ball_and_sticks(self, ball_radius=0.05, stick_radius=0.02, colorlist=None, opacity=1.0):
"""Display the system using a ball and stick representation.
"""
# Add the spheres
if colorlist is None:
colorlist = [get_atom_color(t) for t in self.topology['atom_types']]
... | [
"def",
"ball_and_sticks",
"(",
"self",
",",
"ball_radius",
"=",
"0.05",
",",
"stick_radius",
"=",
"0.02",
",",
"colorlist",
"=",
"None",
",",
"opacity",
"=",
"1.0",
")",
":",
"# Add the spheres",
"if",
"colorlist",
"is",
"None",
":",
"colorlist",
"=",
"[",... | Display the system using a ball and stick representation. | [
"Display",
"the",
"system",
"using",
"a",
"ball",
"and",
"stick",
"representation",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L183-L229 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.line_ribbon | def line_ribbon(self):
'''Display the protein secondary structure as a white lines that passes through the
backbone chain.
'''
# Control points are the CA (C alphas)
backbone = np.array(self.topology['atom_names']) == 'CA'
smoothline = self.add_representation('smoothl... | python | def line_ribbon(self):
'''Display the protein secondary structure as a white lines that passes through the
backbone chain.
'''
# Control points are the CA (C alphas)
backbone = np.array(self.topology['atom_names']) == 'CA'
smoothline = self.add_representation('smoothl... | [
"def",
"line_ribbon",
"(",
"self",
")",
":",
"# Control points are the CA (C alphas)",
"backbone",
"=",
"np",
".",
"array",
"(",
"self",
".",
"topology",
"[",
"'atom_names'",
"]",
")",
"==",
"'CA'",
"smoothline",
"=",
"self",
".",
"add_representation",
"(",
"'... | Display the protein secondary structure as a white lines that passes through the
backbone chain. | [
"Display",
"the",
"protein",
"secondary",
"structure",
"as",
"a",
"white",
"lines",
"that",
"passes",
"through",
"the",
"backbone",
"chain",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L231-L245 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.cylinder_and_strand | def cylinder_and_strand(self):
'''Display the protein secondary structure as a white,
solid tube and the alpha-helices as yellow cylinders.
'''
top = self.topology
# We build a mini-state machine to find the
# start end of helices and such
in_helix = False
... | python | def cylinder_and_strand(self):
'''Display the protein secondary structure as a white,
solid tube and the alpha-helices as yellow cylinders.
'''
top = self.topology
# We build a mini-state machine to find the
# start end of helices and such
in_helix = False
... | [
"def",
"cylinder_and_strand",
"(",
"self",
")",
":",
"top",
"=",
"self",
".",
"topology",
"# We build a mini-state machine to find the",
"# start end of helices and such",
"in_helix",
"=",
"False",
"helices_starts",
"=",
"[",
"]",
"helices_ends",
"=",
"[",
"]",
"coil... | Display the protein secondary structure as a white,
solid tube and the alpha-helices as yellow cylinders. | [
"Display",
"the",
"protein",
"secondary",
"structure",
"as",
"a",
"white",
"solid",
"tube",
"and",
"the",
"alpha",
"-",
"helices",
"as",
"yellow",
"cylinders",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L247-L310 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.cartoon | def cartoon(self, cmap=None):
'''Display a protein secondary structure as a pymol-like cartoon representation.
:param cmap: is a dictionary that maps the secondary type
(H=helix, E=sheet, C=coil) to a hexadecimal color (0xffffff for white)
'''
# Parse secondary struc... | python | def cartoon(self, cmap=None):
'''Display a protein secondary structure as a pymol-like cartoon representation.
:param cmap: is a dictionary that maps the secondary type
(H=helix, E=sheet, C=coil) to a hexadecimal color (0xffffff for white)
'''
# Parse secondary struc... | [
"def",
"cartoon",
"(",
"self",
",",
"cmap",
"=",
"None",
")",
":",
"# Parse secondary structure",
"top",
"=",
"self",
".",
"topology",
"geom",
"=",
"gg",
".",
"GeomProteinCartoon",
"(",
"gg",
".",
"Aes",
"(",
"xyz",
"=",
"self",
".",
"coordinates",
",",
... | Display a protein secondary structure as a pymol-like cartoon representation.
:param cmap: is a dictionary that maps the secondary type
(H=helix, E=sheet, C=coil) to a hexadecimal color (0xffffff for white) | [
"Display",
"a",
"protein",
"secondary",
"structure",
"as",
"a",
"pymol",
"-",
"like",
"cartoon",
"representation",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L312-L335 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.add_isosurface | def add_isosurface(self, function, isolevel=0.3, resolution=32, style="wireframe", color=0xffffff):
'''Add an isosurface to the current scene.
:param callable function: A function that takes x, y, z coordinates as input and is broadcastable using numpy. Typically simple
... | python | def add_isosurface(self, function, isolevel=0.3, resolution=32, style="wireframe", color=0xffffff):
'''Add an isosurface to the current scene.
:param callable function: A function that takes x, y, z coordinates as input and is broadcastable using numpy. Typically simple
... | [
"def",
"add_isosurface",
"(",
"self",
",",
"function",
",",
"isolevel",
"=",
"0.3",
",",
"resolution",
"=",
"32",
",",
"style",
"=",
"\"wireframe\"",
",",
"color",
"=",
"0xffffff",
")",
":",
"avail_styles",
"=",
"[",
"'wireframe'",
",",
"'solid'",
",",
"... | Add an isosurface to the current scene.
:param callable function: A function that takes x, y, z coordinates as input and is broadcastable using numpy. Typically simple
functions that involve standard arithmetic operations and functions
such as... | [
"Add",
"an",
"isosurface",
"to",
"the",
"current",
"scene",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L340-L393 |
gabrielelanaro/chemview | chemview/viewer.py | MolecularViewer.add_isosurface_grid_data | def add_isosurface_grid_data(self, data, origin, extent, resolution,
isolevel=0.3, scale=10,
style="wireframe", color=0xffffff):
"""
Add an isosurface to current scence using pre-computed data on a grid
"""
spacing = np.ar... | python | def add_isosurface_grid_data(self, data, origin, extent, resolution,
isolevel=0.3, scale=10,
style="wireframe", color=0xffffff):
"""
Add an isosurface to current scence using pre-computed data on a grid
"""
spacing = np.ar... | [
"def",
"add_isosurface_grid_data",
"(",
"self",
",",
"data",
",",
"origin",
",",
"extent",
",",
"resolution",
",",
"isolevel",
"=",
"0.3",
",",
"scale",
"=",
"10",
",",
"style",
"=",
"\"wireframe\"",
",",
"color",
"=",
"0xffffff",
")",
":",
"spacing",
"=... | Add an isosurface to current scence using pre-computed data on a grid | [
"Add",
"an",
"isosurface",
"to",
"current",
"scence",
"using",
"pre",
"-",
"computed",
"data",
"on",
"a",
"grid"
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/viewer.py#L395-L418 |
trustar/trustar-python | trustar/api_client.py | ApiClient._refresh_token | def _refresh_token(self):
"""
Retrieves the OAuth2 token generated by the user's API key and API secret.
Sets the instance property 'token' to this new token.
If the current token is still live, the server will simply return that.
"""
# use basic auth with API key and se... | python | def _refresh_token(self):
"""
Retrieves the OAuth2 token generated by the user's API key and API secret.
Sets the instance property 'token' to this new token.
If the current token is still live, the server will simply return that.
"""
# use basic auth with API key and se... | [
"def",
"_refresh_token",
"(",
"self",
")",
":",
"# use basic auth with API key and secret",
"client_auth",
"=",
"requests",
".",
"auth",
".",
"HTTPBasicAuth",
"(",
"self",
".",
"api_key",
",",
"self",
".",
"api_secret",
")",
"# make request",
"post_data",
"=",
"{"... | Retrieves the OAuth2 token generated by the user's API key and API secret.
Sets the instance property 'token' to this new token.
If the current token is still live, the server will simply return that. | [
"Retrieves",
"the",
"OAuth2",
"token",
"generated",
"by",
"the",
"user",
"s",
"API",
"key",
"and",
"API",
"secret",
".",
"Sets",
"the",
"instance",
"property",
"token",
"to",
"this",
"new",
"token",
".",
"If",
"the",
"current",
"token",
"is",
"still",
"l... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/api_client.py#L97-L121 |
trustar/trustar-python | trustar/api_client.py | ApiClient._get_headers | def _get_headers(self, is_json=False):
"""
Create headers dictionary for a request.
:param boolean is_json: Whether the request body is a json.
:return: The headers dictionary.
"""
headers = {"Authorization": "Bearer " + self._get_token()}
if self.client_type i... | python | def _get_headers(self, is_json=False):
"""
Create headers dictionary for a request.
:param boolean is_json: Whether the request body is a json.
:return: The headers dictionary.
"""
headers = {"Authorization": "Bearer " + self._get_token()}
if self.client_type i... | [
"def",
"_get_headers",
"(",
"self",
",",
"is_json",
"=",
"False",
")",
":",
"headers",
"=",
"{",
"\"Authorization\"",
":",
"\"Bearer \"",
"+",
"self",
".",
"_get_token",
"(",
")",
"}",
"if",
"self",
".",
"client_type",
"is",
"not",
"None",
":",
"headers"... | Create headers dictionary for a request.
:param boolean is_json: Whether the request body is a json.
:return: The headers dictionary. | [
"Create",
"headers",
"dictionary",
"for",
"a",
"request",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/api_client.py#L123-L145 |
trustar/trustar-python | trustar/api_client.py | ApiClient._is_expired_token_response | def _is_expired_token_response(cls, response):
"""
Determine whether the given response indicates that the token is expired.
:param response: The response object.
:return: True if the response indicates that the token is expired.
"""
EXPIRED_MESSAGE = "Expired oauth2 ac... | python | def _is_expired_token_response(cls, response):
"""
Determine whether the given response indicates that the token is expired.
:param response: The response object.
:return: True if the response indicates that the token is expired.
"""
EXPIRED_MESSAGE = "Expired oauth2 ac... | [
"def",
"_is_expired_token_response",
"(",
"cls",
",",
"response",
")",
":",
"EXPIRED_MESSAGE",
"=",
"\"Expired oauth2 access token\"",
"INVALID_MESSAGE",
"=",
"\"Invalid oauth2 access token\"",
"if",
"response",
".",
"status_code",
"==",
"400",
":",
"try",
":",
"body",
... | Determine whether the given response indicates that the token is expired.
:param response: The response object.
:return: True if the response indicates that the token is expired. | [
"Determine",
"whether",
"the",
"given",
"response",
"indicates",
"that",
"the",
"token",
"is",
"expired",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/api_client.py#L148-L166 |
trustar/trustar-python | trustar/api_client.py | ApiClient.request | def request(self, method, path, headers=None, params=None, data=None, **kwargs):
"""
A wrapper around ``requests.request`` that handles boilerplate code specific to TruStar's API.
:param str method: The method of the request (``GET``, ``PUT``, ``POST``, or ``DELETE``)
:param str path: T... | python | def request(self, method, path, headers=None, params=None, data=None, **kwargs):
"""
A wrapper around ``requests.request`` that handles boilerplate code specific to TruStar's API.
:param str method: The method of the request (``GET``, ``PUT``, ``POST``, or ``DELETE``)
:param str path: T... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"path",
",",
"headers",
"=",
"None",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"retry",
"=",
"self",
".",
"retry",
"attempted",
"=",
"False",
"while",... | A wrapper around ``requests.request`` that handles boilerplate code specific to TruStar's API.
:param str method: The method of the request (``GET``, ``PUT``, ``POST``, or ``DELETE``)
:param str path: The path of the request, i.e. the piece of the URL after the base URL
:param dict headers: A d... | [
"A",
"wrapper",
"around",
"requests",
".",
"request",
"that",
"handles",
"boilerplate",
"code",
"specific",
"to",
"TruStar",
"s",
"API",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/api_client.py#L168-L248 |
gabrielelanaro/chemview | chemview/marchingcubes.py | isosurface_from_data | def isosurface_from_data(data, isolevel, origin, spacing):
"""Small wrapper to get directly vertices and faces to feed into programs
"""
spacing = np.array(extent/resolution)
if isolevel >= 0:
triangles = marching_cubes(data, isolevel)
else: # Wrong traingle unwinding roder -- god only knows... | python | def isosurface_from_data(data, isolevel, origin, spacing):
"""Small wrapper to get directly vertices and faces to feed into programs
"""
spacing = np.array(extent/resolution)
if isolevel >= 0:
triangles = marching_cubes(data, isolevel)
else: # Wrong traingle unwinding roder -- god only knows... | [
"def",
"isosurface_from_data",
"(",
"data",
",",
"isolevel",
",",
"origin",
",",
"spacing",
")",
":",
"spacing",
"=",
"np",
".",
"array",
"(",
"extent",
"/",
"resolution",
")",
"if",
"isolevel",
">=",
"0",
":",
"triangles",
"=",
"marching_cubes",
"(",
"d... | Small wrapper to get directly vertices and faces to feed into programs | [
"Small",
"wrapper",
"to",
"get",
"directly",
"vertices",
"and",
"faces",
"to",
"feed",
"into",
"programs"
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/marchingcubes.py#L28-L44 |
openvax/topiary | topiary/rna/gtf.py | _get_gtf_column | def _get_gtf_column(column_name, gtf_path, df):
"""
Helper function which returns a dictionary column or raises an ValueError
abou the absence of that column in a GTF file.
"""
if column_name in df.columns:
return list(df[column_name])
else:
raise ValueError(
"Missin... | python | def _get_gtf_column(column_name, gtf_path, df):
"""
Helper function which returns a dictionary column or raises an ValueError
abou the absence of that column in a GTF file.
"""
if column_name in df.columns:
return list(df[column_name])
else:
raise ValueError(
"Missin... | [
"def",
"_get_gtf_column",
"(",
"column_name",
",",
"gtf_path",
",",
"df",
")",
":",
"if",
"column_name",
"in",
"df",
".",
"columns",
":",
"return",
"list",
"(",
"df",
"[",
"column_name",
"]",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Missing '%s' in... | Helper function which returns a dictionary column or raises an ValueError
abou the absence of that column in a GTF file. | [
"Helper",
"function",
"which",
"returns",
"a",
"dictionary",
"column",
"or",
"raises",
"an",
"ValueError",
"abou",
"the",
"absence",
"of",
"that",
"column",
"in",
"a",
"GTF",
"file",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/rna/gtf.py#L22-L35 |
openvax/topiary | topiary/rna/gtf.py | load_transcript_fpkm_dict_from_gtf | def load_transcript_fpkm_dict_from_gtf(
gtf_path,
transcript_id_column_name="reference_id",
fpkm_column_name="FPKM",
feature_column_name="feature"):
"""
Load a GTF file generated by StringTie which contains transcript-level
quantification of abundance. Returns a dictionary ma... | python | def load_transcript_fpkm_dict_from_gtf(
gtf_path,
transcript_id_column_name="reference_id",
fpkm_column_name="FPKM",
feature_column_name="feature"):
"""
Load a GTF file generated by StringTie which contains transcript-level
quantification of abundance. Returns a dictionary ma... | [
"def",
"load_transcript_fpkm_dict_from_gtf",
"(",
"gtf_path",
",",
"transcript_id_column_name",
"=",
"\"reference_id\"",
",",
"fpkm_column_name",
"=",
"\"FPKM\"",
",",
"feature_column_name",
"=",
"\"feature\"",
")",
":",
"df",
"=",
"gtfparse",
".",
"read_gtf",
"(",
"g... | Load a GTF file generated by StringTie which contains transcript-level
quantification of abundance. Returns a dictionary mapping Ensembl
IDs of transcripts to FPKM values. | [
"Load",
"a",
"GTF",
"file",
"generated",
"by",
"StringTie",
"which",
"contains",
"transcript",
"-",
"level",
"quantification",
"of",
"abundance",
".",
"Returns",
"a",
"dictionary",
"mapping",
"Ensembl",
"IDs",
"of",
"transcripts",
"to",
"FPKM",
"values",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/rna/gtf.py#L37-L68 |
openvax/topiary | topiary/predictor.py | TopiaryPredictor.predict_from_named_sequences | def predict_from_named_sequences(
self, name_to_sequence_dict):
"""
Parameters
----------
name_to_sequence_dict : (str->str) dict
Dictionary mapping sequence names to amino acid sequences
Returns pandas.DataFrame with the following columns:
- ... | python | def predict_from_named_sequences(
self, name_to_sequence_dict):
"""
Parameters
----------
name_to_sequence_dict : (str->str) dict
Dictionary mapping sequence names to amino acid sequences
Returns pandas.DataFrame with the following columns:
- ... | [
"def",
"predict_from_named_sequences",
"(",
"self",
",",
"name_to_sequence_dict",
")",
":",
"df",
"=",
"self",
".",
"mhc_model",
".",
"predict_subsequences_dataframe",
"(",
"name_to_sequence_dict",
")",
"return",
"df",
".",
"rename",
"(",
"columns",
"=",
"{",
"\"l... | Parameters
----------
name_to_sequence_dict : (str->str) dict
Dictionary mapping sequence names to amino acid sequences
Returns pandas.DataFrame with the following columns:
- source_sequence_name
- peptide
- peptide_offset
- peptide_le... | [
"Parameters",
"----------",
"name_to_sequence_dict",
":",
"(",
"str",
"-",
">",
"str",
")",
"dict",
"Dictionary",
"mapping",
"sequence",
"names",
"to",
"amino",
"acid",
"sequences"
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/predictor.py#L91-L113 |
openvax/topiary | topiary/predictor.py | TopiaryPredictor.predict_from_sequences | def predict_from_sequences(self, sequences):
"""
Predict MHC ligands for sub-sequences of each input sequence.
Parameters
----------
sequences : list of str
Multiple amino acid sequences (without any names or IDs)
Returns DataFrame with the following fields:... | python | def predict_from_sequences(self, sequences):
"""
Predict MHC ligands for sub-sequences of each input sequence.
Parameters
----------
sequences : list of str
Multiple amino acid sequences (without any names or IDs)
Returns DataFrame with the following fields:... | [
"def",
"predict_from_sequences",
"(",
"self",
",",
"sequences",
")",
":",
"# make each sequence its own unique ID",
"sequence_dict",
"=",
"{",
"seq",
":",
"seq",
"for",
"seq",
"in",
"sequences",
"}",
"df",
"=",
"self",
".",
"predict_from_named_sequences",
"(",
"se... | Predict MHC ligands for sub-sequences of each input sequence.
Parameters
----------
sequences : list of str
Multiple amino acid sequences (without any names or IDs)
Returns DataFrame with the following fields:
- source_sequence
- peptide
... | [
"Predict",
"MHC",
"ligands",
"for",
"sub",
"-",
"sequences",
"of",
"each",
"input",
"sequence",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/predictor.py#L115-L140 |
openvax/topiary | topiary/predictor.py | TopiaryPredictor.predict_from_mutation_effects | def predict_from_mutation_effects(
self,
effects,
transcript_expression_dict=None,
gene_expression_dict=None):
"""Given a Varcode.EffectCollection of predicted protein effects,
return predicted epitopes around each mutation.
Parameters
---... | python | def predict_from_mutation_effects(
self,
effects,
transcript_expression_dict=None,
gene_expression_dict=None):
"""Given a Varcode.EffectCollection of predicted protein effects,
return predicted epitopes around each mutation.
Parameters
---... | [
"def",
"predict_from_mutation_effects",
"(",
"self",
",",
"effects",
",",
"transcript_expression_dict",
"=",
"None",
",",
"gene_expression_dict",
"=",
"None",
")",
":",
"# we only care about effects which impact the coding sequence of a",
"# protein",
"effects",
"=",
"filter_... | Given a Varcode.EffectCollection of predicted protein effects,
return predicted epitopes around each mutation.
Parameters
----------
effects : Varcode.EffectCollection
transcript_expression_dict : dict
Dictionary mapping transcript IDs to RNA expression estimates. U... | [
"Given",
"a",
"Varcode",
".",
"EffectCollection",
"of",
"predicted",
"protein",
"effects",
"return",
"predicted",
"epitopes",
"around",
"each",
"mutation",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/predictor.py#L142-L345 |
openvax/topiary | topiary/predictor.py | TopiaryPredictor.predict_from_variants | def predict_from_variants(
self,
variants,
transcript_expression_dict=None,
gene_expression_dict=None):
"""
Predict epitopes from a Variant collection, filtering options, and
optional gene and transcript expression data.
Parameters
... | python | def predict_from_variants(
self,
variants,
transcript_expression_dict=None,
gene_expression_dict=None):
"""
Predict epitopes from a Variant collection, filtering options, and
optional gene and transcript expression data.
Parameters
... | [
"def",
"predict_from_variants",
"(",
"self",
",",
"variants",
",",
"transcript_expression_dict",
"=",
"None",
",",
"gene_expression_dict",
"=",
"None",
")",
":",
"# pre-filter variants by checking if any of the genes or",
"# transcripts they overlap have sufficient expression.",
... | Predict epitopes from a Variant collection, filtering options, and
optional gene and transcript expression data.
Parameters
----------
variants : varcode.VariantCollection
transcript_expression_dict : dict
Maps from Ensembl transcript IDs to FPKM expression values.
... | [
"Predict",
"epitopes",
"from",
"a",
"Variant",
"collection",
"filtering",
"options",
"and",
"optional",
"gene",
"and",
"transcript",
"expression",
"data",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/predictor.py#L347-L407 |
openvax/topiary | topiary/cli/script.py | main | def main(args_list=None):
"""
Script entry-point to predict neo-epitopes from genomic variants using
Topiary.
"""
args = parse_args(args_list)
print("Topiary commandline arguments:")
print(args)
df = predict_epitopes_from_args(args)
write_outputs(df, args)
print("Total count: %d"... | python | def main(args_list=None):
"""
Script entry-point to predict neo-epitopes from genomic variants using
Topiary.
"""
args = parse_args(args_list)
print("Topiary commandline arguments:")
print(args)
df = predict_epitopes_from_args(args)
write_outputs(df, args)
print("Total count: %d"... | [
"def",
"main",
"(",
"args_list",
"=",
"None",
")",
":",
"args",
"=",
"parse_args",
"(",
"args_list",
")",
"print",
"(",
"\"Topiary commandline arguments:\"",
")",
"print",
"(",
"args",
")",
"df",
"=",
"predict_epitopes_from_args",
"(",
"args",
")",
"write_outp... | Script entry-point to predict neo-epitopes from genomic variants using
Topiary. | [
"Script",
"entry",
"-",
"point",
"to",
"predict",
"neo",
"-",
"epitopes",
"from",
"genomic",
"variants",
"using",
"Topiary",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/cli/script.py#L45-L55 |
gabrielelanaro/chemview | chemview/render.py | render_povray | def render_povray(scene, filename='ipython', width=600, height=600,
antialiasing=0.01, extra_opts={}):
'''Render the scene with povray for publication.
:param dict scene: The scene to render
:param string filename: Output filename or 'ipython' to render in the notebook.
:param int wid... | python | def render_povray(scene, filename='ipython', width=600, height=600,
antialiasing=0.01, extra_opts={}):
'''Render the scene with povray for publication.
:param dict scene: The scene to render
:param string filename: Output filename or 'ipython' to render in the notebook.
:param int wid... | [
"def",
"render_povray",
"(",
"scene",
",",
"filename",
"=",
"'ipython'",
",",
"width",
"=",
"600",
",",
"height",
"=",
"600",
",",
"antialiasing",
"=",
"0.01",
",",
"extra_opts",
"=",
"{",
"}",
")",
":",
"if",
"not",
"vapory_available",
":",
"raise",
"... | Render the scene with povray for publication.
:param dict scene: The scene to render
:param string filename: Output filename or 'ipython' to render in the notebook.
:param int width: Width in pixels.
:param int height: Height in pixels.
:param dict extra_opts: Dictionary to merge/override with the ... | [
"Render",
"the",
"scene",
"with",
"povray",
"for",
"publication",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/render.py#L21-L93 |
gabrielelanaro/chemview | chemview/render.py | rmatrixquaternion | def rmatrixquaternion(q):
"""Create a rotation matrix from q quaternion rotation.
Quaternions are typed as Numeric Python numpy.arrays of length 4.
"""
assert np.allclose(math.sqrt(np.dot(q,q)), 1.0)
x, y, z, w = q
xx = x*x
xy = x*y
xz = x*z
xw = x*w
yy = y*y
yz = y*z
y... | python | def rmatrixquaternion(q):
"""Create a rotation matrix from q quaternion rotation.
Quaternions are typed as Numeric Python numpy.arrays of length 4.
"""
assert np.allclose(math.sqrt(np.dot(q,q)), 1.0)
x, y, z, w = q
xx = x*x
xy = x*y
xz = x*z
xw = x*w
yy = y*y
yz = y*z
y... | [
"def",
"rmatrixquaternion",
"(",
"q",
")",
":",
"assert",
"np",
".",
"allclose",
"(",
"math",
".",
"sqrt",
"(",
"np",
".",
"dot",
"(",
"q",
",",
"q",
")",
")",
",",
"1.0",
")",
"x",
",",
"y",
",",
"z",
",",
"w",
"=",
"q",
"xx",
"=",
"x",
... | Create a rotation matrix from q quaternion rotation.
Quaternions are typed as Numeric Python numpy.arrays of length 4. | [
"Create",
"a",
"rotation",
"matrix",
"from",
"q",
"quaternion",
"rotation",
".",
"Quaternions",
"are",
"typed",
"as",
"Numeric",
"Python",
"numpy",
".",
"arrays",
"of",
"length",
"4",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/render.py#L181-L216 |
openvax/topiary | topiary/cli/rna.py | rna_transcript_expression_dict_from_args | def rna_transcript_expression_dict_from_args(args):
"""
Returns a dictionary mapping Ensembl transcript IDs to FPKM expression
values or None if neither Cufflinks tracking file nor StringTie GTF file
were specified.
"""
if args.rna_transcript_fpkm_tracking_file:
return load_cufflinks_fpk... | python | def rna_transcript_expression_dict_from_args(args):
"""
Returns a dictionary mapping Ensembl transcript IDs to FPKM expression
values or None if neither Cufflinks tracking file nor StringTie GTF file
were specified.
"""
if args.rna_transcript_fpkm_tracking_file:
return load_cufflinks_fpk... | [
"def",
"rna_transcript_expression_dict_from_args",
"(",
"args",
")",
":",
"if",
"args",
".",
"rna_transcript_fpkm_tracking_file",
":",
"return",
"load_cufflinks_fpkm_dict",
"(",
"args",
".",
"rna_transcript_fpkm_tracking_file",
")",
"elif",
"args",
".",
"rna_transcript_fpkm... | Returns a dictionary mapping Ensembl transcript IDs to FPKM expression
values or None if neither Cufflinks tracking file nor StringTie GTF file
were specified. | [
"Returns",
"a",
"dictionary",
"mapping",
"Ensembl",
"transcript",
"IDs",
"to",
"FPKM",
"expression",
"values",
"or",
"None",
"if",
"neither",
"Cufflinks",
"tracking",
"file",
"nor",
"StringTie",
"GTF",
"file",
"were",
"specified",
"."
] | train | https://github.com/openvax/topiary/blob/04f0077bc4bf1ad350a0e78c26fa48c55fe7813b/topiary/cli/rna.py#L75-L87 |
trustar/trustar-python | trustar/models/page.py | Page.get_total_pages | def get_total_pages(self):
"""
:return: The total number of pages on the server.
"""
if self.total_elements is None or self.page_size is None:
return None
return math.ceil(float(self.total_elements) / float(self.page_size)) | python | def get_total_pages(self):
"""
:return: The total number of pages on the server.
"""
if self.total_elements is None or self.page_size is None:
return None
return math.ceil(float(self.total_elements) / float(self.page_size)) | [
"def",
"get_total_pages",
"(",
"self",
")",
":",
"if",
"self",
".",
"total_elements",
"is",
"None",
"or",
"self",
".",
"page_size",
"is",
"None",
":",
"return",
"None",
"return",
"math",
".",
"ceil",
"(",
"float",
"(",
"self",
".",
"total_elements",
")",... | :return: The total number of pages on the server. | [
":",
"return",
":",
"The",
"total",
"number",
"of",
"pages",
"on",
"the",
"server",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/page.py#L37-L45 |
trustar/trustar-python | trustar/models/page.py | Page.has_more_pages | def has_more_pages(self):
"""
:return: ``True`` if there are more pages available on the server.
"""
# if has_next property exists, it represents whether more pages exist
if self.has_next is not None:
return self.has_next
# otherwise, try to compute whether ... | python | def has_more_pages(self):
"""
:return: ``True`` if there are more pages available on the server.
"""
# if has_next property exists, it represents whether more pages exist
if self.has_next is not None:
return self.has_next
# otherwise, try to compute whether ... | [
"def",
"has_more_pages",
"(",
"self",
")",
":",
"# if has_next property exists, it represents whether more pages exist",
"if",
"self",
".",
"has_next",
"is",
"not",
"None",
":",
"return",
"self",
".",
"has_next",
"# otherwise, try to compute whether or not more pages exist",
... | :return: ``True`` if there are more pages available on the server. | [
":",
"return",
":",
"True",
"if",
"there",
"are",
"more",
"pages",
"available",
"on",
"the",
"server",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/page.py#L47-L61 |
trustar/trustar-python | trustar/models/page.py | Page.from_dict | def from_dict(page, content_type=None):
"""
Create a |Page| object from a dictionary. This method is intended for internal use, to construct a
|Page| object from the body of a response json from a paginated endpoint.
:param page: The dictionary.
:param content_type: The class t... | python | def from_dict(page, content_type=None):
"""
Create a |Page| object from a dictionary. This method is intended for internal use, to construct a
|Page| object from the body of a response json from a paginated endpoint.
:param page: The dictionary.
:param content_type: The class t... | [
"def",
"from_dict",
"(",
"page",
",",
"content_type",
"=",
"None",
")",
":",
"result",
"=",
"Page",
"(",
"items",
"=",
"page",
".",
"get",
"(",
"'items'",
")",
",",
"page_number",
"=",
"page",
".",
"get",
"(",
"'pageNumber'",
")",
",",
"page_size",
"... | Create a |Page| object from a dictionary. This method is intended for internal use, to construct a
|Page| object from the body of a response json from a paginated endpoint.
:param page: The dictionary.
:param content_type: The class that the contents should be deserialized into.
:retur... | [
"Create",
"a",
"|Page|",
"object",
"from",
"a",
"dictionary",
".",
"This",
"method",
"is",
"intended",
"for",
"internal",
"use",
"to",
"construct",
"a",
"|Page|",
"object",
"from",
"the",
"body",
"of",
"a",
"response",
"json",
"from",
"a",
"paginated",
"en... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/page.py#L67-L89 |
trustar/trustar-python | trustar/models/page.py | Page.to_dict | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the page.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the page.
"""
items = []
... | python | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the page.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the page.
"""
items = []
... | [
"def",
"to_dict",
"(",
"self",
",",
"remove_nones",
"=",
"False",
")",
":",
"items",
"=",
"[",
"]",
"# attempt to replace each item with its dictionary representation if possible",
"for",
"item",
"in",
"self",
".",
"items",
":",
"if",
"hasattr",
"(",
"item",
",",
... | Creates a dictionary representation of the page.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the page. | [
"Creates",
"a",
"dictionary",
"representation",
"of",
"the",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/page.py#L91-L114 |
trustar/trustar-python | trustar/models/page.py | Page.get_page_generator | def get_page_generator(func, start_page=0, page_size=None):
"""
Constructs a generator for retrieving pages from a paginated endpoint. This method is intended for internal
use.
:param func: Should take parameters ``page_number`` and ``page_size`` and return the corresponding |Page| obj... | python | def get_page_generator(func, start_page=0, page_size=None):
"""
Constructs a generator for retrieving pages from a paginated endpoint. This method is intended for internal
use.
:param func: Should take parameters ``page_number`` and ``page_size`` and return the corresponding |Page| obj... | [
"def",
"get_page_generator",
"(",
"func",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=",
"None",
")",
":",
"# initialize starting values",
"page_number",
"=",
"start_page",
"more_pages",
"=",
"True",
"# continuously request the next page as long as more pages exist",
... | Constructs a generator for retrieving pages from a paginated endpoint. This method is intended for internal
use.
:param func: Should take parameters ``page_number`` and ``page_size`` and return the corresponding |Page| object.
:param start_page: The page to start on.
:param page_size: ... | [
"Constructs",
"a",
"generator",
"for",
"retrieving",
"pages",
"from",
"a",
"paginated",
"endpoint",
".",
"This",
"method",
"is",
"intended",
"for",
"internal",
"use",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/page.py#L117-L142 |
trustar/trustar-python | trustar/models/base.py | ModelBase.to_dict | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: The dictionary representation.
"""
if remove_nones:
... | python | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: The dictionary representation.
"""
if remove_nones:
... | [
"def",
"to_dict",
"(",
"self",
",",
"remove_nones",
"=",
"False",
")",
":",
"if",
"remove_nones",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"to_dict",
"(",
")",
".",
"items",
"(",
")",
"if",
"v",
"is",
"not",
"... | Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: The dictionary representation. | [
"Creates",
"a",
"dictionary",
"representation",
"of",
"the",
"object",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/base.py#L16-L27 |
trustar/trustar-python | trustar/models/report.py | Report.to_dict | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the report.
"""
if remove... | python | def to_dict(self, remove_nones=False):
"""
Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the report.
"""
if remove... | [
"def",
"to_dict",
"(",
"self",
",",
"remove_nones",
"=",
"False",
")",
":",
"if",
"remove_nones",
":",
"report_dict",
"=",
"super",
"(",
")",
".",
"to_dict",
"(",
"remove_nones",
"=",
"True",
")",
"else",
":",
"report_dict",
"=",
"{",
"'title'",
":",
"... | Creates a dictionary representation of the object.
:param remove_nones: Whether ``None`` values should be filtered out of the dictionary. Defaults to ``False``.
:return: A dictionary representation of the report. | [
"Creates",
"a",
"dictionary",
"representation",
"of",
"the",
"object",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/report.py#L94-L123 |
trustar/trustar-python | trustar/models/report.py | Report.from_dict | def from_dict(cls, report):
"""
Create a report object from a dictionary. This method is intended for internal use, to construct a
:class:`Report` object from the body of a response json. It expects the keys of the dictionary to match those
of the json that would be found in a response... | python | def from_dict(cls, report):
"""
Create a report object from a dictionary. This method is intended for internal use, to construct a
:class:`Report` object from the body of a response json. It expects the keys of the dictionary to match those
of the json that would be found in a response... | [
"def",
"from_dict",
"(",
"cls",
",",
"report",
")",
":",
"# determine distribution type",
"distribution_type",
"=",
"report",
".",
"get",
"(",
"'distributionType'",
")",
"if",
"distribution_type",
"is",
"not",
"None",
":",
"is_enclave",
"=",
"distribution_type",
"... | Create a report object from a dictionary. This method is intended for internal use, to construct a
:class:`Report` object from the body of a response json. It expects the keys of the dictionary to match those
of the json that would be found in a response to an API call such as ``GET /report/{id}``.
... | [
"Create",
"a",
"report",
"object",
"from",
"a",
"dictionary",
".",
"This",
"method",
"is",
"intended",
"for",
"internal",
"use",
"to",
"construct",
"a",
":",
"class",
":",
"Report",
"object",
"from",
"the",
"body",
"of",
"a",
"response",
"json",
".",
"It... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/models/report.py#L126-L152 |
gabrielelanaro/chemview | chemview/export.py | serialize_to_dict | def serialize_to_dict(dictionary):
'''Make a json-serializable dictionary from input dictionary by converting
non-serializable data types such as numpy arrays.'''
retval = {}
for k, v in dictionary.items():
if isinstance(v, dict):
retval[k] = serialize_to_dict(v)
else:
... | python | def serialize_to_dict(dictionary):
'''Make a json-serializable dictionary from input dictionary by converting
non-serializable data types such as numpy arrays.'''
retval = {}
for k, v in dictionary.items():
if isinstance(v, dict):
retval[k] = serialize_to_dict(v)
else:
... | [
"def",
"serialize_to_dict",
"(",
"dictionary",
")",
":",
"retval",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"dictionary",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"retval",
"[",
"k",
"]",
"=",
"serialize_t... | Make a json-serializable dictionary from input dictionary by converting
non-serializable data types such as numpy arrays. | [
"Make",
"a",
"json",
"-",
"serializable",
"dictionary",
"from",
"input",
"dictionary",
"by",
"converting",
"non",
"-",
"serializable",
"data",
"types",
"such",
"as",
"numpy",
"arrays",
"."
] | train | https://github.com/gabrielelanaro/chemview/blob/2c9768dd23db99e59e27adff2a953bb8ee795fa3/chemview/export.py#L27-L46 |
tdsmith/homebrew-pypi-poet | poet/poet.py | make_graph | def make_graph(pkg):
"""Returns a dictionary of information about pkg & its recursive deps.
Given a string, which can be parsed as a requirement specifier, return a
dictionary where each key is the name of pkg or one of its recursive
dependencies, and each value is a dictionary returned by research_pac... | python | def make_graph(pkg):
"""Returns a dictionary of information about pkg & its recursive deps.
Given a string, which can be parsed as a requirement specifier, return a
dictionary where each key is the name of pkg or one of its recursive
dependencies, and each value is a dictionary returned by research_pac... | [
"def",
"make_graph",
"(",
"pkg",
")",
":",
"ignore",
"=",
"[",
"'argparse'",
",",
"'pip'",
",",
"'setuptools'",
",",
"'wsgiref'",
"]",
"pkg_deps",
"=",
"recursive_dependencies",
"(",
"pkg_resources",
".",
"Requirement",
".",
"parse",
"(",
"pkg",
")",
")",
... | Returns a dictionary of information about pkg & its recursive deps.
Given a string, which can be parsed as a requirement specifier, return a
dictionary where each key is the name of pkg or one of its recursive
dependencies, and each value is a dictionary returned by research_package.
(No, it's not real... | [
"Returns",
"a",
"dictionary",
"of",
"information",
"about",
"pkg",
"&",
"its",
"recursive",
"deps",
"."
] | train | https://github.com/tdsmith/homebrew-pypi-poet/blob/fdafc615bcd28f29bcbe90789f07cc26f97c3bbc/poet/poet.py#L123-L152 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_report_details | def get_report_details(self, report_id, id_type=None):
"""
Retrieves a report by its ID. Internal and external IDs are both allowed.
:param str report_id: The ID of the incident report.
:param str id_type: Indicates whether ID is internal or external.
:return: The retrieved |R... | python | def get_report_details(self, report_id, id_type=None):
"""
Retrieves a report by its ID. Internal and external IDs are both allowed.
:param str report_id: The ID of the incident report.
:param str id_type: Indicates whether ID is internal or external.
:return: The retrieved |R... | [
"def",
"get_report_details",
"(",
"self",
",",
"report_id",
",",
"id_type",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'idType'",
":",
"id_type",
"}",
"resp",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"\"reports/%s\"",
"%",
"report_id",
",",
"params... | Retrieves a report by its ID. Internal and external IDs are both allowed.
:param str report_id: The ID of the incident report.
:param str id_type: Indicates whether ID is internal or external.
:return: The retrieved |Report| object.
Example:
>>> report = ts.get_report_detail... | [
"Retrieves",
"a",
"report",
"by",
"its",
"ID",
".",
"Internal",
"and",
"external",
"IDs",
"are",
"both",
"allowed",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L25-L55 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_reports_page | def get_reports_page(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None,
from_time=None, to_time=None):
"""
Retrieves a page of reports, filtering by time window, distribution type, enclave association, and tag.
The results are sorted by updated time.
... | python | def get_reports_page(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None,
from_time=None, to_time=None):
"""
Retrieves a page of reports, filtering by time window, distribution type, enclave association, and tag.
The results are sorted by updated time.
... | [
"def",
"get_reports_page",
"(",
"self",
",",
"is_enclave",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
")",
":",
"distribution_type",
... | Retrieves a page of reports, filtering by time window, distribution type, enclave association, and tag.
The results are sorted by updated time.
This method does not take ``page_number`` and ``page_size`` parameters. Instead, each successive page must be
found by adjusting the ``from_time`` and ... | [
"Retrieves",
"a",
"page",
"of",
"reports",
"filtering",
"by",
"time",
"window",
"distribution",
"type",
"enclave",
"association",
"and",
"tag",
".",
"The",
"results",
"are",
"sorted",
"by",
"updated",
"time",
".",
"This",
"method",
"does",
"not",
"take",
"pa... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L57-L106 |
trustar/trustar-python | trustar/report_client.py | ReportClient.submit_report | def submit_report(self, report):
"""
Submits a report.
* If ``report.is_enclave`` is ``True``, then the report will be submitted to the enclaves
identified by ``report.enclaves``; if that field is ``None``, then the enclave IDs registered with this
|TruStar| object will be u... | python | def submit_report(self, report):
"""
Submits a report.
* If ``report.is_enclave`` is ``True``, then the report will be submitted to the enclaves
identified by ``report.enclaves``; if that field is ``None``, then the enclave IDs registered with this
|TruStar| object will be u... | [
"def",
"submit_report",
"(",
"self",
",",
"report",
")",
":",
"# make distribution type default to \"enclave\"",
"if",
"report",
".",
"is_enclave",
"is",
"None",
":",
"report",
".",
"is_enclave",
"=",
"True",
"if",
"report",
".",
"enclave_ids",
"is",
"None",
":"... | Submits a report.
* If ``report.is_enclave`` is ``True``, then the report will be submitted to the enclaves
identified by ``report.enclaves``; if that field is ``None``, then the enclave IDs registered with this
|TruStar| object will be used.
* If ``report.time_began`` is ``None``, ... | [
"Submits",
"a",
"report",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L108-L162 |
trustar/trustar-python | trustar/report_client.py | ReportClient.update_report | def update_report(self, report):
"""
Updates the report identified by the ``report.id`` field; if this field does not exist, then
``report.external_id`` will be used if it exists. Any other fields on ``report`` that are not ``None``
will overwrite values on the report in TruSTAR's syste... | python | def update_report(self, report):
"""
Updates the report identified by the ``report.id`` field; if this field does not exist, then
``report.external_id`` will be used if it exists. Any other fields on ``report`` that are not ``None``
will overwrite values on the report in TruSTAR's syste... | [
"def",
"update_report",
"(",
"self",
",",
"report",
")",
":",
"# default to interal ID type if ID field is present",
"if",
"report",
".",
"id",
"is",
"not",
"None",
":",
"id_type",
"=",
"IdType",
".",
"INTERNAL",
"report_id",
"=",
"report",
".",
"id",
"# if no I... | Updates the report identified by the ``report.id`` field; if this field does not exist, then
``report.external_id`` will be used if it exists. Any other fields on ``report`` that are not ``None``
will overwrite values on the report in TruSTAR's system. Any fields that are ``None`` will simply be ign... | [
"Updates",
"the",
"report",
"identified",
"by",
"the",
"report",
".",
"id",
"field",
";",
"if",
"this",
"field",
"does",
"not",
"exist",
"then",
"report",
".",
"external_id",
"will",
"be",
"used",
"if",
"it",
"exists",
".",
"Any",
"other",
"fields",
"on"... | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L164-L205 |
trustar/trustar-python | trustar/report_client.py | ReportClient.delete_report | def delete_report(self, report_id, id_type=None):
"""
Deletes the report with the given ID.
:param report_id: the ID of the report to delete
:param id_type: indicates whether the ID is internal or an external ID provided by the user
:return: the response object
Example:... | python | def delete_report(self, report_id, id_type=None):
"""
Deletes the report with the given ID.
:param report_id: the ID of the report to delete
:param id_type: indicates whether the ID is internal or an external ID provided by the user
:return: the response object
Example:... | [
"def",
"delete_report",
"(",
"self",
",",
"report_id",
",",
"id_type",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'idType'",
":",
"id_type",
"}",
"self",
".",
"_client",
".",
"delete",
"(",
"\"reports/%s\"",
"%",
"report_id",
",",
"params",
"=",
"params... | Deletes the report with the given ID.
:param report_id: the ID of the report to delete
:param id_type: indicates whether the ID is internal or an external ID provided by the user
:return: the response object
Example:
>>> response = ts.delete_report("4d1fcaee-5009-4620-b239-2b2... | [
"Deletes",
"the",
"report",
"with",
"the",
"given",
"ID",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L207-L221 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_correlated_report_ids | def get_correlated_report_ids(self, indicators):
"""
DEPRECATED!
Retrieves a list of the IDs of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve correlated reports for.
:return: The list of IDs of reports that co... | python | def get_correlated_report_ids(self, indicators):
"""
DEPRECATED!
Retrieves a list of the IDs of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve correlated reports for.
:return: The list of IDs of reports that co... | [
"def",
"get_correlated_report_ids",
"(",
"self",
",",
"indicators",
")",
":",
"params",
"=",
"{",
"'indicators'",
":",
"indicators",
"}",
"resp",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"\"reports/correlate\"",
",",
"params",
"=",
"params",
")",
"retur... | DEPRECATED!
Retrieves a list of the IDs of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve correlated reports for.
:return: The list of IDs of reports that correlated.
Example:
>>> report_ids = ts.get_correlat... | [
"DEPRECATED!",
"Retrieves",
"a",
"list",
"of",
"the",
"IDs",
"of",
"all",
"TruSTAR",
"reports",
"that",
"contain",
"the",
"searched",
"indicators",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L223-L240 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_correlated_reports_page | def get_correlated_reports_page(self, indicators, enclave_ids=None, is_enclave=True,
page_size=None, page_number=None):
"""
Retrieves a page of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve... | python | def get_correlated_reports_page(self, indicators, enclave_ids=None, is_enclave=True,
page_size=None, page_number=None):
"""
Retrieves a page of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve... | [
"def",
"get_correlated_reports_page",
"(",
"self",
",",
"indicators",
",",
"enclave_ids",
"=",
"None",
",",
"is_enclave",
"=",
"True",
",",
"page_size",
"=",
"None",
",",
"page_number",
"=",
"None",
")",
":",
"if",
"is_enclave",
":",
"distribution_type",
"=",
... | Retrieves a page of all TruSTAR reports that contain the searched indicators.
:param indicators: A list of indicator values to retrieve correlated reports for.
:param enclave_ids: The enclaves to search in.
:param is_enclave: Whether to search enclave reports or community reports.
:para... | [
"Retrieves",
"a",
"page",
"of",
"all",
"TruSTAR",
"reports",
"that",
"contain",
"the",
"searched",
"indicators",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L242-L275 |
trustar/trustar-python | trustar/report_client.py | ReportClient.search_reports_page | def search_reports_page(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
excluded_tags=None,
page_size=None,
... | python | def search_reports_page(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
excluded_tags=None,
page_size=None,
... | [
"def",
"search_reports_page",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
",",
"page_size",
"=",
"... | Search for reports containing a search term.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used to restrict reports to specific enclaves (optional - by
... | [
"Search",
"for",
"reports",
"containing",
"a",
"search",
"term",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L277-L319 |
trustar/trustar-python | trustar/report_client.py | ReportClient._get_reports_page_generator | def _get_reports_page_generator(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None,
from_time=None, to_time=None):
"""
Creates a generator from the |get_reports_page| method that returns each successive page.
:param boolean is_enclave: rest... | python | def _get_reports_page_generator(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None,
from_time=None, to_time=None):
"""
Creates a generator from the |get_reports_page| method that returns each successive page.
:param boolean is_enclave: rest... | [
"def",
"_get_reports_page_generator",
"(",
"self",
",",
"is_enclave",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
")",
":",
"get_page"... | Creates a generator from the |get_reports_page| method that returns each successive page.
:param boolean is_enclave: restrict reports to specific distribution type (optional - by default all accessible
reports are returned).
:param list(str) enclave_ids: list of enclave ids used to restrict... | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_reports_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L321-L344 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_reports | def get_reports(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None, from_time=None, to_time=None):
"""
Uses the |get_reports_page| method to create a generator that returns each successive report as a trustar
report object.
:param boolean is_enclave: restrict reports ... | python | def get_reports(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None, from_time=None, to_time=None):
"""
Uses the |get_reports_page| method to create a generator that returns each successive report as a trustar
report object.
:param boolean is_enclave: restrict reports ... | [
"def",
"get_reports",
"(",
"self",
",",
"is_enclave",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
")",
":",
"return",
"Page",
".",... | Uses the |get_reports_page| method to create a generator that returns each successive report as a trustar
report object.
:param boolean is_enclave: restrict reports to specific distribution type (optional - by default all accessible
reports are returned).
:param list(str) enclave_id... | [
"Uses",
"the",
"|get_reports_page|",
"method",
"to",
"create",
"a",
"generator",
"that",
"returns",
"each",
"successive",
"report",
"as",
"a",
"trustar",
"report",
"object",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L346-L381 |
trustar/trustar-python | trustar/report_client.py | ReportClient._get_correlated_reports_page_generator | def _get_correlated_reports_page_generator(self, indicators, enclave_ids=None, is_enclave=True,
start_page=0, page_size=None):
"""
Creates a generator from the |get_correlated_reports_page| method that returns each
successive page.
:param i... | python | def _get_correlated_reports_page_generator(self, indicators, enclave_ids=None, is_enclave=True,
start_page=0, page_size=None):
"""
Creates a generator from the |get_correlated_reports_page| method that returns each
successive page.
:param i... | [
"def",
"_get_correlated_reports_page_generator",
"(",
"self",
",",
"indicators",
",",
"enclave_ids",
"=",
"None",
",",
"is_enclave",
"=",
"True",
",",
"start_page",
"=",
"0",
",",
"page_size",
"=",
"None",
")",
":",
"get_page",
"=",
"functools",
".",
"partial"... | Creates a generator from the |get_correlated_reports_page| method that returns each
successive page.
:param indicators: A list of indicator values to retrieve correlated reports for.
:param enclave_ids:
:param is_enclave:
:return: The generator. | [
"Creates",
"a",
"generator",
"from",
"the",
"|get_correlated_reports_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L383-L396 |
trustar/trustar-python | trustar/report_client.py | ReportClient.get_correlated_reports | def get_correlated_reports(self, indicators, enclave_ids=None, is_enclave=True):
"""
Uses the |get_correlated_reports_page| method to create a generator that returns each successive report.
:param indicators: A list of indicator values to retrieve correlated reports for.
:param enclave_... | python | def get_correlated_reports(self, indicators, enclave_ids=None, is_enclave=True):
"""
Uses the |get_correlated_reports_page| method to create a generator that returns each successive report.
:param indicators: A list of indicator values to retrieve correlated reports for.
:param enclave_... | [
"def",
"get_correlated_reports",
"(",
"self",
",",
"indicators",
",",
"enclave_ids",
"=",
"None",
",",
"is_enclave",
"=",
"True",
")",
":",
"return",
"Page",
".",
"get_generator",
"(",
"page_generator",
"=",
"self",
".",
"_get_correlated_reports_page_generator",
"... | Uses the |get_correlated_reports_page| method to create a generator that returns each successive report.
:param indicators: A list of indicator values to retrieve correlated reports for.
:param enclave_ids: The enclaves to search in.
:param is_enclave: Whether to search enclave reports or commu... | [
"Uses",
"the",
"|get_correlated_reports_page|",
"method",
"to",
"create",
"a",
"generator",
"that",
"returns",
"each",
"successive",
"report",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L398-L410 |
trustar/trustar-python | trustar/report_client.py | ReportClient._search_reports_page_generator | def _search_reports_page_generator(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
exclude... | python | def _search_reports_page_generator(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
exclude... | [
"def",
"_search_reports_page_generator",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
",",
"start_page"... | Creates a generator from the |search_reports_page| method that returns each successive page.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used to restri... | [
"Creates",
"a",
"generator",
"from",
"the",
"|search_reports_page|",
"method",
"that",
"returns",
"each",
"successive",
"page",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L412-L439 |
trustar/trustar-python | trustar/report_client.py | ReportClient.search_reports | def search_reports(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
excluded_tags=None):
"""
Uses the |search_reports_page| method to create a generator th... | python | def search_reports(self, search_term=None,
enclave_ids=None,
from_time=None,
to_time=None,
tags=None,
excluded_tags=None):
"""
Uses the |search_reports_page| method to create a generator th... | [
"def",
"search_reports",
"(",
"self",
",",
"search_term",
"=",
"None",
",",
"enclave_ids",
"=",
"None",
",",
"from_time",
"=",
"None",
",",
"to_time",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"excluded_tags",
"=",
"None",
")",
":",
"return",
"Page",
... | Uses the |search_reports_page| method to create a generator that returns each successive report.
:param str search_term: The term to search for. If empty, no search term will be applied. Otherwise, must
be at least 3 characters.
:param list(str) enclave_ids: list of enclave ids used to re... | [
"Uses",
"the",
"|search_reports_page|",
"method",
"to",
"create",
"a",
"generator",
"that",
"returns",
"each",
"successive",
"report",
"."
] | train | https://github.com/trustar/trustar-python/blob/707d51adc58d68aed7de12a4ca37949cb75cf122/trustar/report_client.py#L441-L464 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.