id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,400 | SteemData/steemdata | steemdata/utils.py | typify | def typify(value: Union[dict, list, set, str]):
""" Enhance block operation with native types.
Typify takes a blockchain operation or dict/list/value,
and then it parses and converts string types into native data types where appropriate.
"""
if type(value) == dict:
return walk_values(typify... | python | def typify(value: Union[dict, list, set, str]):
""" Enhance block operation with native types.
Typify takes a blockchain operation or dict/list/value,
and then it parses and converts string types into native data types where appropriate.
"""
if type(value) == dict:
return walk_values(typify... | [
"def",
"typify",
"(",
"value",
":",
"Union",
"[",
"dict",
",",
"list",
",",
"set",
",",
"str",
"]",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"dict",
":",
"return",
"walk_values",
"(",
"typify",
",",
"value",
")",
"if",
"type",
"(",
"value... | Enhance block operation with native types.
Typify takes a blockchain operation or dict/list/value,
and then it parses and converts string types into native data types where appropriate. | [
"Enhance",
"block",
"operation",
"with",
"native",
"types",
"."
] | 64dfc6d795deeb922e9041fa53e0946f07708ea1 | https://github.com/SteemData/steemdata/blob/64dfc6d795deeb922e9041fa53e0946f07708ea1/steemdata/utils.py#L12-L31 |
38,401 | SteemData/steemdata | steemdata/utils.py | json_expand | def json_expand(json_op):
""" For custom_json ops. """
if type(json_op) == dict and 'json' in json_op:
return update_in(json_op, ['json'], safe_json_loads)
return json_op | python | def json_expand(json_op):
""" For custom_json ops. """
if type(json_op) == dict and 'json' in json_op:
return update_in(json_op, ['json'], safe_json_loads)
return json_op | [
"def",
"json_expand",
"(",
"json_op",
")",
":",
"if",
"type",
"(",
"json_op",
")",
"==",
"dict",
"and",
"'json'",
"in",
"json_op",
":",
"return",
"update_in",
"(",
"json_op",
",",
"[",
"'json'",
"]",
",",
"safe_json_loads",
")",
"return",
"json_op"
] | For custom_json ops. | [
"For",
"custom_json",
"ops",
"."
] | 64dfc6d795deeb922e9041fa53e0946f07708ea1 | https://github.com/SteemData/steemdata/blob/64dfc6d795deeb922e9041fa53e0946f07708ea1/steemdata/utils.py#L41-L46 |
38,402 | HPCC-Cloud-Computing/CAL | calplus/v1/network/drivers/amazon.py | AmazonDriver.delete | def delete(self, subnet_id):
"""
This is bad delete function
because one vpc can have more than one subnet.
It is Ok if user only use CAL for manage cloud resource
We will update ASAP.
"""
# 1 : show subnet
subnet = self.client.describe_subnets(
... | python | def delete(self, subnet_id):
"""
This is bad delete function
because one vpc can have more than one subnet.
It is Ok if user only use CAL for manage cloud resource
We will update ASAP.
"""
# 1 : show subnet
subnet = self.client.describe_subnets(
... | [
"def",
"delete",
"(",
"self",
",",
"subnet_id",
")",
":",
"# 1 : show subnet",
"subnet",
"=",
"self",
".",
"client",
".",
"describe_subnets",
"(",
"SubnetIds",
"=",
"[",
"subnet_id",
"]",
")",
".",
"get",
"(",
"'Subnets'",
")",
"[",
"0",
"]",
"vpc_id",
... | This is bad delete function
because one vpc can have more than one subnet.
It is Ok if user only use CAL for manage cloud resource
We will update ASAP. | [
"This",
"is",
"bad",
"delete",
"function",
"because",
"one",
"vpc",
"can",
"have",
"more",
"than",
"one",
"subnet",
".",
"It",
"is",
"Ok",
"if",
"user",
"only",
"use",
"CAL",
"for",
"manage",
"cloud",
"resource",
"We",
"will",
"update",
"ASAP",
"."
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/network/drivers/amazon.py#L103-L117 |
38,403 | GeorgeArgyros/symautomata | symautomata/cfggenerator.py | CFGGenerator._clean_terminals | def _clean_terminals(self):
"""
Because of the optimization, there are some non existing terminals
on the generated list. Remove them by checking for terms in form Ax,x
"""
new_terminals = []
for term in self.grammar.grammar_terminals:
x_term = term.rfind('@')... | python | def _clean_terminals(self):
"""
Because of the optimization, there are some non existing terminals
on the generated list. Remove them by checking for terms in form Ax,x
"""
new_terminals = []
for term in self.grammar.grammar_terminals:
x_term = term.rfind('@')... | [
"def",
"_clean_terminals",
"(",
"self",
")",
":",
"new_terminals",
"=",
"[",
"]",
"for",
"term",
"in",
"self",
".",
"grammar",
".",
"grammar_terminals",
":",
"x_term",
"=",
"term",
".",
"rfind",
"(",
"'@'",
")",
"y_term",
"=",
"term",
".",
"rfind",
"("... | Because of the optimization, there are some non existing terminals
on the generated list. Remove them by checking for terms in form Ax,x | [
"Because",
"of",
"the",
"optimization",
"there",
"are",
"some",
"non",
"existing",
"terminals",
"on",
"the",
"generated",
"list",
".",
"Remove",
"them",
"by",
"checking",
"for",
"terms",
"in",
"form",
"Ax",
"x"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/cfggenerator.py#L189-L204 |
38,404 | GeorgeArgyros/symautomata | symautomata/cfggenerator.py | CFGGenerator._check_self_replicate | def _check_self_replicate(self, myntr):
"""
For each Rule B -> c where c is a known terminal, this function
searches for B occurences in rules with the form A -> B and sets
A -> c.
"""
# print 'BFS Dictionary Update - Self Replicate'
find = 0
for nonterm i... | python | def _check_self_replicate(self, myntr):
"""
For each Rule B -> c where c is a known terminal, this function
searches for B occurences in rules with the form A -> B and sets
A -> c.
"""
# print 'BFS Dictionary Update - Self Replicate'
find = 0
for nonterm i... | [
"def",
"_check_self_replicate",
"(",
"self",
",",
"myntr",
")",
":",
"# print 'BFS Dictionary Update - Self Replicate'",
"find",
"=",
"0",
"for",
"nonterm",
"in",
"self",
".",
"grammar",
".",
"grammar_nonterminals_map",
":",
"for",
"i",
"in",
"self",
".",
"grammar... | For each Rule B -> c where c is a known terminal, this function
searches for B occurences in rules with the form A -> B and sets
A -> c. | [
"For",
"each",
"Rule",
"B",
"-",
">",
"c",
"where",
"c",
"is",
"a",
"known",
"terminal",
"this",
"function",
"searches",
"for",
"B",
"occurences",
"in",
"rules",
"with",
"the",
"form",
"A",
"-",
">",
"B",
"and",
"sets",
"A",
"-",
">",
"c",
"."
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/cfggenerator.py#L287-L308 |
38,405 | Equitable/trump | trump/orm.py | Symbol.describe | def describe(self):
""" describes a Symbol, returns a string """
lines = []
lines.append("Symbol = {}".format(self.name))
if len(self.tags):
tgs = ", ".join(x.tag for x in self.tags)
lines.append(" tagged = {}".format(tgs))
if len(self.aliases):
... | python | def describe(self):
""" describes a Symbol, returns a string """
lines = []
lines.append("Symbol = {}".format(self.name))
if len(self.tags):
tgs = ", ".join(x.tag for x in self.tags)
lines.append(" tagged = {}".format(tgs))
if len(self.aliases):
... | [
"def",
"describe",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"]",
"lines",
".",
"append",
"(",
"\"Symbol = {}\"",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"if",
"len",
"(",
"self",
".",
"tags",
")",
":",
"tgs",
"=",
"\", \"",
".",
"join... | describes a Symbol, returns a string | [
"describes",
"a",
"Symbol",
"returns",
"a",
"string"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1270-L1286 |
38,406 | Equitable/trump | trump/orm.py | Symbol.datatable_df | def datatable_df(self):
""" returns the dataframe representation of the symbol's final data """
data = self._all_datatable_data()
adf = pd.DataFrame(data)
adf.columns = self.dt_all_cols
return self._finish_df(adf, 'ALL') | python | def datatable_df(self):
""" returns the dataframe representation of the symbol's final data """
data = self._all_datatable_data()
adf = pd.DataFrame(data)
adf.columns = self.dt_all_cols
return self._finish_df(adf, 'ALL') | [
"def",
"datatable_df",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_all_datatable_data",
"(",
")",
"adf",
"=",
"pd",
".",
"DataFrame",
"(",
"data",
")",
"adf",
".",
"columns",
"=",
"self",
".",
"dt_all_cols",
"return",
"self",
".",
"_finish_df",
... | returns the dataframe representation of the symbol's final data | [
"returns",
"the",
"dataframe",
"representation",
"of",
"the",
"symbol",
"s",
"final",
"data"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1478-L1483 |
38,407 | Equitable/trump | trump/orm.py | Symbol._init_datatable | def _init_datatable(self):
"""
Instantiates the .datatable attribute, pointing to a table in the
database that stores all the cached data
"""
try:
self.datatable = Table(self.name, Base.metadata, autoload=True)
except NoSuchTableError:
prin... | python | def _init_datatable(self):
"""
Instantiates the .datatable attribute, pointing to a table in the
database that stores all the cached data
"""
try:
self.datatable = Table(self.name, Base.metadata, autoload=True)
except NoSuchTableError:
prin... | [
"def",
"_init_datatable",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"datatable",
"=",
"Table",
"(",
"self",
".",
"name",
",",
"Base",
".",
"metadata",
",",
"autoload",
"=",
"True",
")",
"except",
"NoSuchTableError",
":",
"print",
"\"Creating datatabl... | Instantiates the .datatable attribute, pointing to a table in the
database that stores all the cached data | [
"Instantiates",
"the",
".",
"datatable",
"attribute",
"pointing",
"to",
"a",
"table",
"in",
"the",
"database",
"that",
"stores",
"all",
"the",
"cached",
"data"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1525-L1536 |
38,408 | Equitable/trump | trump/orm.py | Symbol._datatable_factory | def _datatable_factory(self):
"""
creates a SQLAlchemy Table object with the appropriate number of
columns given the number of feeds
"""
feed_cols = ['feed{0:03d}'.format(i + 1) for i in range(self.n_feeds)]
feed_cols = ['override_feed000'] + feed_cols + ['failsafe_... | python | def _datatable_factory(self):
"""
creates a SQLAlchemy Table object with the appropriate number of
columns given the number of feeds
"""
feed_cols = ['feed{0:03d}'.format(i + 1) for i in range(self.n_feeds)]
feed_cols = ['override_feed000'] + feed_cols + ['failsafe_... | [
"def",
"_datatable_factory",
"(",
"self",
")",
":",
"feed_cols",
"=",
"[",
"'feed{0:03d}'",
".",
"format",
"(",
"i",
"+",
"1",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"n_feeds",
")",
"]",
"feed_cols",
"=",
"[",
"'override_feed000'",
"]",
"+",... | creates a SQLAlchemy Table object with the appropriate number of
columns given the number of feeds | [
"creates",
"a",
"SQLAlchemy",
"Table",
"object",
"with",
"the",
"appropriate",
"number",
"of",
"columns",
"given",
"the",
"number",
"of",
"feeds"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1552-L1571 |
38,409 | Equitable/trump | trump/orm.py | Feed.add_tags | def add_tags(self, tags):
""" add a tag or tags to a Feed """
if isinstance(tags, (str, unicode)):
tags = [tags]
objs = object_session(self)
tmps = [FeedTag(tag=t, feed=self) for t in tags]
objs.add_all(tmps)
objs.commit() | python | def add_tags(self, tags):
""" add a tag or tags to a Feed """
if isinstance(tags, (str, unicode)):
tags = [tags]
objs = object_session(self)
tmps = [FeedTag(tag=t, feed=self) for t in tags]
objs.add_all(tmps)
objs.commit() | [
"def",
"add_tags",
"(",
"self",
",",
"tags",
")",
":",
"if",
"isinstance",
"(",
"tags",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"tags",
"=",
"[",
"tags",
"]",
"objs",
"=",
"object_session",
"(",
"self",
")",
"tmps",
"=",
"[",
"FeedTag",
"... | add a tag or tags to a Feed | [
"add",
"a",
"tag",
"or",
"tags",
"to",
"a",
"Feed"
] | a2802692bc642fa32096374159eea7ceca2947b4 | https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/trump/orm.py#L1946-L1955 |
38,410 | jplusplus/statscraper | statscraper/scrapers/work_injury_scraper.py | WorkInjuries.initiate_browser | def initiate_browser(self):
# Create a unique tempdir for downloaded files
tempdir = os.getenv(TEMPDIR_ENVVAR, DEFAULT_TEMPDIR)
tempsubdir = uuid4().hex
# TODO: Remove this directory when finished!
self.tempdir = os.path.join(tempdir, tempsubdir)
try:
# Try a... | python | def initiate_browser(self):
# Create a unique tempdir for downloaded files
tempdir = os.getenv(TEMPDIR_ENVVAR, DEFAULT_TEMPDIR)
tempsubdir = uuid4().hex
# TODO: Remove this directory when finished!
self.tempdir = os.path.join(tempdir, tempsubdir)
try:
# Try a... | [
"def",
"initiate_browser",
"(",
"self",
")",
":",
"# Create a unique tempdir for downloaded files",
"tempdir",
"=",
"os",
".",
"getenv",
"(",
"TEMPDIR_ENVVAR",
",",
"DEFAULT_TEMPDIR",
")",
"tempsubdir",
"=",
"uuid4",
"(",
")",
".",
"hex",
"# TODO: Remove this director... | The button for expanded detailed options. This
also happens to be a good indicator as to wheter
all content is loaded. | [
"The",
"button",
"for",
"expanded",
"detailed",
"options",
".",
"This",
"also",
"happens",
"to",
"be",
"a",
"good",
"indicator",
"as",
"to",
"wheter",
"all",
"content",
"is",
"loaded",
"."
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/work_injury_scraper.py#L35-L85 |
38,411 | e7dal/bubble3 | behave4cmd0/log/steps.py | step_I_create_logrecords_with_table | def step_I_create_logrecords_with_table(context):
"""
Step definition that creates one more log records by using a table.
.. code-block: gherkin
When I create log records with:
| category | level | message |
| foo | ERROR | Hello Foo |
| foo.bar | WARN ... | python | def step_I_create_logrecords_with_table(context):
"""
Step definition that creates one more log records by using a table.
.. code-block: gherkin
When I create log records with:
| category | level | message |
| foo | ERROR | Hello Foo |
| foo.bar | WARN ... | [
"def",
"step_I_create_logrecords_with_table",
"(",
"context",
")",
":",
"assert",
"context",
".",
"table",
",",
"\"REQUIRE: context.table\"",
"context",
".",
"table",
".",
"require_columns",
"(",
"[",
"\"category\"",
",",
"\"level\"",
",",
"\"message\"",
"]",
")",
... | Step definition that creates one more log records by using a table.
.. code-block: gherkin
When I create log records with:
| category | level | message |
| foo | ERROR | Hello Foo |
| foo.bar | WARN | Hello Foo.Bar |
Table description
-----------------... | [
"Step",
"definition",
"that",
"creates",
"one",
"more",
"log",
"records",
"by",
"using",
"a",
"table",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/log/steps.py#L134-L170 |
38,412 | e7dal/bubble3 | behave4cmd0/log/steps.py | step_I_create_logrecord_with_table | def step_I_create_logrecord_with_table(context):
"""
Create an log record by using a table to provide the parts.
.. seealso: :func:`step_I_create_logrecords_with_table()`
"""
assert context.table, "REQUIRE: context.table"
assert len(context.table.rows) == 1, "REQUIRE: table.row.size == 1"
s... | python | def step_I_create_logrecord_with_table(context):
"""
Create an log record by using a table to provide the parts.
.. seealso: :func:`step_I_create_logrecords_with_table()`
"""
assert context.table, "REQUIRE: context.table"
assert len(context.table.rows) == 1, "REQUIRE: table.row.size == 1"
s... | [
"def",
"step_I_create_logrecord_with_table",
"(",
"context",
")",
":",
"assert",
"context",
".",
"table",
",",
"\"REQUIRE: context.table\"",
"assert",
"len",
"(",
"context",
".",
"table",
".",
"rows",
")",
"==",
"1",
",",
"\"REQUIRE: table.row.size == 1\"",
"step_I_... | Create an log record by using a table to provide the parts.
.. seealso: :func:`step_I_create_logrecords_with_table()` | [
"Create",
"an",
"log",
"record",
"by",
"using",
"a",
"table",
"to",
"provide",
"the",
"parts",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/log/steps.py#L174-L182 |
38,413 | e7dal/bubble3 | behave4cmd0/log/steps.py | step_use_log_record_configuration | def step_use_log_record_configuration(context):
"""
Define log record configuration parameters.
.. code-block: gherkin
Given I use the log record configuration:
| property | value |
| format | |
| datefmt | |
"""
assert context.table, "REQ... | python | def step_use_log_record_configuration(context):
"""
Define log record configuration parameters.
.. code-block: gherkin
Given I use the log record configuration:
| property | value |
| format | |
| datefmt | |
"""
assert context.table, "REQ... | [
"def",
"step_use_log_record_configuration",
"(",
"context",
")",
":",
"assert",
"context",
".",
"table",
",",
"\"REQUIRE: context.table\"",
"context",
".",
"table",
".",
"require_columns",
"(",
"[",
"\"property\"",
",",
"\"value\"",
"]",
")",
"for",
"row",
"in",
... | Define log record configuration parameters.
.. code-block: gherkin
Given I use the log record configuration:
| property | value |
| format | |
| datefmt | | | [
"Define",
"log",
"record",
"configuration",
"parameters",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/log/steps.py#L350-L371 |
38,414 | MacHu-GWU/crawlib-project | crawlib/decode.py | smart_decode | def smart_decode(binary, errors="strict"):
"""
Automatically find the right codec to decode binary data to string.
:param binary: binary data
:param errors: one of 'strict', 'ignore' and 'replace'
:return: string
"""
d = chardet.detect(binary)
encoding = d["encoding"]
confidence = d... | python | def smart_decode(binary, errors="strict"):
"""
Automatically find the right codec to decode binary data to string.
:param binary: binary data
:param errors: one of 'strict', 'ignore' and 'replace'
:return: string
"""
d = chardet.detect(binary)
encoding = d["encoding"]
confidence = d... | [
"def",
"smart_decode",
"(",
"binary",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"d",
"=",
"chardet",
".",
"detect",
"(",
"binary",
")",
"encoding",
"=",
"d",
"[",
"\"encoding\"",
"]",
"confidence",
"=",
"d",
"[",
"\"confidence\"",
"]",
"text",
"=",
"... | Automatically find the right codec to decode binary data to string.
:param binary: binary data
:param errors: one of 'strict', 'ignore' and 'replace'
:return: string | [
"Automatically",
"find",
"the",
"right",
"codec",
"to",
"decode",
"binary",
"data",
"to",
"string",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/decode.py#L12-L25 |
38,415 | MacHu-GWU/crawlib-project | crawlib/decode.py | UrlSpecifiedDecoder.decode | def decode(self, binary, url, encoding=None, errors="strict"):
"""
Decode binary to string.
:param binary: binary content of a http request.
:param url: endpoint of the request.
:param encoding: manually specify the encoding.
:param errors: errors handle method.
... | python | def decode(self, binary, url, encoding=None, errors="strict"):
"""
Decode binary to string.
:param binary: binary content of a http request.
:param url: endpoint of the request.
:param encoding: manually specify the encoding.
:param errors: errors handle method.
... | [
"def",
"decode",
"(",
"self",
",",
"binary",
",",
"url",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"encoding",
"is",
"None",
":",
"domain",
"=",
"util",
".",
"get_domain",
"(",
"url",
")",
"if",
"domain",
"in",
... | Decode binary to string.
:param binary: binary content of a http request.
:param url: endpoint of the request.
:param encoding: manually specify the encoding.
:param errors: errors handle method.
:return: str | [
"Decode",
"binary",
"to",
"string",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/decode.py#L49-L73 |
38,416 | what-studio/smartformat | smartformat/dotnet.py | modify_number_pattern | def modify_number_pattern(number_pattern, **kwargs):
"""Modifies a number pattern by specified keyword arguments."""
params = ['pattern', 'prefix', 'suffix', 'grouping',
'int_prec', 'frac_prec', 'exp_prec', 'exp_plus']
for param in params:
if param in kwargs:
continue
... | python | def modify_number_pattern(number_pattern, **kwargs):
"""Modifies a number pattern by specified keyword arguments."""
params = ['pattern', 'prefix', 'suffix', 'grouping',
'int_prec', 'frac_prec', 'exp_prec', 'exp_plus']
for param in params:
if param in kwargs:
continue
... | [
"def",
"modify_number_pattern",
"(",
"number_pattern",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"[",
"'pattern'",
",",
"'prefix'",
",",
"'suffix'",
",",
"'grouping'",
",",
"'int_prec'",
",",
"'frac_prec'",
",",
"'exp_prec'",
",",
"'exp_plus'",
"]",
... | Modifies a number pattern by specified keyword arguments. | [
"Modifies",
"a",
"number",
"pattern",
"by",
"specified",
"keyword",
"arguments",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L31-L39 |
38,417 | what-studio/smartformat | smartformat/dotnet.py | format_currency_field | def format_currency_field(__, prec, number, locale):
"""Formats a currency field."""
locale = Locale.parse(locale)
currency = get_territory_currencies(locale.territory)[0]
if prec is None:
pattern, currency_digits = None, True
else:
prec = int(prec)
pattern = locale.currency_... | python | def format_currency_field(__, prec, number, locale):
"""Formats a currency field."""
locale = Locale.parse(locale)
currency = get_territory_currencies(locale.territory)[0]
if prec is None:
pattern, currency_digits = None, True
else:
prec = int(prec)
pattern = locale.currency_... | [
"def",
"format_currency_field",
"(",
"__",
",",
"prec",
",",
"number",
",",
"locale",
")",
":",
"locale",
"=",
"Locale",
".",
"parse",
"(",
"locale",
")",
"currency",
"=",
"get_territory_currencies",
"(",
"locale",
".",
"territory",
")",
"[",
"0",
"]",
"... | Formats a currency field. | [
"Formats",
"a",
"currency",
"field",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L58-L70 |
38,418 | what-studio/smartformat | smartformat/dotnet.py | format_float_field | def format_float_field(__, prec, number, locale):
"""Formats a fixed-point field."""
format_ = u'0.'
if prec is None:
format_ += u'#' * NUMBER_DECIMAL_DIGITS
else:
format_ += u'0' * int(prec)
pattern = parse_pattern(format_)
return pattern.apply(number, locale) | python | def format_float_field(__, prec, number, locale):
"""Formats a fixed-point field."""
format_ = u'0.'
if prec is None:
format_ += u'#' * NUMBER_DECIMAL_DIGITS
else:
format_ += u'0' * int(prec)
pattern = parse_pattern(format_)
return pattern.apply(number, locale) | [
"def",
"format_float_field",
"(",
"__",
",",
"prec",
",",
"number",
",",
"locale",
")",
":",
"format_",
"=",
"u'0.'",
"if",
"prec",
"is",
"None",
":",
"format_",
"+=",
"u'#'",
"*",
"NUMBER_DECIMAL_DIGITS",
"else",
":",
"format_",
"+=",
"u'0'",
"*",
"int"... | Formats a fixed-point field. | [
"Formats",
"a",
"fixed",
"-",
"point",
"field",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L103-L111 |
38,419 | what-studio/smartformat | smartformat/dotnet.py | format_number_field | def format_number_field(__, prec, number, locale):
"""Formats a number field."""
prec = NUMBER_DECIMAL_DIGITS if prec is None else int(prec)
locale = Locale.parse(locale)
pattern = locale.decimal_formats.get(None)
return pattern.apply(number, locale, force_frac=(prec, prec)) | python | def format_number_field(__, prec, number, locale):
"""Formats a number field."""
prec = NUMBER_DECIMAL_DIGITS if prec is None else int(prec)
locale = Locale.parse(locale)
pattern = locale.decimal_formats.get(None)
return pattern.apply(number, locale, force_frac=(prec, prec)) | [
"def",
"format_number_field",
"(",
"__",
",",
"prec",
",",
"number",
",",
"locale",
")",
":",
"prec",
"=",
"NUMBER_DECIMAL_DIGITS",
"if",
"prec",
"is",
"None",
"else",
"int",
"(",
"prec",
")",
"locale",
"=",
"Locale",
".",
"parse",
"(",
"locale",
")",
... | Formats a number field. | [
"Formats",
"a",
"number",
"field",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L116-L121 |
38,420 | what-studio/smartformat | smartformat/dotnet.py | format_percent_field | def format_percent_field(__, prec, number, locale):
"""Formats a percent field."""
prec = PERCENT_DECIMAL_DIGITS if prec is None else int(prec)
locale = Locale.parse(locale)
pattern = locale.percent_formats.get(None)
return pattern.apply(number, locale, force_frac=(prec, prec)) | python | def format_percent_field(__, prec, number, locale):
"""Formats a percent field."""
prec = PERCENT_DECIMAL_DIGITS if prec is None else int(prec)
locale = Locale.parse(locale)
pattern = locale.percent_formats.get(None)
return pattern.apply(number, locale, force_frac=(prec, prec)) | [
"def",
"format_percent_field",
"(",
"__",
",",
"prec",
",",
"number",
",",
"locale",
")",
":",
"prec",
"=",
"PERCENT_DECIMAL_DIGITS",
"if",
"prec",
"is",
"None",
"else",
"int",
"(",
"prec",
")",
"locale",
"=",
"Locale",
".",
"parse",
"(",
"locale",
")",
... | Formats a percent field. | [
"Formats",
"a",
"percent",
"field",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L126-L131 |
38,421 | what-studio/smartformat | smartformat/dotnet.py | format_hexadecimal_field | def format_hexadecimal_field(spec, prec, number, locale):
"""Formats a hexadeciaml field."""
if number < 0:
# Take two's complement.
number &= (1 << (8 * int(math.log(-number, 1 << 8) + 1))) - 1
format_ = u'0%d%s' % (int(prec or 0), spec)
return format(number, format_) | python | def format_hexadecimal_field(spec, prec, number, locale):
"""Formats a hexadeciaml field."""
if number < 0:
# Take two's complement.
number &= (1 << (8 * int(math.log(-number, 1 << 8) + 1))) - 1
format_ = u'0%d%s' % (int(prec or 0), spec)
return format(number, format_) | [
"def",
"format_hexadecimal_field",
"(",
"spec",
",",
"prec",
",",
"number",
",",
"locale",
")",
":",
"if",
"number",
"<",
"0",
":",
"# Take two's complement.",
"number",
"&=",
"(",
"1",
"<<",
"(",
"8",
"*",
"int",
"(",
"math",
".",
"log",
"(",
"-",
"... | Formats a hexadeciaml field. | [
"Formats",
"a",
"hexadeciaml",
"field",
"."
] | 5731203cbf29617ab8d42542f9dac03d5e34b217 | https://github.com/what-studio/smartformat/blob/5731203cbf29617ab8d42542f9dac03d5e34b217/smartformat/dotnet.py#L136-L142 |
38,422 | hsharrison/smartcompose | smartcompose.py | delegate | def delegate(attribute_name, method_names):
"""
Decorator factory to delegate methods to an attribute.
Decorate a class to map every method in `method_names` to the attribute `attribute_name`.
"""
call_attribute_method = partial(_call_delegated_method, attribute_name)
def decorate(class_):
... | python | def delegate(attribute_name, method_names):
"""
Decorator factory to delegate methods to an attribute.
Decorate a class to map every method in `method_names` to the attribute `attribute_name`.
"""
call_attribute_method = partial(_call_delegated_method, attribute_name)
def decorate(class_):
... | [
"def",
"delegate",
"(",
"attribute_name",
",",
"method_names",
")",
":",
"call_attribute_method",
"=",
"partial",
"(",
"_call_delegated_method",
",",
"attribute_name",
")",
"def",
"decorate",
"(",
"class_",
")",
":",
"for",
"method",
"in",
"method_names",
":",
"... | Decorator factory to delegate methods to an attribute.
Decorate a class to map every method in `method_names` to the attribute `attribute_name`. | [
"Decorator",
"factory",
"to",
"delegate",
"methods",
"to",
"an",
"attribute",
"."
] | 3f7cdeaf0812b35b2c49a6917815abca6e2c48ca | https://github.com/hsharrison/smartcompose/blob/3f7cdeaf0812b35b2c49a6917815abca6e2c48ca/smartcompose.py#L24-L38 |
38,423 | MostAwesomeDude/gentleman | gentleman/helpers.py | prepare_query | def prepare_query(query):
"""
Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments
"""
for name in query:
value = query[name]
... | python | def prepare_query(query):
"""
Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments
"""
for name in query:
value = query[name]
... | [
"def",
"prepare_query",
"(",
"query",
")",
":",
"for",
"name",
"in",
"query",
":",
"value",
"=",
"query",
"[",
"name",
"]",
"# None is sent as an empty string.",
"if",
"value",
"is",
"None",
":",
"query",
"[",
"name",
"]",
"=",
"\"\"",
"# Booleans are sent a... | Prepare a query object for the RAPI.
RAPI has lots of curious rules for coercing values.
This function operates on dicts in-place and has no return value.
@type query: dict
@param query: Query arguments | [
"Prepare",
"a",
"query",
"object",
"for",
"the",
"RAPI",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/helpers.py#L7-L33 |
38,424 | MostAwesomeDude/gentleman | gentleman/helpers.py | itemgetters | def itemgetters(*args):
"""
Get a handful of items from an iterable.
This is just map(itemgetter(...), iterable) with a list comprehension.
"""
f = itemgetter(*args)
def inner(l):
return [f(x) for x in l]
return inner | python | def itemgetters(*args):
"""
Get a handful of items from an iterable.
This is just map(itemgetter(...), iterable) with a list comprehension.
"""
f = itemgetter(*args)
def inner(l):
return [f(x) for x in l]
return inner | [
"def",
"itemgetters",
"(",
"*",
"args",
")",
":",
"f",
"=",
"itemgetter",
"(",
"*",
"args",
")",
"def",
"inner",
"(",
"l",
")",
":",
"return",
"[",
"f",
"(",
"x",
")",
"for",
"x",
"in",
"l",
"]",
"return",
"inner"
] | Get a handful of items from an iterable.
This is just map(itemgetter(...), iterable) with a list comprehension. | [
"Get",
"a",
"handful",
"of",
"items",
"from",
"an",
"iterable",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/helpers.py#L35-L47 |
38,425 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.stat_container | def stat_container(self, container):
"""Stat container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
"""
LOG.debug('stat_container() with %s is success.', self.driver)
return self.driver.stat_container(con... | python | def stat_container(self, container):
"""Stat container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
"""
LOG.debug('stat_container() with %s is success.', self.driver)
return self.driver.stat_container(con... | [
"def",
"stat_container",
"(",
"self",
",",
"container",
")",
":",
"LOG",
".",
"debug",
"(",
"'stat_container() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
".",
"driver",
".",
"stat_container",
"(",
"container",
")"
] | Stat container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon). | [
"Stat",
"container",
"metadata"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L53-L60 |
38,426 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.update_container | def update_container(self, container, metadata, **kwargs):
"""Update container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param metadata(dict): additional metadata to include in the request.
:param **kwargs(di... | python | def update_container(self, container, metadata, **kwargs):
"""Update container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param metadata(dict): additional metadata to include in the request.
:param **kwargs(di... | [
"def",
"update_container",
"(",
"self",
",",
"container",
",",
"metadata",
",",
"*",
"*",
"kwargs",
")",
":",
"LOG",
".",
"debug",
"(",
"'update_object() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
".",
"driver",
".",
"update_co... | Update container metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param metadata(dict): additional metadata to include in the request.
:param **kwargs(dict): extend args for specific driver. | [
"Update",
"container",
"metadata"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L62-L71 |
38,427 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.stat_object | def stat_object(self, container, obj):
"""Stat object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
"""
LOG.debug('... | python | def stat_object(self, container, obj):
"""Stat object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
"""
LOG.debug('... | [
"def",
"stat_object",
"(",
"self",
",",
"container",
",",
"obj",
")",
":",
"LOG",
".",
"debug",
"(",
"'stat_object() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
".",
"driver",
".",
"stat_object",
"(",
"container",
",",
"obj",
... | Stat object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon). | [
"Stat",
"object",
"metadata"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L112-L121 |
38,428 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.delete_object | def delete_object(self, container, obj, **kwargs):
"""Delete object in container
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
"""
... | python | def delete_object(self, container, obj, **kwargs):
"""Delete object in container
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
"""
... | [
"def",
"delete_object",
"(",
"self",
",",
"container",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"LOG",
".",
"debug",
"(",
"'delete_object() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
".",
"driver",
".",
"d... | Delete object in container
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon). | [
"Delete",
"object",
"in",
"container"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L123-L136 |
38,429 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.list_container_objects | def list_container_objects(self, container, prefix=None, delimiter=None):
"""List container objects
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param prefix: prefix query
:param delimiter: string to delimit the queries ... | python | def list_container_objects(self, container, prefix=None, delimiter=None):
"""List container objects
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param prefix: prefix query
:param delimiter: string to delimit the queries ... | [
"def",
"list_container_objects",
"(",
"self",
",",
"container",
",",
"prefix",
"=",
"None",
",",
"delimiter",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"'list_container_objects() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
... | List container objects
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param prefix: prefix query
:param delimiter: string to delimit the queries on | [
"List",
"container",
"objects"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L138-L147 |
38,430 | HPCC-Cloud-Computing/CAL | calplus/v1/object_storage/client.py | Client.update_object | def update_object(self, container, obj, metadata, **kwargs):
"""Update object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
... | python | def update_object(self, container, obj, metadata, **kwargs):
"""Update object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
... | [
"def",
"update_object",
"(",
"self",
",",
"container",
",",
"obj",
",",
"metadata",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"LOG",
".",
"debug",
"(",
"'update_object() with %s is success.'",
",",
"self",
".",
"driver",
")",
"return",
"self",
".",
... | Update object metadata
:param container: container name (Container is equivalent to
Bucket term in Amazon).
:param obj: object name (Object is equivalent to
Key term in Amazon).
:param metadata(dict): additional metadata to include in the request. | [
"Update",
"object",
"metadata"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/object_storage/client.py#L149-L164 |
38,431 | Cadasta/django-tutelary | tutelary/decorators.py | get_path_fields | def get_path_fields(cls, base=[]):
"""Get object fields used for calculation of django-tutelary object
paths.
"""
pfs = []
for pf in cls.TutelaryMeta.path_fields:
if pf == 'pk':
pfs.append(base + ['pk'])
else:
f = cls._meta.get_field(pf)
if isinst... | python | def get_path_fields(cls, base=[]):
"""Get object fields used for calculation of django-tutelary object
paths.
"""
pfs = []
for pf in cls.TutelaryMeta.path_fields:
if pf == 'pk':
pfs.append(base + ['pk'])
else:
f = cls._meta.get_field(pf)
if isinst... | [
"def",
"get_path_fields",
"(",
"cls",
",",
"base",
"=",
"[",
"]",
")",
":",
"pfs",
"=",
"[",
"]",
"for",
"pf",
"in",
"cls",
".",
"TutelaryMeta",
".",
"path_fields",
":",
"if",
"pf",
"==",
"'pk'",
":",
"pfs",
".",
"append",
"(",
"base",
"+",
"[",
... | Get object fields used for calculation of django-tutelary object
paths. | [
"Get",
"object",
"fields",
"used",
"for",
"calculation",
"of",
"django",
"-",
"tutelary",
"object",
"paths",
"."
] | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/decorators.py#L41-L56 |
38,432 | Cadasta/django-tutelary | tutelary/decorators.py | get_perms_object | def get_perms_object(obj, action):
"""Get the django-tutelary path for an object, based on the fields
listed in ``TutelaryMeta.pfs``.
"""
def get_one(pf):
if isinstance(pf, str):
return pf
else:
return str(reduce(lambda o, f: getattr(o, f), pf, obj))
return O... | python | def get_perms_object(obj, action):
"""Get the django-tutelary path for an object, based on the fields
listed in ``TutelaryMeta.pfs``.
"""
def get_one(pf):
if isinstance(pf, str):
return pf
else:
return str(reduce(lambda o, f: getattr(o, f), pf, obj))
return O... | [
"def",
"get_perms_object",
"(",
"obj",
",",
"action",
")",
":",
"def",
"get_one",
"(",
"pf",
")",
":",
"if",
"isinstance",
"(",
"pf",
",",
"str",
")",
":",
"return",
"pf",
"else",
":",
"return",
"str",
"(",
"reduce",
"(",
"lambda",
"o",
",",
"f",
... | Get the django-tutelary path for an object, based on the fields
listed in ``TutelaryMeta.pfs``. | [
"Get",
"the",
"django",
"-",
"tutelary",
"path",
"for",
"an",
"object",
"based",
"on",
"the",
"fields",
"listed",
"in",
"TutelaryMeta",
".",
"pfs",
"."
] | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/decorators.py#L59-L69 |
38,433 | Cadasta/django-tutelary | tutelary/decorators.py | permissioned_model | def permissioned_model(cls, perm_type=None, path_fields=None, actions=None):
"""Function to set up a model for permissioning. Can either be called
directly, passing a class and suitable values for ``perm_type``,
``path_fields`` and ``actions``, or can be used as a class
decorator, taking values for ``p... | python | def permissioned_model(cls, perm_type=None, path_fields=None, actions=None):
"""Function to set up a model for permissioning. Can either be called
directly, passing a class and suitable values for ``perm_type``,
``path_fields`` and ``actions``, or can be used as a class
decorator, taking values for ``p... | [
"def",
"permissioned_model",
"(",
"cls",
",",
"perm_type",
"=",
"None",
",",
"path_fields",
"=",
"None",
",",
"actions",
"=",
"None",
")",
":",
"if",
"not",
"issubclass",
"(",
"cls",
",",
"models",
".",
"Model",
")",
":",
"raise",
"DecoratorException",
"... | Function to set up a model for permissioning. Can either be called
directly, passing a class and suitable values for ``perm_type``,
``path_fields`` and ``actions``, or can be used as a class
decorator, taking values for ``perm_type``, ``path_fields`` and
``actions`` from the ``TutelaryMeta`` subclass o... | [
"Function",
"to",
"set",
"up",
"a",
"model",
"for",
"permissioning",
".",
"Can",
"either",
"be",
"called",
"directly",
"passing",
"a",
"class",
"and",
"suitable",
"values",
"for",
"perm_type",
"path_fields",
"and",
"actions",
"or",
"can",
"be",
"used",
"as",... | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/decorators.py#L89-L146 |
38,434 | hollenstein/maspy | maspy/core.py | _getArrays | def _getArrays(items, attr, defaultValue):
"""Return arrays with equal size of item attributes from a list of sorted
"items" for fast and convenient data processing.
:param attr: list of item attributes that should be added to the returned
array.
:param defaultValue: if an item is missing an at... | python | def _getArrays(items, attr, defaultValue):
"""Return arrays with equal size of item attributes from a list of sorted
"items" for fast and convenient data processing.
:param attr: list of item attributes that should be added to the returned
array.
:param defaultValue: if an item is missing an at... | [
"def",
"_getArrays",
"(",
"items",
",",
"attr",
",",
"defaultValue",
")",
":",
"arrays",
"=",
"dict",
"(",
"[",
"(",
"key",
",",
"[",
"]",
")",
"for",
"key",
"in",
"attr",
"]",
")",
"for",
"item",
"in",
"items",
":",
"for",
"key",
"in",
"attr",
... | Return arrays with equal size of item attributes from a list of sorted
"items" for fast and convenient data processing.
:param attr: list of item attributes that should be added to the returned
array.
:param defaultValue: if an item is missing an attribute, the "defaultValue"
is added to th... | [
"Return",
"arrays",
"with",
"equal",
"size",
"of",
"item",
"attributes",
"from",
"a",
"list",
"of",
"sorted",
"items",
"for",
"fast",
"and",
"convenient",
"data",
"processing",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L53-L71 |
38,435 | hollenstein/maspy | maspy/core.py | addMsrunContainers | def addMsrunContainers(mainContainer, subContainer):
"""Adds the complete content of all specfile entries from the subContainer
to the mainContainer. However if a specfile of ``subContainer.info`` is
already present in ``mainContainer.info`` its contents are not added to the
mainContainer.
:param m... | python | def addMsrunContainers(mainContainer, subContainer):
"""Adds the complete content of all specfile entries from the subContainer
to the mainContainer. However if a specfile of ``subContainer.info`` is
already present in ``mainContainer.info`` its contents are not added to the
mainContainer.
:param m... | [
"def",
"addMsrunContainers",
"(",
"mainContainer",
",",
"subContainer",
")",
":",
"typeToContainer",
"=",
"{",
"'rm'",
":",
"'rmc'",
",",
"'ci'",
":",
"'cic'",
",",
"'smi'",
":",
"'smic'",
",",
"'sai'",
":",
"'saic'",
",",
"'si'",
":",
"'sic'",
"}",
"for... | Adds the complete content of all specfile entries from the subContainer
to the mainContainer. However if a specfile of ``subContainer.info`` is
already present in ``mainContainer.info`` its contents are not added to the
mainContainer.
:param mainContainer: :class:`MsrunContainer`
:param subContaine... | [
"Adds",
"the",
"complete",
"content",
"of",
"all",
"specfile",
"entries",
"from",
"the",
"subContainer",
"to",
"the",
"mainContainer",
".",
"However",
"if",
"a",
"specfile",
"of",
"subContainer",
".",
"info",
"is",
"already",
"present",
"in",
"mainContainer",
... | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1225-L1256 |
38,436 | hollenstein/maspy | maspy/core.py | MsrunContainer.setPath | def setPath(self, folderpath, specfiles=None):
"""Changes the folderpath of the specified specfiles. The folderpath is
used for saving and loading of ``mrc`` files.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type spe... | python | def setPath(self, folderpath, specfiles=None):
"""Changes the folderpath of the specified specfiles. The folderpath is
used for saving and loading of ``mrc`` files.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type spe... | [
"def",
"setPath",
"(",
"self",
",",
"folderpath",
",",
"specfiles",
"=",
"None",
")",
":",
"if",
"specfiles",
"is",
"None",
":",
"specfiles",
"=",
"[",
"_",
"for",
"_",
"in",
"viewkeys",
"(",
"self",
".",
"info",
")",
"]",
"else",
":",
"specfiles",
... | Changes the folderpath of the specified specfiles. The folderpath is
used for saving and loading of ``mrc`` files.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
:param folderpath: a... | [
"Changes",
"the",
"folderpath",
"of",
"the",
"specified",
"specfiles",
".",
"The",
"folderpath",
"is",
"used",
"for",
"saving",
"and",
"loading",
"of",
"mrc",
"files",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L356-L370 |
38,437 | hollenstein/maspy | maspy/core.py | MsrunContainer.removeSpecfile | def removeSpecfile(self, specfiles):
"""Completely removes the specified specfiles from the
``msrunContainer``.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: str, [str, str]
"""
for specf... | python | def removeSpecfile(self, specfiles):
"""Completely removes the specified specfiles from the
``msrunContainer``.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: str, [str, str]
"""
for specf... | [
"def",
"removeSpecfile",
"(",
"self",
",",
"specfiles",
")",
":",
"for",
"specfile",
"in",
"aux",
".",
"toList",
"(",
"specfiles",
")",
":",
"for",
"datatypeContainer",
"in",
"[",
"'rmc'",
",",
"'cic'",
",",
"'smic'",
",",
"'saic'",
",",
"'sic'",
"]",
... | Completely removes the specified specfiles from the
``msrunContainer``.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: str, [str, str] | [
"Completely",
"removes",
"the",
"specified",
"specfiles",
"from",
"the",
"msrunContainer",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L408-L423 |
38,438 | hollenstein/maspy | maspy/core.py | MsrunContainer._processDatatypes | def _processDatatypes(self, rm, ci, smi, sai, si):
"""Helper function that returns a list of datatype strings, depending
on the parameters boolean value.
:param rm: bool, True to add ``rm``
:param ci: bool, True to add ``ci``
:param smi: bool, True to add ``smi``
:param ... | python | def _processDatatypes(self, rm, ci, smi, sai, si):
"""Helper function that returns a list of datatype strings, depending
on the parameters boolean value.
:param rm: bool, True to add ``rm``
:param ci: bool, True to add ``ci``
:param smi: bool, True to add ``smi``
:param ... | [
"def",
"_processDatatypes",
"(",
"self",
",",
"rm",
",",
"ci",
",",
"smi",
",",
"sai",
",",
"si",
")",
":",
"datatypes",
"=",
"list",
"(",
")",
"for",
"datatype",
",",
"value",
"in",
"[",
"(",
"'rm'",
",",
"rm",
")",
",",
"(",
"'ci'",
",",
"ci"... | Helper function that returns a list of datatype strings, depending
on the parameters boolean value.
:param rm: bool, True to add ``rm``
:param ci: bool, True to add ``ci``
:param smi: bool, True to add ``smi``
:param sai: bool, True to add ``sai``
:param si: bool, True t... | [
"Helper",
"function",
"that",
"returns",
"a",
"list",
"of",
"datatype",
"strings",
"depending",
"on",
"the",
"parameters",
"boolean",
"value",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L425-L442 |
38,439 | hollenstein/maspy | maspy/core.py | MsrunContainer.save | def save(self, specfiles=None, rm=False, ci=False, smi=False, sai=False,
si=False, compress=True, path=None):
"""Writes the specified datatypes to ``mrc`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``mrc`` files are present in the
specified pa... | python | def save(self, specfiles=None, rm=False, ci=False, smi=False, sai=False,
si=False, compress=True, path=None):
"""Writes the specified datatypes to ``mrc`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``mrc`` files are present in the
specified pa... | [
"def",
"save",
"(",
"self",
",",
"specfiles",
"=",
"None",
",",
"rm",
"=",
"False",
",",
"ci",
"=",
"False",
",",
"smi",
"=",
"False",
",",
"sai",
"=",
"False",
",",
"si",
"=",
"False",
",",
"compress",
"=",
"True",
",",
"path",
"=",
"None",
")... | Writes the specified datatypes to ``mrc`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``mrc`` files are present in the
specified path new files are generated, otherwise old files are
replaced.
:param specfiles: the name of an ms-run file or a l... | [
"Writes",
"the",
"specified",
"datatypes",
"to",
"mrc",
"files",
"on",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L444-L499 |
38,440 | hollenstein/maspy | maspy/core.py | MsrunContainer._writeRmc | def _writeRmc(self, filelike, specfile):
"""Writes the ``.rmc`` container entry of the specified specfile as an
human readable and pretty formatted xml string.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info``
... | python | def _writeRmc(self, filelike, specfile):
"""Writes the ``.rmc`` container entry of the specified specfile as an
human readable and pretty formatted xml string.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info``
... | [
"def",
"_writeRmc",
"(",
"self",
",",
"filelike",
",",
"specfile",
")",
":",
"xmlString",
"=",
"ETREE",
".",
"tostring",
"(",
"self",
".",
"rmc",
"[",
"specfile",
"]",
",",
"pretty_print",
"=",
"True",
")",
"filelike",
".",
"write",
"(",
"xmlString",
"... | Writes the ``.rmc`` container entry of the specified specfile as an
human readable and pretty formatted xml string.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info`` | [
"Writes",
"the",
".",
"rmc",
"container",
"entry",
"of",
"the",
"specified",
"specfile",
"as",
"an",
"human",
"readable",
"and",
"pretty",
"formatted",
"xml",
"string",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L545-L553 |
38,441 | hollenstein/maspy | maspy/core.py | MsrunContainer.load | def load(self, specfiles=None, rm=False, ci=False, smi=False, sai=False,
si=False):
"""Import the specified datatypes from ``mrc`` files on the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfile... | python | def load(self, specfiles=None, rm=False, ci=False, smi=False, sai=False,
si=False):
"""Import the specified datatypes from ``mrc`` files on the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfile... | [
"def",
"load",
"(",
"self",
",",
"specfiles",
"=",
"None",
",",
"rm",
"=",
"False",
",",
"ci",
"=",
"False",
",",
"smi",
"=",
"False",
",",
"sai",
"=",
"False",
",",
"si",
"=",
"False",
")",
":",
"if",
"specfiles",
"is",
"None",
":",
"specfiles",... | Import the specified datatypes from ``mrc`` files on the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
:param rm: bool, True to import ``mrc_rm`` (run metadata)
:param ci... | [
"Import",
"the",
"specified",
"datatypes",
"from",
"mrc",
"files",
"on",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L555-L635 |
38,442 | hollenstein/maspy | maspy/core.py | Ci.jsonHook | def jsonHook(encoded):
"""Custom JSON decoder that allows construction of a new ``Ci`` instance
from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Ci`,
:class:`MzmlProduct`, :class:`Mzm... | python | def jsonHook(encoded):
"""Custom JSON decoder that allows construction of a new ``Ci`` instance
from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Ci`,
:class:`MzmlProduct`, :class:`Mzm... | [
"def",
"jsonHook",
"(",
"encoded",
")",
":",
"if",
"'__Ci__'",
"in",
"encoded",
":",
"return",
"Ci",
".",
"_fromJSON",
"(",
"encoded",
"[",
"'__Ci__'",
"]",
")",
"elif",
"'__MzmlProduct__'",
"in",
"encoded",
":",
"return",
"MzmlProduct",
".",
"_fromJSON",
... | Custom JSON decoder that allows construction of a new ``Ci`` instance
from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Ci`,
:class:`MzmlProduct`, :class:`MzmlPrecursor` | [
"Custom",
"JSON",
"decoder",
"that",
"allows",
"construction",
"of",
"a",
"new",
"Ci",
"instance",
"from",
"a",
"decoded",
"JSON",
"object",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L741-L757 |
38,443 | hollenstein/maspy | maspy/core.py | Smi.jsonHook | def jsonHook(encoded):
"""Custom JSON decoder that allows construction of a new ``Smi``
instance from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Smi`,
:class:`MzmlScan`, :class:`Mzml... | python | def jsonHook(encoded):
"""Custom JSON decoder that allows construction of a new ``Smi``
instance from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Smi`,
:class:`MzmlScan`, :class:`Mzml... | [
"def",
"jsonHook",
"(",
"encoded",
")",
":",
"if",
"'__Smi__'",
"in",
"encoded",
":",
"return",
"Smi",
".",
"_fromJSON",
"(",
"encoded",
"[",
"'__Smi__'",
"]",
")",
"elif",
"'__MzmlScan__'",
"in",
"encoded",
":",
"return",
"MzmlScan",
".",
"_fromJSON",
"("... | Custom JSON decoder that allows construction of a new ``Smi``
instance from a decoded JSON object.
:param encoded: a JSON decoded object literal (a dict)
:returns: "encoded" or one of the these objects: :class:`Smi`,
:class:`MzmlScan`, :class:`MzmlProduct`, :class:`MzmlPrecursor` | [
"Custom",
"JSON",
"decoder",
"that",
"allows",
"construction",
"of",
"a",
"new",
"Smi",
"instance",
"from",
"a",
"decoded",
"JSON",
"object",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L935-L953 |
38,444 | hollenstein/maspy | maspy/core.py | SiiContainer.removeSpecfile | def removeSpecfile(self, specfiles):
"""Completely removes the specified specfiles from the ``SiiContainer``.
:param specfiles: the name of an ms-run file or a list of names.
"""
for specfile in aux.toList(specfiles):
del self.container[specfile]
del self.info[sp... | python | def removeSpecfile(self, specfiles):
"""Completely removes the specified specfiles from the ``SiiContainer``.
:param specfiles: the name of an ms-run file or a list of names.
"""
for specfile in aux.toList(specfiles):
del self.container[specfile]
del self.info[sp... | [
"def",
"removeSpecfile",
"(",
"self",
",",
"specfiles",
")",
":",
"for",
"specfile",
"in",
"aux",
".",
"toList",
"(",
"specfiles",
")",
":",
"del",
"self",
".",
"container",
"[",
"specfile",
"]",
"del",
"self",
".",
"info",
"[",
"specfile",
"]"
] | Completely removes the specified specfiles from the ``SiiContainer``.
:param specfiles: the name of an ms-run file or a list of names. | [
"Completely",
"removes",
"the",
"specified",
"specfiles",
"from",
"the",
"SiiContainer",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1487-L1494 |
38,445 | hollenstein/maspy | maspy/core.py | SiiContainer.save | def save(self, specfiles=None, compress=True, path=None):
"""Writes the specified specfiles to ``siic`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``siic`` files are present in the
specified path new files are generated, otherwise old files are
... | python | def save(self, specfiles=None, compress=True, path=None):
"""Writes the specified specfiles to ``siic`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``siic`` files are present in the
specified path new files are generated, otherwise old files are
... | [
"def",
"save",
"(",
"self",
",",
"specfiles",
"=",
"None",
",",
"compress",
"=",
"True",
",",
"path",
"=",
"None",
")",
":",
"if",
"specfiles",
"is",
"None",
":",
"specfiles",
"=",
"[",
"_",
"for",
"_",
"in",
"viewkeys",
"(",
"self",
".",
"info",
... | Writes the specified specfiles to ``siic`` files on the hard disk.
.. note::
If ``.save()`` is called and no ``siic`` files are present in the
specified path new files are generated, otherwise old files are
replaced.
:param specfiles: the name of an ms-run file or a... | [
"Writes",
"the",
"specified",
"specfiles",
"to",
"siic",
"files",
"on",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1496-L1530 |
38,446 | hollenstein/maspy | maspy/core.py | SiiContainer.calcMz | def calcMz(self, specfiles=None, guessCharge=True, obsMzKey='obsMz'):
"""Calculate the exact mass for ``Sii`` elements from the
``Sii.peptide`` sequence.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:param guessCharge: ... | python | def calcMz(self, specfiles=None, guessCharge=True, obsMzKey='obsMz'):
"""Calculate the exact mass for ``Sii`` elements from the
``Sii.peptide`` sequence.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:param guessCharge: ... | [
"def",
"calcMz",
"(",
"self",
",",
"specfiles",
"=",
"None",
",",
"guessCharge",
"=",
"True",
",",
"obsMzKey",
"=",
"'obsMz'",
")",
":",
"#TODO: important to test function, since changes were made",
"_calcMass",
"=",
"maspy",
".",
"peptidemethods",
".",
"calcPeptide... | Calculate the exact mass for ``Sii`` elements from the
``Sii.peptide`` sequence.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:param guessCharge: bool, True if the charge should be guessed if the
attribute ``charge`... | [
"Calculate",
"the",
"exact",
"mass",
"for",
"Sii",
"elements",
"from",
"the",
"Sii",
".",
"peptide",
"sequence",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1631-L1681 |
38,447 | hollenstein/maspy | maspy/core.py | FiContainer._writeContainer | def _writeContainer(self, filelike, specfile, compress):
"""Writes the ``self.container`` entry of the specified specfile to the
``fic`` format.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info``
:param co... | python | def _writeContainer(self, filelike, specfile, compress):
"""Writes the ``self.container`` entry of the specified specfile to the
``fic`` format.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info``
:param co... | [
"def",
"_writeContainer",
"(",
"self",
",",
"filelike",
",",
"specfile",
",",
"compress",
")",
":",
"aux",
".",
"writeJsonZipfile",
"(",
"filelike",
",",
"self",
".",
"container",
"[",
"specfile",
"]",
",",
"compress",
"=",
"compress",
")"
] | Writes the ``self.container`` entry of the specified specfile to the
``fic`` format.
:param filelike: path to a file (str) or a file-like object
:param specfile: name of an ms-run file present in ``self.info``
:param compress: bool, True to use zip file compression
.. note::
... | [
"Writes",
"the",
"self",
".",
"container",
"entry",
"of",
"the",
"specified",
"specfile",
"to",
"the",
"fic",
"format",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1951-L1966 |
38,448 | hollenstein/maspy | maspy/core.py | FiContainer.load | def load(self, specfiles=None):
"""Imports the specified ``fic`` files from the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
"""
if specfiles is None:
... | python | def load(self, specfiles=None):
"""Imports the specified ``fic`` files from the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
"""
if specfiles is None:
... | [
"def",
"load",
"(",
"self",
",",
"specfiles",
"=",
"None",
")",
":",
"if",
"specfiles",
"is",
"None",
":",
"specfiles",
"=",
"[",
"_",
"for",
"_",
"in",
"viewkeys",
"(",
"self",
".",
"info",
")",
"]",
"else",
":",
"specfiles",
"=",
"aux",
".",
"t... | Imports the specified ``fic`` files from the hard disk.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str] | [
"Imports",
"the",
"specified",
"fic",
"files",
"from",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/core.py#L1974-L2008 |
38,449 | ProjetPP/PPP-datamodel-Python | ppp_datamodel/utils/serializableattributesholder.py | SerializableAttributesHolder.as_dict | def as_dict(self):
"""Returns a JSON-serializeable object representing this tree."""
def conv(v):
if isinstance(v, SerializableAttributesHolder):
return v.as_dict()
elif isinstance(v, list):
return [conv(x) for x in v]
elif isinstance(v... | python | def as_dict(self):
"""Returns a JSON-serializeable object representing this tree."""
def conv(v):
if isinstance(v, SerializableAttributesHolder):
return v.as_dict()
elif isinstance(v, list):
return [conv(x) for x in v]
elif isinstance(v... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"def",
"conv",
"(",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"SerializableAttributesHolder",
")",
":",
"return",
"v",
".",
"as_dict",
"(",
")",
"elif",
"isinstance",
"(",
"v",
",",
"list",
")",
":",
... | Returns a JSON-serializeable object representing this tree. | [
"Returns",
"a",
"JSON",
"-",
"serializeable",
"object",
"representing",
"this",
"tree",
"."
] | 0c7958fb4df75468fd3137240a5065925c239776 | https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/utils/serializableattributesholder.py#L8-L19 |
38,450 | ProjetPP/PPP-datamodel-Python | ppp_datamodel/utils/serializableattributesholder.py | SerializableAttributesHolder.from_json | def from_json(cls, data):
"""Decode a JSON string and inflate a node instance."""
# Decode JSON string
assert isinstance(data, str)
data = json.loads(data)
assert isinstance(data, dict)
return cls.from_dict(data) | python | def from_json(cls, data):
"""Decode a JSON string and inflate a node instance."""
# Decode JSON string
assert isinstance(data, str)
data = json.loads(data)
assert isinstance(data, dict)
return cls.from_dict(data) | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"# Decode JSON string",
"assert",
"isinstance",
"(",
"data",
",",
"str",
")",
"data",
"=",
"json",
".",
"loads",
"(",
"data",
")",
"assert",
"isinstance",
"(",
"data",
",",
"dict",
")",
"return",
"... | Decode a JSON string and inflate a node instance. | [
"Decode",
"a",
"JSON",
"string",
"and",
"inflate",
"a",
"node",
"instance",
"."
] | 0c7958fb4df75468fd3137240a5065925c239776 | https://github.com/ProjetPP/PPP-datamodel-Python/blob/0c7958fb4df75468fd3137240a5065925c239776/ppp_datamodel/utils/serializableattributesholder.py#L30-L36 |
38,451 | bitesofcode/projex | projex/funcutil.py | extract_keywords | def extract_keywords(func):
"""
Parses the keywords from the given function.
:param func | <function>
"""
if hasattr(func, 'im_func'):
func = func.im_func
try:
return func.func_code.co_varnames[-len(func.func_defaults):]
except (TypeError, ValueError, IndexError):
... | python | def extract_keywords(func):
"""
Parses the keywords from the given function.
:param func | <function>
"""
if hasattr(func, 'im_func'):
func = func.im_func
try:
return func.func_code.co_varnames[-len(func.func_defaults):]
except (TypeError, ValueError, IndexError):
... | [
"def",
"extract_keywords",
"(",
"func",
")",
":",
"if",
"hasattr",
"(",
"func",
",",
"'im_func'",
")",
":",
"func",
"=",
"func",
".",
"im_func",
"try",
":",
"return",
"func",
".",
"func_code",
".",
"co_varnames",
"[",
"-",
"len",
"(",
"func",
".",
"f... | Parses the keywords from the given function.
:param func | <function> | [
"Parses",
"the",
"keywords",
"from",
"the",
"given",
"function",
"."
] | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/funcutil.py#L5-L17 |
38,452 | diamondman/proteusisc | proteusisc/drivers/digilentdriver.py | DigilentAdeptController.jtag_enable | def jtag_enable(self):
"""
Enables JTAG output on the controller. JTAG operations executed
before this function is called will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
... | python | def jtag_enable(self):
"""
Enables JTAG output on the controller. JTAG operations executed
before this function is called will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
... | [
"def",
"jtag_enable",
"(",
"self",
")",
":",
"status",
",",
"_",
"=",
"self",
".",
"bulkCommand",
"(",
"_BMSG_ENABLE_JTAG",
")",
"if",
"status",
"==",
"0",
":",
"self",
".",
"_jtagon",
"=",
"True",
"elif",
"status",
"==",
"3",
":",
"self",
".",
"_jta... | Enables JTAG output on the controller. JTAG operations executed
before this function is called will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
>>> c.jtag_enable()
>>>... | [
"Enables",
"JTAG",
"output",
"on",
"the",
"controller",
".",
"JTAG",
"operations",
"executed",
"before",
"this",
"function",
"is",
"called",
"will",
"return",
"useless",
"data",
"or",
"fail",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/drivers/digilentdriver.py#L242-L261 |
38,453 | diamondman/proteusisc | proteusisc/drivers/digilentdriver.py | DigilentAdeptController.jtag_disable | def jtag_disable(self):
"""
Disables JTAG output on the controller. JTAG operations executed
immediately after this function will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
... | python | def jtag_disable(self):
"""
Disables JTAG output on the controller. JTAG operations executed
immediately after this function will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
... | [
"def",
"jtag_disable",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_jtagon",
":",
"return",
"status",
",",
"_",
"=",
"self",
".",
"bulkCommand",
"(",
"_BMSG_DISABLE_JTAG",
")",
"if",
"status",
"==",
"0",
":",
"self",
".",
"_jtagon",
"=",
"False",... | Disables JTAG output on the controller. JTAG operations executed
immediately after this function will return useless data or fail.
Usage:
>>> from proteusisc import getAttachedControllers, bitarray
>>> c = getAttachedControllers()[0]
>>> c.jtag_enable()
>... | [
"Disables",
"JTAG",
"output",
"on",
"the",
"controller",
".",
"JTAG",
"operations",
"executed",
"immediately",
"after",
"this",
"function",
"will",
"return",
"useless",
"data",
"or",
"fail",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/drivers/digilentdriver.py#L263-L283 |
38,454 | diamondman/proteusisc | proteusisc/drivers/digilentdriver.py | DigilentAdeptController.write_tms_tdi_bits | def write_tms_tdi_bits(self, tmsdata, tdidata, return_tdo=False):
"""
Command controller to write arbitrary TDI and TMS data to the
physical scan chain. Optionally return TDO bits sent back
from the scan chain.
Args:
tmsdata - bits to send over TMS line of scan chain... | python | def write_tms_tdi_bits(self, tmsdata, tdidata, return_tdo=False):
"""
Command controller to write arbitrary TDI and TMS data to the
physical scan chain. Optionally return TDO bits sent back
from the scan chain.
Args:
tmsdata - bits to send over TMS line of scan chain... | [
"def",
"write_tms_tdi_bits",
"(",
"self",
",",
"tmsdata",
",",
"tdidata",
",",
"return_tdo",
"=",
"False",
")",
":",
"self",
".",
"_check_jtag",
"(",
")",
"if",
"len",
"(",
"tmsdata",
")",
"!=",
"len",
"(",
"tdidata",
")",
":",
"raise",
"Exception",
"(... | Command controller to write arbitrary TDI and TMS data to the
physical scan chain. Optionally return TDO bits sent back
from the scan chain.
Args:
tmsdata - bits to send over TMS line of scan chain (bitarray)
must be the same length ad tdidata
tdida... | [
"Command",
"controller",
"to",
"write",
"arbitrary",
"TDI",
"and",
"TMS",
"data",
"to",
"the",
"physical",
"scan",
"chain",
".",
"Optionally",
"return",
"TDO",
"bits",
"sent",
"back",
"from",
"the",
"scan",
"chain",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/drivers/digilentdriver.py#L369-L423 |
38,455 | hollenstein/maspy | maspy/proteindb.py | _readFastaFile | def _readFastaFile(filepath):
"""Read a FASTA file and yields tuples of 'header' and 'sequence' entries.
:param filepath: file path of the FASTA file
:yields: FASTA entries in the format ('header', 'sequence').
The 'header' string does not contain the '>' and trailing white spaces.
The 'se... | python | def _readFastaFile(filepath):
"""Read a FASTA file and yields tuples of 'header' and 'sequence' entries.
:param filepath: file path of the FASTA file
:yields: FASTA entries in the format ('header', 'sequence').
The 'header' string does not contain the '>' and trailing white spaces.
The 'se... | [
"def",
"_readFastaFile",
"(",
"filepath",
")",
":",
"processSequences",
"=",
"lambda",
"i",
":",
"''",
".",
"join",
"(",
"[",
"s",
".",
"rstrip",
"(",
")",
"for",
"s",
"in",
"i",
"]",
")",
".",
"rstrip",
"(",
"'*'",
")",
"processHeaderLine",
"=",
"... | Read a FASTA file and yields tuples of 'header' and 'sequence' entries.
:param filepath: file path of the FASTA file
:yields: FASTA entries in the format ('header', 'sequence').
The 'header' string does not contain the '>' and trailing white spaces.
The 'sequence' string does not contain trail... | [
"Read",
"a",
"FASTA",
"file",
"and",
"yields",
"tuples",
"of",
"header",
"and",
"sequence",
"entries",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L506-L543 |
38,456 | hollenstein/maspy | maspy/proteindb.py | fastaParseSgd | def fastaParseSgd(header):
"""Custom parser for fasta headers in the SGD format, see
www.yeastgenome.org.
:param header: str, protein entry header from a fasta file
:returns: dict, parsed header
"""
rePattern = '([\S]+)\s([\S]+).+(\".+\")'
ID, name, description = re.match(rePattern, header... | python | def fastaParseSgd(header):
"""Custom parser for fasta headers in the SGD format, see
www.yeastgenome.org.
:param header: str, protein entry header from a fasta file
:returns: dict, parsed header
"""
rePattern = '([\S]+)\s([\S]+).+(\".+\")'
ID, name, description = re.match(rePattern, header... | [
"def",
"fastaParseSgd",
"(",
"header",
")",
":",
"rePattern",
"=",
"'([\\S]+)\\s([\\S]+).+(\\\".+\\\")'",
"ID",
",",
"name",
",",
"description",
"=",
"re",
".",
"match",
"(",
"rePattern",
",",
"header",
")",
".",
"groups",
"(",
")",
"info",
"=",
"{",
"'id'... | Custom parser for fasta headers in the SGD format, see
www.yeastgenome.org.
:param header: str, protein entry header from a fasta file
:returns: dict, parsed header | [
"Custom",
"parser",
"for",
"fasta",
"headers",
"in",
"the",
"SGD",
"format",
"see",
"www",
".",
"yeastgenome",
".",
"org",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L578-L589 |
38,457 | hollenstein/maspy | maspy/proteindb.py | ProteinDatabase.save | def save(self, path, compress=True):
"""Writes the ``.proteins`` and ``.peptides`` entries to the hard disk
as a ``proteindb`` file.
.. note::
If ``.save()`` is called and no ``proteindb`` file is present in the
specified path a new files is generated, otherwise the old ... | python | def save(self, path, compress=True):
"""Writes the ``.proteins`` and ``.peptides`` entries to the hard disk
as a ``proteindb`` file.
.. note::
If ``.save()`` is called and no ``proteindb`` file is present in the
specified path a new files is generated, otherwise the old ... | [
"def",
"save",
"(",
"self",
",",
"path",
",",
"compress",
"=",
"True",
")",
":",
"with",
"aux",
".",
"PartiallySafeReplace",
"(",
")",
"as",
"msr",
":",
"filename",
"=",
"self",
".",
"info",
"[",
"'name'",
"]",
"+",
"'.proteindb'",
"filepath",
"=",
"... | Writes the ``.proteins`` and ``.peptides`` entries to the hard disk
as a ``proteindb`` file.
.. note::
If ``.save()`` is called and no ``proteindb`` file is present in the
specified path a new files is generated, otherwise the old file is
replaced.
:param pa... | [
"Writes",
"the",
".",
"proteins",
"and",
".",
"peptides",
"entries",
"to",
"the",
"hard",
"disk",
"as",
"a",
"proteindb",
"file",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L255-L272 |
38,458 | hollenstein/maspy | maspy/proteindb.py | ProteinDatabase.load | def load(cls, path, name):
"""Imports the specified ``proteindb`` file from the hard disk.
:param path: filedirectory of the ``proteindb`` file
:param name: filename without the file extension ".proteindb"
.. note:: this generates rather large files, which actually take longer
... | python | def load(cls, path, name):
"""Imports the specified ``proteindb`` file from the hard disk.
:param path: filedirectory of the ``proteindb`` file
:param name: filename without the file extension ".proteindb"
.. note:: this generates rather large files, which actually take longer
... | [
"def",
"load",
"(",
"cls",
",",
"path",
",",
"name",
")",
":",
"filepath",
"=",
"aux",
".",
"joinpath",
"(",
"path",
",",
"name",
"+",
"'.proteindb'",
")",
"with",
"zipfile",
".",
"ZipFile",
"(",
"filepath",
",",
"'r'",
",",
"allowZip64",
"=",
"True"... | Imports the specified ``proteindb`` file from the hard disk.
:param path: filedirectory of the ``proteindb`` file
:param name: filename without the file extension ".proteindb"
.. note:: this generates rather large files, which actually take longer
to import than to newly generate. ... | [
"Imports",
"the",
"specified",
"proteindb",
"file",
"from",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/proteindb.py#L293-L324 |
38,459 | Prev/shaman | shamanld/trainer.py | fetch_keywords | def fetch_keywords(codedata) :
""" Fetch keywords by shaman.KeywordFetcher
Get average probabilities of keyword and language
"""
# Read row in codedata and count keywords in codes with langauge
tmp = {}
language_counts = {}
for index, (language, code) in enumerate(codedata) :
if language not in shaman.SUPPO... | python | def fetch_keywords(codedata) :
""" Fetch keywords by shaman.KeywordFetcher
Get average probabilities of keyword and language
"""
# Read row in codedata and count keywords in codes with langauge
tmp = {}
language_counts = {}
for index, (language, code) in enumerate(codedata) :
if language not in shaman.SUPPO... | [
"def",
"fetch_keywords",
"(",
"codedata",
")",
":",
"# Read row in codedata and count keywords in codes with langauge",
"tmp",
"=",
"{",
"}",
"language_counts",
"=",
"{",
"}",
"for",
"index",
",",
"(",
"language",
",",
"code",
")",
"in",
"enumerate",
"(",
"codedat... | Fetch keywords by shaman.KeywordFetcher
Get average probabilities of keyword and language | [
"Fetch",
"keywords",
"by",
"shaman",
".",
"KeywordFetcher",
"Get",
"average",
"probabilities",
"of",
"keyword",
"and",
"language"
] | 82891c17c6302f7f9881a215789856d460a85f9c | https://github.com/Prev/shaman/blob/82891c17c6302f7f9881a215789856d460a85f9c/shamanld/trainer.py#L60-L97 |
38,460 | Prev/shaman | shamanld/trainer.py | match_patterns | def match_patterns(codedata) :
""" Match patterns by shaman.PatternMatcher
Get average ratio of pattern and language
"""
ret = {}
for index1, pattern in enumerate(shaman.PatternMatcher.PATTERNS) :
print('Matching pattern %d "%s"' % (index1+1, pattern))
matcher = shaman.PatternMatcher(pattern)
tmp = {}
... | python | def match_patterns(codedata) :
""" Match patterns by shaman.PatternMatcher
Get average ratio of pattern and language
"""
ret = {}
for index1, pattern in enumerate(shaman.PatternMatcher.PATTERNS) :
print('Matching pattern %d "%s"' % (index1+1, pattern))
matcher = shaman.PatternMatcher(pattern)
tmp = {}
... | [
"def",
"match_patterns",
"(",
"codedata",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"index1",
",",
"pattern",
"in",
"enumerate",
"(",
"shaman",
".",
"PatternMatcher",
".",
"PATTERNS",
")",
":",
"print",
"(",
"'Matching pattern %d \"%s\"'",
"%",
"(",
"index1",
... | Match patterns by shaman.PatternMatcher
Get average ratio of pattern and language | [
"Match",
"patterns",
"by",
"shaman",
".",
"PatternMatcher",
"Get",
"average",
"ratio",
"of",
"pattern",
"and",
"language"
] | 82891c17c6302f7f9881a215789856d460a85f9c | https://github.com/Prev/shaman/blob/82891c17c6302f7f9881a215789856d460a85f9c/shamanld/trainer.py#L101-L135 |
38,461 | codeforamerica/epa_python | epa/radinfo/radinfo.py | RADInfo.facility | def facility(self, column=None, value=None, **kwargs):
"""
Check information related to Radiation facilities.
>>> RADInfo().facility('state_code', 'CA')
"""
return self._resolve_call('RAD_FACILITY', column, value, **kwargs) | python | def facility(self, column=None, value=None, **kwargs):
"""
Check information related to Radiation facilities.
>>> RADInfo().facility('state_code', 'CA')
"""
return self._resolve_call('RAD_FACILITY', column, value, **kwargs) | [
"def",
"facility",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'RAD_FACILITY'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Check information related to Radiation facilities.
>>> RADInfo().facility('state_code', 'CA') | [
"Check",
"information",
"related",
"to",
"Radiation",
"facilities",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/radinfo/radinfo.py#L23-L29 |
38,462 | codeforamerica/epa_python | epa/radinfo/radinfo.py | RADInfo.geo | def geo(self, column=None, value=None, **kwargs):
"""
Locate a facility through geographic location.
>>> RADInfo().geo('geometric_type_code', '001')
"""
return self._resolve_call('RAD_GEO_LOCATION', column, value, **kwargs) | python | def geo(self, column=None, value=None, **kwargs):
"""
Locate a facility through geographic location.
>>> RADInfo().geo('geometric_type_code', '001')
"""
return self._resolve_call('RAD_GEO_LOCATION', column, value, **kwargs) | [
"def",
"geo",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'RAD_GEO_LOCATION'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Locate a facility through geographic location.
>>> RADInfo().geo('geometric_type_code', '001') | [
"Locate",
"a",
"facility",
"through",
"geographic",
"location",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/radinfo/radinfo.py#L41-L47 |
38,463 | codeforamerica/epa_python | epa/radinfo/radinfo.py | RADInfo.regulation | def regulation(self, column=None, value=None, **kwargs):
"""
Provides relevant information about applicable regulations.
>>> RADInfo().regulation('title_id', 40)
"""
return self._resolve_call('RAD_REGULATION', column, value, **kwargs) | python | def regulation(self, column=None, value=None, **kwargs):
"""
Provides relevant information about applicable regulations.
>>> RADInfo().regulation('title_id', 40)
"""
return self._resolve_call('RAD_REGULATION', column, value, **kwargs) | [
"def",
"regulation",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'RAD_REGULATION'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Provides relevant information about applicable regulations.
>>> RADInfo().regulation('title_id', 40) | [
"Provides",
"relevant",
"information",
"about",
"applicable",
"regulations",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/radinfo/radinfo.py#L49-L55 |
38,464 | codeforamerica/epa_python | epa/radinfo/radinfo.py | RADInfo.regulatory_program | def regulatory_program(self, column=None, value=None, **kwargs):
"""
Identifies the regulatory authority governing a facility, and, by
virtue of that identification, also identifies the regulatory program
of interest and the type of facility.
>>> RADInfo().regulatory_program('s... | python | def regulatory_program(self, column=None, value=None, **kwargs):
"""
Identifies the regulatory authority governing a facility, and, by
virtue of that identification, also identifies the regulatory program
of interest and the type of facility.
>>> RADInfo().regulatory_program('s... | [
"def",
"regulatory_program",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'RAD_REGULATORY_PROG'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs"... | Identifies the regulatory authority governing a facility, and, by
virtue of that identification, also identifies the regulatory program
of interest and the type of facility.
>>> RADInfo().regulatory_program('sec_cit_ref_flag', 'N') | [
"Identifies",
"the",
"regulatory",
"authority",
"governing",
"a",
"facility",
"and",
"by",
"virtue",
"of",
"that",
"identification",
"also",
"identifies",
"the",
"regulatory",
"program",
"of",
"interest",
"and",
"the",
"type",
"of",
"facility",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/radinfo/radinfo.py#L57-L66 |
38,465 | Carreau/telemetry | telemetry/__init__.py | collect_basic_info | def collect_basic_info():
"""
collect basic info about the system, os, python version...
"""
s = sys.version_info
_collect(json.dumps({'sys.version_info':tuple(s)}))
_collect(sys.version)
return sys.version | python | def collect_basic_info():
"""
collect basic info about the system, os, python version...
"""
s = sys.version_info
_collect(json.dumps({'sys.version_info':tuple(s)}))
_collect(sys.version)
return sys.version | [
"def",
"collect_basic_info",
"(",
")",
":",
"s",
"=",
"sys",
".",
"version_info",
"_collect",
"(",
"json",
".",
"dumps",
"(",
"{",
"'sys.version_info'",
":",
"tuple",
"(",
"s",
")",
"}",
")",
")",
"_collect",
"(",
"sys",
".",
"version",
")",
"return",
... | collect basic info about the system, os, python version... | [
"collect",
"basic",
"info",
"about",
"the",
"system",
"os",
"python",
"version",
"..."
] | 6d456e982e3d7fd4eb6a8f43cd94925bb69ab855 | https://github.com/Carreau/telemetry/blob/6d456e982e3d7fd4eb6a8f43cd94925bb69ab855/telemetry/__init__.py#L47-L55 |
38,466 | Carreau/telemetry | telemetry/__init__.py | call | def call(function):
"""
decorator that collect function call count.
"""
message = 'call:%s.%s' % (function.__module__,function.__name__)
@functools.wraps(function)
def wrapper(*args, **kwargs):
_collect(message)
return function(*args, **kwargs)
return wrapper | python | def call(function):
"""
decorator that collect function call count.
"""
message = 'call:%s.%s' % (function.__module__,function.__name__)
@functools.wraps(function)
def wrapper(*args, **kwargs):
_collect(message)
return function(*args, **kwargs)
return wrapper | [
"def",
"call",
"(",
"function",
")",
":",
"message",
"=",
"'call:%s.%s'",
"%",
"(",
"function",
".",
"__module__",
",",
"function",
".",
"__name__",
")",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*"... | decorator that collect function call count. | [
"decorator",
"that",
"collect",
"function",
"call",
"count",
"."
] | 6d456e982e3d7fd4eb6a8f43cd94925bb69ab855 | https://github.com/Carreau/telemetry/blob/6d456e982e3d7fd4eb6a8f43cd94925bb69ab855/telemetry/__init__.py#L76-L86 |
38,467 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | _parse_ip_addr_show | def _parse_ip_addr_show(raw_result):
"""
Parse the 'ip addr list dev' command raw output.
:param str raw_result: os raw result string.
:rtype: dict
:return: The parsed result of the show interface command in a \
dictionary of the form:
::
{
'os_index' : '0',
... | python | def _parse_ip_addr_show(raw_result):
"""
Parse the 'ip addr list dev' command raw output.
:param str raw_result: os raw result string.
:rtype: dict
:return: The parsed result of the show interface command in a \
dictionary of the form:
::
{
'os_index' : '0',
... | [
"def",
"_parse_ip_addr_show",
"(",
"raw_result",
")",
":",
"# does link exist?",
"show_re",
"=",
"(",
"r'\"(?P<dev>\\S+)\"\\s+does not exist'",
")",
"re_result",
"=",
"search",
"(",
"show_re",
",",
"raw_result",
")",
"result",
"=",
"None",
"if",
"not",
"(",
"re_re... | Parse the 'ip addr list dev' command raw output.
:param str raw_result: os raw result string.
:rtype: dict
:return: The parsed result of the show interface command in a \
dictionary of the form:
::
{
'os_index' : '0',
'dev' : 'eth0',
'falgs_str': '... | [
"Parse",
"the",
"ip",
"addr",
"list",
"dev",
"command",
"raw",
"output",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L31-L96 |
38,468 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | interface | def interface(enode, portlbl, addr=None, up=None, shell=None):
"""
Configure a interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base... | python | def interface(enode, portlbl, addr=None, up=None, shell=None):
"""
Configure a interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base... | [
"def",
"interface",
"(",
"enode",
",",
"portlbl",
",",
"addr",
"=",
"None",
",",
"up",
"=",
"None",
",",
"shell",
"=",
"None",
")",
":",
"assert",
"portlbl",
"port",
"=",
"enode",
".",
"ports",
"[",
"portlbl",
"]",
"if",
"addr",
"is",
"not",
"None"... | Configure a interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str portlbl: Port label to configure. Port label will ... | [
"Configure",
"a",
"interface",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L149-L183 |
38,469 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | remove_ip | def remove_ip(enode, portlbl, addr, shell=None):
"""
Remove an IP address from an interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.b... | python | def remove_ip(enode, portlbl, addr, shell=None):
"""
Remove an IP address from an interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.b... | [
"def",
"remove_ip",
"(",
"enode",
",",
"portlbl",
",",
"addr",
",",
"shell",
"=",
"None",
")",
":",
"assert",
"portlbl",
"assert",
"ip_interface",
"(",
"addr",
")",
"port",
"=",
"enode",
".",
"ports",
"[",
"portlbl",
"]",
"cmd",
"=",
"'ip addr del {addr}... | Remove an IP address from an interface.
All parameters left as ``None`` are ignored and thus no configuration
action is taken for that parameter (left "as-is").
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str portlbl: Port label to configure.... | [
"Remove",
"an",
"IP",
"address",
"from",
"an",
"interface",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L233-L258 |
38,470 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | add_route | def add_route(enode, route, via, shell=None):
"""
Add a new static route.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str route: Route to add, an IP in the form ``'192.168.20.20/24'``
or ``'2001::0/24'`` or ``'default'``.
:param str v... | python | def add_route(enode, route, via, shell=None):
"""
Add a new static route.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str route: Route to add, an IP in the form ``'192.168.20.20/24'``
or ``'2001::0/24'`` or ``'default'``.
:param str v... | [
"def",
"add_route",
"(",
"enode",
",",
"route",
",",
"via",
",",
"shell",
"=",
"None",
")",
":",
"via",
"=",
"ip_address",
"(",
"via",
")",
"version",
"=",
"'-4'",
"if",
"(",
"via",
".",
"version",
"==",
"6",
")",
"or",
"(",
"route",
"!=",
"'defa... | Add a new static route.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str route: Route to add, an IP in the form ``'192.168.20.20/24'``
or ``'2001::0/24'`` or ``'default'``.
:param str via: Via for the route as an IP in the form
``'192.168... | [
"Add",
"a",
"new",
"static",
"route",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L261-L287 |
38,471 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | add_link_type_vlan | def add_link_type_vlan(enode, portlbl, name, vlan_id, shell=None):
"""
Add a new virtual link with the type set to VLAN.
Creates a new vlan device {name} on device {port}.
Will raise an exception if value is already assigned.
:param enode: Engine node to communicate with.
:type enode: topology... | python | def add_link_type_vlan(enode, portlbl, name, vlan_id, shell=None):
"""
Add a new virtual link with the type set to VLAN.
Creates a new vlan device {name} on device {port}.
Will raise an exception if value is already assigned.
:param enode: Engine node to communicate with.
:type enode: topology... | [
"def",
"add_link_type_vlan",
"(",
"enode",
",",
"portlbl",
",",
"name",
",",
"vlan_id",
",",
"shell",
"=",
"None",
")",
":",
"assert",
"name",
"if",
"name",
"in",
"enode",
".",
"ports",
":",
"raise",
"ValueError",
"(",
"'Port {name} already exists'",
".",
... | Add a new virtual link with the type set to VLAN.
Creates a new vlan device {name} on device {port}.
Will raise an exception if value is already assigned.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str portlbl: Port label to configure. Port ... | [
"Add",
"a",
"new",
"virtual",
"link",
"with",
"the",
"type",
"set",
"to",
"VLAN",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L290-L320 |
38,472 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | remove_link_type_vlan | def remove_link_type_vlan(enode, name, shell=None):
"""
Delete a virtual link.
Deletes a vlan device with the name {name}.
Will raise an expection if the port is not already present.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str nam... | python | def remove_link_type_vlan(enode, name, shell=None):
"""
Delete a virtual link.
Deletes a vlan device with the name {name}.
Will raise an expection if the port is not already present.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str nam... | [
"def",
"remove_link_type_vlan",
"(",
"enode",
",",
"name",
",",
"shell",
"=",
"None",
")",
":",
"assert",
"name",
"if",
"name",
"not",
"in",
"enode",
".",
"ports",
":",
"raise",
"ValueError",
"(",
"'Port {name} doesn\\'t exists'",
".",
"format",
"(",
"name",... | Delete a virtual link.
Deletes a vlan device with the name {name}.
Will raise an expection if the port is not already present.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str name: specifies the name of the new
virtual device.
:param... | [
"Delete",
"a",
"virtual",
"link",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L323-L346 |
38,473 | HPENetworking/topology_lib_ip | lib/topology_lib_ip/library.py | show_interface | def show_interface(enode, dev, shell=None):
"""
Show the configured parameters and stats of an interface.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str dev: Unix network device name. Ex 1, 2, 3..
:rtype: dict
:return: A combined dict... | python | def show_interface(enode, dev, shell=None):
"""
Show the configured parameters and stats of an interface.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str dev: Unix network device name. Ex 1, 2, 3..
:rtype: dict
:return: A combined dict... | [
"def",
"show_interface",
"(",
"enode",
",",
"dev",
",",
"shell",
"=",
"None",
")",
":",
"assert",
"dev",
"cmd",
"=",
"'ip addr list dev {ldev}'",
".",
"format",
"(",
"ldev",
"=",
"dev",
")",
"response",
"=",
"enode",
"(",
"cmd",
",",
"shell",
"=",
"she... | Show the configured parameters and stats of an interface.
:param enode: Engine node to communicate with.
:type enode: topology.platforms.base.BaseNode
:param str dev: Unix network device name. Ex 1, 2, 3..
:rtype: dict
:return: A combined dictionary as returned by both
:func:`topology_lib_ip.p... | [
"Show",
"the",
"configured",
"parameters",
"and",
"stats",
"of",
"an",
"interface",
"."
] | c69cc3db80d96575d787fdc903a9370d2df1c5ae | https://github.com/HPENetworking/topology_lib_ip/blob/c69cc3db80d96575d787fdc903a9370d2df1c5ae/lib/topology_lib_ip/library.py#L349-L376 |
38,474 | jasedit/pymmd | pymmd/download.py | build_mmd | def build_mmd(target_folder=DEFAULT_LIBRARY_DIR):
"""Build and install the MultiMarkdown shared library."""
mmd_dir = tempfile.mkdtemp()
mmd_repo = pygit2.clone_repository('https://github.com/jasedit/MultiMarkdown-5', mmd_dir,
checkout_branch='fix_windows')
mmd_rep... | python | def build_mmd(target_folder=DEFAULT_LIBRARY_DIR):
"""Build and install the MultiMarkdown shared library."""
mmd_dir = tempfile.mkdtemp()
mmd_repo = pygit2.clone_repository('https://github.com/jasedit/MultiMarkdown-5', mmd_dir,
checkout_branch='fix_windows')
mmd_rep... | [
"def",
"build_mmd",
"(",
"target_folder",
"=",
"DEFAULT_LIBRARY_DIR",
")",
":",
"mmd_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"mmd_repo",
"=",
"pygit2",
".",
"clone_repository",
"(",
"'https://github.com/jasedit/MultiMarkdown-5'",
",",
"mmd_dir",
",",
"check... | Build and install the MultiMarkdown shared library. | [
"Build",
"and",
"install",
"the",
"MultiMarkdown",
"shared",
"library",
"."
] | 37b5a717241b837ca15b8a4d4cc3c06b4456bfbd | https://github.com/jasedit/pymmd/blob/37b5a717241b837ca15b8a4d4cc3c06b4456bfbd/pymmd/download.py#L41-L68 |
38,475 | jessamynsmith/pipreq | pipreq/command.py | Command.generate_requirements_files | def generate_requirements_files(self, base_dir='.'):
""" Generate set of requirements files for config """
print("Creating requirements files\n")
# TODO How to deal with requirements that are not simple, e.g. a github url
shared = self._get_shared_section()
requirements_dir =... | python | def generate_requirements_files(self, base_dir='.'):
""" Generate set of requirements files for config """
print("Creating requirements files\n")
# TODO How to deal with requirements that are not simple, e.g. a github url
shared = self._get_shared_section()
requirements_dir =... | [
"def",
"generate_requirements_files",
"(",
"self",
",",
"base_dir",
"=",
"'.'",
")",
":",
"print",
"(",
"\"Creating requirements files\\n\"",
")",
"# TODO How to deal with requirements that are not simple, e.g. a github url",
"shared",
"=",
"self",
".",
"_get_shared_section",
... | Generate set of requirements files for config | [
"Generate",
"set",
"of",
"requirements",
"files",
"for",
"config"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L76-L100 |
38,476 | jessamynsmith/pipreq | pipreq/command.py | Command._write_default_sections | def _write_default_sections(self):
""" Starting from scratch, so create a default rc file """
self.config.add_section('metadata')
self.config.set('metadata', 'shared', 'common')
self.config.add_section('common')
self.config.add_section('development')
self.config.add_secti... | python | def _write_default_sections(self):
""" Starting from scratch, so create a default rc file """
self.config.add_section('metadata')
self.config.set('metadata', 'shared', 'common')
self.config.add_section('common')
self.config.add_section('development')
self.config.add_secti... | [
"def",
"_write_default_sections",
"(",
"self",
")",
":",
"self",
".",
"config",
".",
"add_section",
"(",
"'metadata'",
")",
"self",
".",
"config",
".",
"set",
"(",
"'metadata'",
",",
"'shared'",
",",
"'common'",
")",
"self",
".",
"config",
".",
"add_sectio... | Starting from scratch, so create a default rc file | [
"Starting",
"from",
"scratch",
"so",
"create",
"a",
"default",
"rc",
"file"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L121-L127 |
38,477 | jessamynsmith/pipreq | pipreq/command.py | Command._parse_requirements | def _parse_requirements(self, input):
""" Parse a list of requirements specifications.
Lines that look like "foobar==1.0" are parsed; all other lines are
silently ignored.
Returns a tuple of tuples, where each inner tuple is:
(package, version) """
r... | python | def _parse_requirements(self, input):
""" Parse a list of requirements specifications.
Lines that look like "foobar==1.0" are parsed; all other lines are
silently ignored.
Returns a tuple of tuples, where each inner tuple is:
(package, version) """
r... | [
"def",
"_parse_requirements",
"(",
"self",
",",
"input",
")",
":",
"results",
"=",
"[",
"]",
"for",
"line",
"in",
"input",
":",
"(",
"package",
",",
"version",
")",
"=",
"self",
".",
"_parse_line",
"(",
"line",
")",
"if",
"package",
":",
"results",
"... | Parse a list of requirements specifications.
Lines that look like "foobar==1.0" are parsed; all other lines are
silently ignored.
Returns a tuple of tuples, where each inner tuple is:
(package, version) | [
"Parse",
"a",
"list",
"of",
"requirements",
"specifications",
".",
"Lines",
"that",
"look",
"like",
"foobar",
"==",
"1",
".",
"0",
"are",
"parsed",
";",
"all",
"other",
"lines",
"are",
"silently",
"ignored",
"."
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L129-L144 |
38,478 | jessamynsmith/pipreq | pipreq/command.py | Command.create_rc_file | def create_rc_file(self, packages):
""" Create a set of requirements files for config """
print("Creating rcfile '%s'\n" % self.rc_filename)
# TODO bug with == in config file
if not self.config.sections():
self._write_default_sections()
sections = {}
secti... | python | def create_rc_file(self, packages):
""" Create a set of requirements files for config """
print("Creating rcfile '%s'\n" % self.rc_filename)
# TODO bug with == in config file
if not self.config.sections():
self._write_default_sections()
sections = {}
secti... | [
"def",
"create_rc_file",
"(",
"self",
",",
"packages",
")",
":",
"print",
"(",
"\"Creating rcfile '%s'\\n\"",
"%",
"self",
".",
"rc_filename",
")",
"# TODO bug with == in config file",
"if",
"not",
"self",
".",
"config",
".",
"sections",
"(",
")",
":",
"self",
... | Create a set of requirements files for config | [
"Create",
"a",
"set",
"of",
"requirements",
"files",
"for",
"config"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L156-L205 |
38,479 | jessamynsmith/pipreq | pipreq/command.py | Command.upgrade_packages | def upgrade_packages(self, packages):
""" Upgrade all specified packages to latest version """
print("Upgrading packages\n")
package_list = []
requirements = self._parse_requirements(packages.readlines())
for (package, version) in requirements:
package_list.append(p... | python | def upgrade_packages(self, packages):
""" Upgrade all specified packages to latest version """
print("Upgrading packages\n")
package_list = []
requirements = self._parse_requirements(packages.readlines())
for (package, version) in requirements:
package_list.append(p... | [
"def",
"upgrade_packages",
"(",
"self",
",",
"packages",
")",
":",
"print",
"(",
"\"Upgrading packages\\n\"",
")",
"package_list",
"=",
"[",
"]",
"requirements",
"=",
"self",
".",
"_parse_requirements",
"(",
"packages",
".",
"readlines",
"(",
")",
")",
"for",
... | Upgrade all specified packages to latest version | [
"Upgrade",
"all",
"specified",
"packages",
"to",
"latest",
"version"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L207-L226 |
38,480 | jessamynsmith/pipreq | pipreq/command.py | Command.determine_extra_packages | def determine_extra_packages(self, packages):
""" Return all packages that are installed, but missing from "packages".
Return value is a tuple of the package names """
args = [
"pip",
"freeze",
]
installed = subprocess.check_output(args, universal_new... | python | def determine_extra_packages(self, packages):
""" Return all packages that are installed, but missing from "packages".
Return value is a tuple of the package names """
args = [
"pip",
"freeze",
]
installed = subprocess.check_output(args, universal_new... | [
"def",
"determine_extra_packages",
"(",
"self",
",",
"packages",
")",
":",
"args",
"=",
"[",
"\"pip\"",
",",
"\"freeze\"",
",",
"]",
"installed",
"=",
"subprocess",
".",
"check_output",
"(",
"args",
",",
"universal_newlines",
"=",
"True",
")",
"installed_list"... | Return all packages that are installed, but missing from "packages".
Return value is a tuple of the package names | [
"Return",
"all",
"packages",
"that",
"are",
"installed",
"but",
"missing",
"from",
"packages",
".",
"Return",
"value",
"is",
"a",
"tuple",
"of",
"the",
"package",
"names"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L228-L248 |
38,481 | jessamynsmith/pipreq | pipreq/command.py | Command.remove_extra_packages | def remove_extra_packages(self, packages, dry_run=False):
""" Remove all packages missing from list """
removal_list = self.determine_extra_packages(packages)
if not removal_list:
print("No packages to be removed")
else:
if dry_run:
print("The fol... | python | def remove_extra_packages(self, packages, dry_run=False):
""" Remove all packages missing from list """
removal_list = self.determine_extra_packages(packages)
if not removal_list:
print("No packages to be removed")
else:
if dry_run:
print("The fol... | [
"def",
"remove_extra_packages",
"(",
"self",
",",
"packages",
",",
"dry_run",
"=",
"False",
")",
":",
"removal_list",
"=",
"self",
".",
"determine_extra_packages",
"(",
"packages",
")",
"if",
"not",
"removal_list",
":",
"print",
"(",
"\"No packages to be removed\"... | Remove all packages missing from list | [
"Remove",
"all",
"packages",
"missing",
"from",
"list"
] | 4081c1238722166445f58ae57e939207f8a6fb83 | https://github.com/jessamynsmith/pipreq/blob/4081c1238722166445f58ae57e939207f8a6fb83/pipreq/command.py#L250-L268 |
38,482 | randomir/plucky | plucky/structural.py | pluckable.rewrap | def rewrap(self, **kwargs):
"""Inplace constructor. Depending on `self.inplace`, rewrap `obj`, or
just update internal vars, possibly including the `obj`.
"""
if self.inplace:
for key, val in kwargs.items():
setattr(self, key, val)
return self
... | python | def rewrap(self, **kwargs):
"""Inplace constructor. Depending on `self.inplace`, rewrap `obj`, or
just update internal vars, possibly including the `obj`.
"""
if self.inplace:
for key, val in kwargs.items():
setattr(self, key, val)
return self
... | [
"def",
"rewrap",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"inplace",
":",
"for",
"key",
",",
"val",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"self",
",",
"key",
",",
"val",
")",
"return",
"self",
"e... | Inplace constructor. Depending on `self.inplace`, rewrap `obj`, or
just update internal vars, possibly including the `obj`. | [
"Inplace",
"constructor",
".",
"Depending",
"on",
"self",
".",
"inplace",
"rewrap",
"obj",
"or",
"just",
"update",
"internal",
"vars",
"possibly",
"including",
"the",
"obj",
"."
] | 16b7b59aa19d619d8e619dc15dc7eeffc9fe078a | https://github.com/randomir/plucky/blob/16b7b59aa19d619d8e619dc15dc7eeffc9fe078a/plucky/structural.py#L52-L63 |
38,483 | randomir/plucky | plucky/structural.py | pluckable._sliced_list | def _sliced_list(self, selector):
"""For slice selectors operating on lists, we need to handle them
differently, depending on ``skipmissing``. In explicit mode, we may have
to expand the list with ``default`` values.
"""
if self.skipmissing:
return self.obj[selector]
... | python | def _sliced_list(self, selector):
"""For slice selectors operating on lists, we need to handle them
differently, depending on ``skipmissing``. In explicit mode, we may have
to expand the list with ``default`` values.
"""
if self.skipmissing:
return self.obj[selector]
... | [
"def",
"_sliced_list",
"(",
"self",
",",
"selector",
")",
":",
"if",
"self",
".",
"skipmissing",
":",
"return",
"self",
".",
"obj",
"[",
"selector",
"]",
"# TODO: can be optimized by observing list bounds",
"keys",
"=",
"xrange",
"(",
"selector",
".",
"start",
... | For slice selectors operating on lists, we need to handle them
differently, depending on ``skipmissing``. In explicit mode, we may have
to expand the list with ``default`` values. | [
"For",
"slice",
"selectors",
"operating",
"on",
"lists",
"we",
"need",
"to",
"handle",
"them",
"differently",
"depending",
"on",
"skipmissing",
".",
"In",
"explicit",
"mode",
"we",
"may",
"have",
"to",
"expand",
"the",
"list",
"with",
"default",
"values",
".... | 16b7b59aa19d619d8e619dc15dc7eeffc9fe078a | https://github.com/randomir/plucky/blob/16b7b59aa19d619d8e619dc15dc7eeffc9fe078a/plucky/structural.py#L109-L124 |
38,484 | scivision/sciencedates | sciencedates/tz.py | forceutc | def forceutc(t: Union[str, datetime.datetime, datetime.date, np.datetime64]) -> Union[datetime.datetime, datetime.date]:
"""
Add UTC to datetime-naive and convert to UTC for datetime aware
input: python datetime (naive, utc, non-utc) or Numpy datetime64 #FIXME add Pandas and AstroPy time classes
outpu... | python | def forceutc(t: Union[str, datetime.datetime, datetime.date, np.datetime64]) -> Union[datetime.datetime, datetime.date]:
"""
Add UTC to datetime-naive and convert to UTC for datetime aware
input: python datetime (naive, utc, non-utc) or Numpy datetime64 #FIXME add Pandas and AstroPy time classes
outpu... | [
"def",
"forceutc",
"(",
"t",
":",
"Union",
"[",
"str",
",",
"datetime",
".",
"datetime",
",",
"datetime",
".",
"date",
",",
"np",
".",
"datetime64",
"]",
")",
"->",
"Union",
"[",
"datetime",
".",
"datetime",
",",
"datetime",
".",
"date",
"]",
":",
... | Add UTC to datetime-naive and convert to UTC for datetime aware
input: python datetime (naive, utc, non-utc) or Numpy datetime64 #FIXME add Pandas and AstroPy time classes
output: utc datetime | [
"Add",
"UTC",
"to",
"datetime",
"-",
"naive",
"and",
"convert",
"to",
"UTC",
"for",
"datetime",
"aware"
] | a713389e027b42d26875cf227450a5d7c6696000 | https://github.com/scivision/sciencedates/blob/a713389e027b42d26875cf227450a5d7c6696000/sciencedates/tz.py#L8-L35 |
38,485 | e7dal/bubble3 | behave4cmd0/command_steps.py | step_a_new_working_directory | def step_a_new_working_directory(context):
"""
Creates a new, empty working directory
"""
command_util.ensure_context_attribute_exists(context, "workdir", None)
command_util.ensure_workdir_exists(context)
shutil.rmtree(context.workdir, ignore_errors=True) | python | def step_a_new_working_directory(context):
"""
Creates a new, empty working directory
"""
command_util.ensure_context_attribute_exists(context, "workdir", None)
command_util.ensure_workdir_exists(context)
shutil.rmtree(context.workdir, ignore_errors=True) | [
"def",
"step_a_new_working_directory",
"(",
"context",
")",
":",
"command_util",
".",
"ensure_context_attribute_exists",
"(",
"context",
",",
"\"workdir\"",
",",
"None",
")",
"command_util",
".",
"ensure_workdir_exists",
"(",
"context",
")",
"shutil",
".",
"rmtree",
... | Creates a new, empty working directory | [
"Creates",
"a",
"new",
"empty",
"working",
"directory"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L79-L85 |
38,486 | e7dal/bubble3 | behave4cmd0/command_steps.py | step_use_curdir_as_working_directory | def step_use_curdir_as_working_directory(context):
"""
Uses the current directory as working directory
"""
context.workdir = os.path.abspath(".")
command_util.ensure_workdir_exists(context) | python | def step_use_curdir_as_working_directory(context):
"""
Uses the current directory as working directory
"""
context.workdir = os.path.abspath(".")
command_util.ensure_workdir_exists(context) | [
"def",
"step_use_curdir_as_working_directory",
"(",
"context",
")",
":",
"context",
".",
"workdir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"\".\"",
")",
"command_util",
".",
"ensure_workdir_exists",
"(",
"context",
")"
] | Uses the current directory as working directory | [
"Uses",
"the",
"current",
"directory",
"as",
"working",
"directory"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L88-L93 |
38,487 | e7dal/bubble3 | behave4cmd0/command_steps.py | step_an_empty_file_named_filename | def step_an_empty_file_named_filename(context, filename):
"""
Creates an empty file.
"""
assert not os.path.isabs(filename)
command_util.ensure_workdir_exists(context)
filename2 = os.path.join(context.workdir, filename)
pathutil.create_textfile_with_contents(filename2, "") | python | def step_an_empty_file_named_filename(context, filename):
"""
Creates an empty file.
"""
assert not os.path.isabs(filename)
command_util.ensure_workdir_exists(context)
filename2 = os.path.join(context.workdir, filename)
pathutil.create_textfile_with_contents(filename2, "") | [
"def",
"step_an_empty_file_named_filename",
"(",
"context",
",",
"filename",
")",
":",
"assert",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"filename",
")",
"command_util",
".",
"ensure_workdir_exists",
"(",
"context",
")",
"filename2",
"=",
"os",
".",
"path... | Creates an empty file. | [
"Creates",
"an",
"empty",
"file",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L122-L129 |
38,488 | e7dal/bubble3 | behave4cmd0/command_steps.py | step_i_run_command | def step_i_run_command(context, command):
"""
Run a command as subprocess, collect its output and returncode.
"""
command_util.ensure_workdir_exists(context)
context.command_result = command_shell.run(command, cwd=context.workdir)
command_util.workdir_save_coverage_files(context.workdir)
if ... | python | def step_i_run_command(context, command):
"""
Run a command as subprocess, collect its output and returncode.
"""
command_util.ensure_workdir_exists(context)
context.command_result = command_shell.run(command, cwd=context.workdir)
command_util.workdir_save_coverage_files(context.workdir)
if ... | [
"def",
"step_i_run_command",
"(",
"context",
",",
"command",
")",
":",
"command_util",
".",
"ensure_workdir_exists",
"(",
"context",
")",
"context",
".",
"command_result",
"=",
"command_shell",
".",
"run",
"(",
"command",
",",
"cwd",
"=",
"context",
".",
"work... | Run a command as subprocess, collect its output and returncode. | [
"Run",
"a",
"command",
"as",
"subprocess",
"collect",
"its",
"output",
"and",
"returncode",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L136-L145 |
38,489 | e7dal/bubble3 | behave4cmd0/command_steps.py | step_command_output_should_contain_exactly_text | def step_command_output_should_contain_exactly_text(context, text):
"""
Verifies that the command output of the last command contains the
expected text.
.. code-block:: gherkin
When I run "echo Hello"
Then the command output should contain "Hello"
"""
expected_text = text
i... | python | def step_command_output_should_contain_exactly_text(context, text):
"""
Verifies that the command output of the last command contains the
expected text.
.. code-block:: gherkin
When I run "echo Hello"
Then the command output should contain "Hello"
"""
expected_text = text
i... | [
"def",
"step_command_output_should_contain_exactly_text",
"(",
"context",
",",
"text",
")",
":",
"expected_text",
"=",
"text",
"if",
"\"{__WORKDIR__}\"",
"in",
"text",
"or",
"\"{__CWD__}\"",
"in",
"text",
":",
"expected_text",
"=",
"textutil",
".",
"template_substitut... | Verifies that the command output of the last command contains the
expected text.
.. code-block:: gherkin
When I run "echo Hello"
Then the command output should contain "Hello" | [
"Verifies",
"that",
"the",
"command",
"output",
"of",
"the",
"last",
"command",
"contains",
"the",
"expected",
"text",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_steps.py#L253-L270 |
38,490 | paltman-archive/nashvegas | nashvegas/utils.py | get_file_list | def get_file_list(path, max_depth=1, cur_depth=0):
"""
Recursively returns a list of all files up to ``max_depth``
in a directory.
"""
if os.path.exists(path):
for name in os.listdir(path):
if name.startswith('.'):
continue
full_path = os.... | python | def get_file_list(path, max_depth=1, cur_depth=0):
"""
Recursively returns a list of all files up to ``max_depth``
in a directory.
"""
if os.path.exists(path):
for name in os.listdir(path):
if name.startswith('.'):
continue
full_path = os.... | [
"def",
"get_file_list",
"(",
"path",
",",
"max_depth",
"=",
"1",
",",
"cur_depth",
"=",
"0",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"for",
"name",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
":",
"if",
"name",
... | Recursively returns a list of all files up to ``max_depth``
in a directory. | [
"Recursively",
"returns",
"a",
"list",
"of",
"all",
"files",
"up",
"to",
"max_depth",
"in",
"a",
"directory",
"."
] | 14e904a3f5b87e878cd053b554e76e85943d1c11 | https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/utils.py#L134-L153 |
38,491 | paltman-archive/nashvegas | nashvegas/utils.py | get_applied_migrations | def get_applied_migrations(databases=None):
"""
Returns a dictionary containing lists of all applied migrations
where the key is the database alias.
"""
if not databases:
databases = get_capable_databases()
else:
# We only loop through databases that are listed as "capable"
... | python | def get_applied_migrations(databases=None):
"""
Returns a dictionary containing lists of all applied migrations
where the key is the database alias.
"""
if not databases:
databases = get_capable_databases()
else:
# We only loop through databases that are listed as "capable"
... | [
"def",
"get_applied_migrations",
"(",
"databases",
"=",
"None",
")",
":",
"if",
"not",
"databases",
":",
"databases",
"=",
"get_capable_databases",
"(",
")",
"else",
":",
"# We only loop through databases that are listed as \"capable\"",
"all_databases",
"=",
"list",
"(... | Returns a dictionary containing lists of all applied migrations
where the key is the database alias. | [
"Returns",
"a",
"dictionary",
"containing",
"lists",
"of",
"all",
"applied",
"migrations",
"where",
"the",
"key",
"is",
"the",
"database",
"alias",
"."
] | 14e904a3f5b87e878cd053b554e76e85943d1c11 | https://github.com/paltman-archive/nashvegas/blob/14e904a3f5b87e878cd053b554e76e85943d1c11/nashvegas/utils.py#L156-L175 |
38,492 | hollenstein/maspy | maspy/featuregrouping.py | getContGroupArrays | def getContGroupArrays(arrays, groupPositions, arrayKeys=None):
"""Convinience function to generate a subset of arrays from specified array
positions.
:param arrays: a dictionary containing ``numpy.arrays``
:param groupPositions: arrays positions that should be included in the
subset of arrays
... | python | def getContGroupArrays(arrays, groupPositions, arrayKeys=None):
"""Convinience function to generate a subset of arrays from specified array
positions.
:param arrays: a dictionary containing ``numpy.arrays``
:param groupPositions: arrays positions that should be included in the
subset of arrays
... | [
"def",
"getContGroupArrays",
"(",
"arrays",
",",
"groupPositions",
",",
"arrayKeys",
"=",
"None",
")",
":",
"if",
"arrayKeys",
"is",
"None",
":",
"arrayKeys",
"=",
"list",
"(",
"viewkeys",
"(",
"arrays",
")",
")",
"matchingArrays",
"=",
"dict",
"(",
")",
... | Convinience function to generate a subset of arrays from specified array
positions.
:param arrays: a dictionary containing ``numpy.arrays``
:param groupPositions: arrays positions that should be included in the
subset of arrays
:param arrayKeys: a list of "arrays" keys that should be included i... | [
"Convinience",
"function",
"to",
"generate",
"a",
"subset",
"of",
"arrays",
"from",
"specified",
"array",
"positions",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/featuregrouping.py#L323-L340 |
38,493 | hollenstein/maspy | maspy/featuregrouping.py | calcDistMatchArr | def calcDistMatchArr(matchArr, tKey, mKey):
"""Calculate the euclidean distance of all array positions in "matchArr".
:param matchArr: a dictionary of ``numpy.arrays`` containing at least two
entries that are treated as cartesian coordinates.
:param tKey: #TODO: docstring
:param mKey: #TODO: do... | python | def calcDistMatchArr(matchArr, tKey, mKey):
"""Calculate the euclidean distance of all array positions in "matchArr".
:param matchArr: a dictionary of ``numpy.arrays`` containing at least two
entries that are treated as cartesian coordinates.
:param tKey: #TODO: docstring
:param mKey: #TODO: do... | [
"def",
"calcDistMatchArr",
"(",
"matchArr",
",",
"tKey",
",",
"mKey",
")",
":",
"#Calculate all sorted list of all eucledian feature distances",
"matchArrSize",
"=",
"listvalues",
"(",
"matchArr",
")",
"[",
"0",
"]",
".",
"size",
"distInfo",
"=",
"{",
"'posPairs'",
... | Calculate the euclidean distance of all array positions in "matchArr".
:param matchArr: a dictionary of ``numpy.arrays`` containing at least two
entries that are treated as cartesian coordinates.
:param tKey: #TODO: docstring
:param mKey: #TODO: docstring
:returns: #TODO: docstring
... | [
"Calculate",
"the",
"euclidean",
"distance",
"of",
"all",
"array",
"positions",
"in",
"matchArr",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/featuregrouping.py#L356-L386 |
38,494 | hollenstein/maspy | maspy/featuregrouping.py | FgiContainer.load | def load(self, path, name):
"""Imports the specified ``fgic`` file from the hard disk.
:param path: filedirectory to which the ``fgic`` file is written.
:param name: filename, without file extension
"""
filename = name + '.fgic'
filepath = aux.joinpath(path, filename)
... | python | def load(self, path, name):
"""Imports the specified ``fgic`` file from the hard disk.
:param path: filedirectory to which the ``fgic`` file is written.
:param name: filename, without file extension
"""
filename = name + '.fgic'
filepath = aux.joinpath(path, filename)
... | [
"def",
"load",
"(",
"self",
",",
"path",
",",
"name",
")",
":",
"filename",
"=",
"name",
"+",
"'.fgic'",
"filepath",
"=",
"aux",
".",
"joinpath",
"(",
"path",
",",
"filename",
")",
"with",
"zipfile",
".",
"ZipFile",
"(",
"filepath",
",",
"'r'",
")",
... | Imports the specified ``fgic`` file from the hard disk.
:param path: filedirectory to which the ``fgic`` file is written.
:param name: filename, without file extension | [
"Imports",
"the",
"specified",
"fgic",
"file",
"from",
"the",
"hard",
"disk",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/featuregrouping.py#L191-L212 |
38,495 | ScottDuckworth/python-anyvcs | anyvcs/git.py | GitRepo.create | def create(cls, path, encoding='utf-8'):
"""Create a new bare repository"""
cmd = [GIT, 'init', '--quiet', '--bare', path]
subprocess.check_call(cmd)
return cls(path, encoding) | python | def create(cls, path, encoding='utf-8'):
"""Create a new bare repository"""
cmd = [GIT, 'init', '--quiet', '--bare', path]
subprocess.check_call(cmd)
return cls(path, encoding) | [
"def",
"create",
"(",
"cls",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"cmd",
"=",
"[",
"GIT",
",",
"'init'",
",",
"'--quiet'",
",",
"'--bare'",
",",
"path",
"]",
"subprocess",
".",
"check_call",
"(",
"cmd",
")",
"return",
"cls",
"(",
... | Create a new bare repository | [
"Create",
"a",
"new",
"bare",
"repository"
] | 9eb09defbc6b7c99d373fad53cbf8fc81b637923 | https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/git.py#L66-L70 |
38,496 | steinitzu/giveme | giveme/injector.py | Injector.cache | def cache(self, dependency: Dependency, value):
"""
Store an instance of dependency in the cache.
Does nothing if dependency is NOT a threadlocal
or a singleton.
:param dependency: The ``Dependency`` to cache
:param value: The value to cache for dependency
:ty... | python | def cache(self, dependency: Dependency, value):
"""
Store an instance of dependency in the cache.
Does nothing if dependency is NOT a threadlocal
or a singleton.
:param dependency: The ``Dependency`` to cache
:param value: The value to cache for dependency
:ty... | [
"def",
"cache",
"(",
"self",
",",
"dependency",
":",
"Dependency",
",",
"value",
")",
":",
"if",
"dependency",
".",
"threadlocal",
":",
"setattr",
"(",
"self",
".",
"_local",
",",
"dependency",
".",
"name",
",",
"value",
")",
"elif",
"dependency",
".",
... | Store an instance of dependency in the cache.
Does nothing if dependency is NOT a threadlocal
or a singleton.
:param dependency: The ``Dependency`` to cache
:param value: The value to cache for dependency
:type dependency: Dependency | [
"Store",
"an",
"instance",
"of",
"dependency",
"in",
"the",
"cache",
".",
"Does",
"nothing",
"if",
"dependency",
"is",
"NOT",
"a",
"threadlocal",
"or",
"a",
"singleton",
"."
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L46-L60 |
38,497 | steinitzu/giveme | giveme/injector.py | Injector.cached | def cached(self, dependency):
"""
Get a cached instance of dependency.
:param dependency: The ``Dependency`` to retrievie value for
:type dependency: ``Dependency``
:return: The cached value
"""
if dependency.threadlocal:
return getattr(self._... | python | def cached(self, dependency):
"""
Get a cached instance of dependency.
:param dependency: The ``Dependency`` to retrievie value for
:type dependency: ``Dependency``
:return: The cached value
"""
if dependency.threadlocal:
return getattr(self._... | [
"def",
"cached",
"(",
"self",
",",
"dependency",
")",
":",
"if",
"dependency",
".",
"threadlocal",
":",
"return",
"getattr",
"(",
"self",
".",
"_local",
",",
"dependency",
".",
"name",
",",
"None",
")",
"elif",
"dependency",
".",
"singleton",
":",
"retur... | Get a cached instance of dependency.
:param dependency: The ``Dependency`` to retrievie value for
:type dependency: ``Dependency``
:return: The cached value | [
"Get",
"a",
"cached",
"instance",
"of",
"dependency",
"."
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L62-L73 |
38,498 | steinitzu/giveme | giveme/injector.py | Injector._set | def _set(self, name, factory, singleton=False, threadlocal=False):
"""
Add a dependency factory to the registry
:param name: Name of dependency
:param factory: function/callable that returns dependency
:param singleton: When True, makes the dependency a singleton.
Fa... | python | def _set(self, name, factory, singleton=False, threadlocal=False):
"""
Add a dependency factory to the registry
:param name: Name of dependency
:param factory: function/callable that returns dependency
:param singleton: When True, makes the dependency a singleton.
Fa... | [
"def",
"_set",
"(",
"self",
",",
"name",
",",
"factory",
",",
"singleton",
"=",
"False",
",",
"threadlocal",
"=",
"False",
")",
":",
"name",
"=",
"name",
"or",
"factory",
".",
"__name__",
"factory",
".",
"_giveme_registered_name",
"=",
"name",
"dep",
"="... | Add a dependency factory to the registry
:param name: Name of dependency
:param factory: function/callable that returns dependency
:param singleton: When True, makes the dependency a singleton.
Factory will only be called on first use, subsequent
uses receive a cached v... | [
"Add",
"a",
"dependency",
"factory",
"to",
"the",
"registry"
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L75-L91 |
38,499 | steinitzu/giveme | giveme/injector.py | Injector.register | def register(self, function=None, *, singleton=False, threadlocal=False, name=None):
"""
Add an object to the injector's registry.
Can be used as a decorator like so:
>>> @injector.register
... def my_dependency(): ...
or a plain function call by passing in a c... | python | def register(self, function=None, *, singleton=False, threadlocal=False, name=None):
"""
Add an object to the injector's registry.
Can be used as a decorator like so:
>>> @injector.register
... def my_dependency(): ...
or a plain function call by passing in a c... | [
"def",
"register",
"(",
"self",
",",
"function",
"=",
"None",
",",
"*",
",",
"singleton",
"=",
"False",
",",
"threadlocal",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"function",
"=",
"None",
")",
":",
"self",
".",
"... | Add an object to the injector's registry.
Can be used as a decorator like so:
>>> @injector.register
... def my_dependency(): ...
or a plain function call by passing in a callable
injector.register(my_dependency)
:param function: The function or callable to ad... | [
"Add",
"an",
"object",
"to",
"the",
"injector",
"s",
"registry",
"."
] | b250995c59eb7e141d2cd8260e292c417785bbd1 | https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/injector.py#L116-L146 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.