repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
mardix/Mocha | mocha/contrib/auth/decorators.py | accepts_contributor_roles | def accepts_contributor_roles(func):
"""
Decorator that accepts only contributor roles
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, accepts_contributor_roles)
return func
else:
@functools.wraps(func)
def decorator(*args, ... | python | def accepts_contributor_roles(func):
"""
Decorator that accepts only contributor roles
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, accepts_contributor_roles)
return func
else:
@functools.wraps(func)
def decorator(*args, ... | [
"def",
"accepts_contributor_roles",
"(",
"func",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"func",
")",
":",
"apply_function_to_members",
"(",
"func",
",",
"accepts_contributor_roles",
")",
"return",
"func",
"else",
":",
"@",
"functools",
".",
"wraps",
"... | Decorator that accepts only contributor roles
:param func:
:return: | [
"Decorator",
"that",
"accepts",
"only",
"contributor",
"roles",
":",
"param",
"func",
":",
":",
"return",
":"
] | bce481cb31a0972061dd99bc548701411dcb9de3 | https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/contrib/auth/decorators.py#L186-L200 | train | Decorator that accepts only contributor roles |
mardix/Mocha | mocha/contrib/auth/decorators.py | accepts_moderator_roles | def accepts_moderator_roles(func):
"""
Decorator that accepts only moderator roles
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, accepts_moderator_roles)
return func
else:
@functools.wraps(func)
def decorator(*args, **kwar... | python | def accepts_moderator_roles(func):
"""
Decorator that accepts only moderator roles
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, accepts_moderator_roles)
return func
else:
@functools.wraps(func)
def decorator(*args, **kwar... | [
"def",
"accepts_moderator_roles",
"(",
"func",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"func",
")",
":",
"apply_function_to_members",
"(",
"func",
",",
"accepts_moderator_roles",
")",
"return",
"func",
"else",
":",
"@",
"functools",
".",
"wraps",
"(",
... | Decorator that accepts only moderator roles
:param func:
:return: | [
"Decorator",
"that",
"accepts",
"only",
"moderator",
"roles",
":",
"param",
"func",
":",
":",
"return",
":"
] | bce481cb31a0972061dd99bc548701411dcb9de3 | https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/contrib/auth/decorators.py#L203-L217 | train | Decorator that accepts only moderator roles |
mardix/Mocha | mocha/contrib/auth/decorators.py | jwt_required | def jwt_required(func):
"""
Checks if the Authorization barer exists. Otherwise throw 401
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, jwt_required)
return func
else:
@functools.wraps(func)
def deco(*a, **kw):
... | python | def jwt_required(func):
"""
Checks if the Authorization barer exists. Otherwise throw 401
:param func:
:return:
"""
if inspect.isclass(func):
apply_function_to_members(func, jwt_required)
return func
else:
@functools.wraps(func)
def deco(*a, **kw):
... | [
"def",
"jwt_required",
"(",
"func",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"func",
")",
":",
"apply_function_to_members",
"(",
"func",
",",
"jwt_required",
")",
"return",
"func",
"else",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"de... | Checks if the Authorization barer exists. Otherwise throw 401
:param func:
:return: | [
"Checks",
"if",
"the",
"Authorization",
"barer",
"exists",
".",
"Otherwise",
"throw",
"401",
":",
"param",
"func",
":",
":",
"return",
":"
] | bce481cb31a0972061dd99bc548701411dcb9de3 | https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/contrib/auth/decorators.py#L220-L236 | train | Decorator that checks if the Authorization barer exists. Otherwise throw 401. |
Kortemme-Lab/klab | klab/deprecated/rosettahelper.py | get_files | def get_files(dirname):
'''recursion rockz'''
all_files = []
os.chdir(dirname)
for fn in os.listdir(os.path.abspath(dirname)):
fn = os.path.abspath(fn)
if os.path.isdir(fn):
all_files += get_files(fn)
else:
all_files.append(fn)
os.chdir('../')
return all_files | python | def get_files(dirname):
'''recursion rockz'''
all_files = []
os.chdir(dirname)
for fn in os.listdir(os.path.abspath(dirname)):
fn = os.path.abspath(fn)
if os.path.isdir(fn):
all_files += get_files(fn)
else:
all_files.append(fn)
os.chdir('../')
return all_files | [
"def",
"get_files",
"(",
"dirname",
")",
":",
"all_files",
"=",
"[",
"]",
"os",
".",
"chdir",
"(",
"dirname",
")",
"for",
"fn",
"in",
"os",
".",
"listdir",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"dirname",
")",
")",
":",
"fn",
"=",
"os",
... | recursion rockz | [
"recursion",
"rockz"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettahelper.py#L132-L143 | train | recursion rockz |
Kortemme-Lab/klab | klab/deprecated/rosettahelper.py | saturateHexColor | def saturateHexColor(hexcolor, adjustment = 1.0):
'''Takes in an RGB color in 6-character hexadecimal with an optional preceding hash character.
Returns the RGB color in the same format adjusted by saturation by the second parameter.'''
assert(adjustment >= 0 and len(hexcolor) >= 1)
prefix = ""
if hexcolor[0] =... | python | def saturateHexColor(hexcolor, adjustment = 1.0):
'''Takes in an RGB color in 6-character hexadecimal with an optional preceding hash character.
Returns the RGB color in the same format adjusted by saturation by the second parameter.'''
assert(adjustment >= 0 and len(hexcolor) >= 1)
prefix = ""
if hexcolor[0] =... | [
"def",
"saturateHexColor",
"(",
"hexcolor",
",",
"adjustment",
"=",
"1.0",
")",
":",
"assert",
"(",
"adjustment",
">=",
"0",
"and",
"len",
"(",
"hexcolor",
")",
">=",
"1",
")",
"prefix",
"=",
"\"\"",
"if",
"hexcolor",
"[",
"0",
"]",
"==",
"'#'",
":",... | Takes in an RGB color in 6-character hexadecimal with an optional preceding hash character.
Returns the RGB color in the same format adjusted by saturation by the second parameter. | [
"Takes",
"in",
"an",
"RGB",
"color",
"in",
"6",
"-",
"character",
"hexadecimal",
"with",
"an",
"optional",
"preceding",
"hash",
"character",
".",
"Returns",
"the",
"RGB",
"color",
"in",
"the",
"same",
"format",
"adjusted",
"by",
"saturation",
"by",
"the",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettahelper.py#L157-L173 | train | Takes in an RGB color in 6 - character hexadecimal with an optional preceding hash character. Returns the RGB color in the same format adjusted by the second parameter. |
cgrok/cr-async | crasync/core.py | Client.get_profile | async def get_profile(self, *tags):
'''Get a profile object using tag(s)'''
url = '{0.BASE}/profile/{1}'.format(self, ','.join(tags))
data = await self.request(url)
if isinstance(data, list):
return [Profile(self, c) for c in data]
else:
... | python | async def get_profile(self, *tags):
'''Get a profile object using tag(s)'''
url = '{0.BASE}/profile/{1}'.format(self, ','.join(tags))
data = await self.request(url)
if isinstance(data, list):
return [Profile(self, c) for c in data]
else:
... | [
"async",
"def",
"get_profile",
"(",
"self",
",",
"*",
"tags",
")",
":",
"url",
"=",
"'{0.BASE}/profile/{1}'",
".",
"format",
"(",
"self",
",",
"','",
".",
"join",
"(",
"tags",
")",
")",
"data",
"=",
"await",
"self",
".",
"request",
"(",
"url",
")",
... | Get a profile object using tag(s) | [
"Get",
"a",
"profile",
"object",
"using",
"tag",
"(",
"s",
")"
] | f65a968e54704168706d137d1ba662f55f8ab852 | https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/crasync/core.py#L82-L91 | train | Get a profile object using tag list |
cgrok/cr-async | crasync/core.py | Client.get_clan | async def get_clan(self, *tags):
'''Get a clan object using tag(s)'''
url = '{0.BASE}/clan/{1}'.format(self, ','.join(tags))
data = await self.request(url)
if isinstance(data, list):
return [Clan(self, c) for c in data]
else:
return Clan(... | python | async def get_clan(self, *tags):
'''Get a clan object using tag(s)'''
url = '{0.BASE}/clan/{1}'.format(self, ','.join(tags))
data = await self.request(url)
if isinstance(data, list):
return [Clan(self, c) for c in data]
else:
return Clan(... | [
"async",
"def",
"get_clan",
"(",
"self",
",",
"*",
"tags",
")",
":",
"url",
"=",
"'{0.BASE}/clan/{1}'",
".",
"format",
"(",
"self",
",",
"','",
".",
"join",
"(",
"tags",
")",
")",
"data",
"=",
"await",
"self",
".",
"request",
"(",
"url",
")",
"if",... | Get a clan object using tag(s) | [
"Get",
"a",
"clan",
"object",
"using",
"tag",
"(",
"s",
")"
] | f65a968e54704168706d137d1ba662f55f8ab852 | https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/crasync/core.py#L95-L104 | train | Get a clan object using tag ( s ) |
cgrok/cr-async | crasync/core.py | Client.get_constants | async def get_constants(self):
'''Get clash royale constants.'''
url = self.BASE + '/constants'
data = await self.request(url)
return Constants(self, data) | python | async def get_constants(self):
'''Get clash royale constants.'''
url = self.BASE + '/constants'
data = await self.request(url)
return Constants(self, data) | [
"async",
"def",
"get_constants",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"BASE",
"+",
"'/constants'",
"data",
"=",
"await",
"self",
".",
"request",
"(",
"url",
")",
"return",
"Constants",
"(",
"self",
",",
"data",
")"
] | Get clash royale constants. | [
"Get",
"clash",
"royale",
"constants",
"."
] | f65a968e54704168706d137d1ba662f55f8ab852 | https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/crasync/core.py#L108-L114 | train | Get clash royale constants. |
cgrok/cr-async | crasync/core.py | Client.get_top_clans | async def get_top_clans(self):
'''Get a list of top clans, info is only brief,
call get_clan() on each of the ClanInfo objects
to get full clan info'''
url = self.BASE + '/top/clans'
data = await self.request(url)
return [ClanInfo(self, c) for c in data.get('clans')] | python | async def get_top_clans(self):
'''Get a list of top clans, info is only brief,
call get_clan() on each of the ClanInfo objects
to get full clan info'''
url = self.BASE + '/top/clans'
data = await self.request(url)
return [ClanInfo(self, c) for c in data.get('clans')] | [
"async",
"def",
"get_top_clans",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"BASE",
"+",
"'/top/clans'",
"data",
"=",
"await",
"self",
".",
"request",
"(",
"url",
")",
"return",
"[",
"ClanInfo",
"(",
"self",
",",
"c",
")",
"for",
"c",
"in",
"d... | Get a list of top clans, info is only brief,
call get_clan() on each of the ClanInfo objects
to get full clan info | [
"Get",
"a",
"list",
"of",
"top",
"clans",
"info",
"is",
"only",
"brief",
"call",
"get_clan",
"()",
"on",
"each",
"of",
"the",
"ClanInfo",
"objects",
"to",
"get",
"full",
"clan",
"info"
] | f65a968e54704168706d137d1ba662f55f8ab852 | https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/crasync/core.py#L116-L124 | train | Get a list of top clans info is only brief |
peergradeio/flask-mongo-profiler | flask_mongo_profiler/contrib/flask_admin/helpers.py | get_list_url_filtered_by_field_value | def get_list_url_filtered_by_field_value(view, model, name, reverse=False):
"""Get the URL if a filter of model[name] value was appended.
This allows programatically adding filters. This is used in the specialized case
of filtering deeper into a list by a field's value.
For instance, since there can b... | python | def get_list_url_filtered_by_field_value(view, model, name, reverse=False):
"""Get the URL if a filter of model[name] value was appended.
This allows programatically adding filters. This is used in the specialized case
of filtering deeper into a list by a field's value.
For instance, since there can b... | [
"def",
"get_list_url_filtered_by_field_value",
"(",
"view",
",",
"model",
",",
"name",
",",
"reverse",
"=",
"False",
")",
":",
"view_args",
"=",
"view",
".",
"_get_list_extra_args",
"(",
")",
"def",
"create_filter_arg",
"(",
"field_name",
",",
"value",
")",
":... | Get the URL if a filter of model[name] value was appended.
This allows programatically adding filters. This is used in the specialized case
of filtering deeper into a list by a field's value.
For instance, since there can be multiple assignments in a list of handins. The
assignment column can have a U... | [
"Get",
"the",
"URL",
"if",
"a",
"filter",
"of",
"model",
"[",
"name",
"]",
"value",
"was",
"appended",
"."
] | a267eeb49fea07c9a24fb370bd9d7a90ed313ccf | https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/contrib/flask_admin/helpers.py#L12-L63 | train | Returns the URL of the current list with the given model field value. |
peergradeio/flask-mongo-profiler | flask_mongo_profiler/contrib/flask_admin/helpers.py | search_relative_field | def search_relative_field(model_class, fields, term):
"""Searches a ReferenceField's fields, returning ID's to be used in __in
There is no JOIN, so no Assignment.objects.filter(course__title='My Course'). To
get around this, we return a list of ID's.
Since this is an internal tool, we allow multiple f... | python | def search_relative_field(model_class, fields, term):
"""Searches a ReferenceField's fields, returning ID's to be used in __in
There is no JOIN, so no Assignment.objects.filter(course__title='My Course'). To
get around this, we return a list of ID's.
Since this is an internal tool, we allow multiple f... | [
"def",
"search_relative_field",
"(",
"model_class",
",",
"fields",
",",
"term",
")",
":",
"offset",
"=",
"0",
"limit",
"=",
"500",
"query",
"=",
"model_class",
".",
"objects",
"criteria",
"=",
"None",
"# If an ObjectId pattern, see if we can get an instant lookup.",
... | Searches a ReferenceField's fields, returning ID's to be used in __in
There is no JOIN, so no Assignment.objects.filter(course__title='My Course'). To
get around this, we return a list of ID's.
Since this is an internal tool, we allow multiple fields to AND/OR group. | [
"Searches",
"a",
"ReferenceField",
"s",
"fields",
"returning",
"ID",
"s",
"to",
"be",
"used",
"in",
"__in"
] | a267eeb49fea07c9a24fb370bd9d7a90ed313ccf | https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/contrib/flask_admin/helpers.py#L66-L99 | train | Searches a ReferenceField s fields returning a list of IDs to be used in __in
|
TheGhouls/oct | oct/utilities/pack.py | pack_turret | def pack_turret(turret, temp_files, base_config_path, path=None):
"""pack a turret into a tar file based on the turret configuration
:param dict turret_config: the turret configuration to pack
:param str tmp_config_file: the path of the temp config file
:param str base_config_path: the base directory o... | python | def pack_turret(turret, temp_files, base_config_path, path=None):
"""pack a turret into a tar file based on the turret configuration
:param dict turret_config: the turret configuration to pack
:param str tmp_config_file: the path of the temp config file
:param str base_config_path: the base directory o... | [
"def",
"pack_turret",
"(",
"turret",
",",
"temp_files",
",",
"base_config_path",
",",
"path",
"=",
"None",
")",
":",
"file_name",
"=",
"turret",
"[",
"'name'",
"]",
"files",
"=",
"temp_files",
"[",
":",
"]",
"for",
"fname",
"in",
"turret",
".",
"get",
... | pack a turret into a tar file based on the turret configuration
:param dict turret_config: the turret configuration to pack
:param str tmp_config_file: the path of the temp config file
:param str base_config_path: the base directory of the main configuration file | [
"pack",
"a",
"turret",
"into",
"a",
"tar",
"file",
"based",
"on",
"the",
"turret",
"configuration"
] | 7e9bddeb3b8495a26442b1c86744e9fb187fe88f | https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/utilities/pack.py#L52-L80 | train | pack a turret into a tar file based on the turret configuration |
fjwCode/cerium | cerium/elements.py | Elements.clear | def clear(self) -> None:
"""Clears the text if it's a text entry element."""
self.click()
for i in self.text:
self._parent.send_keyevents(Keys.DEL) | python | def clear(self) -> None:
"""Clears the text if it's a text entry element."""
self.click()
for i in self.text:
self._parent.send_keyevents(Keys.DEL) | [
"def",
"clear",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"click",
"(",
")",
"for",
"i",
"in",
"self",
".",
"text",
":",
"self",
".",
"_parent",
".",
"send_keyevents",
"(",
"Keys",
".",
"DEL",
")"
] | Clears the text if it's a text entry element. | [
"Clears",
"the",
"text",
"if",
"it",
"s",
"a",
"text",
"entry",
"element",
"."
] | f6e06e0dcf83a0bc924828e9d6cb81383ed2364f | https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/elements.py#L81-L85 | train | Clears the text if it s a text entry element. |
fjwCode/cerium | cerium/elements.py | Elements.send_keys | def send_keys(self, text: str = 'cerium') -> None:
'''Simulates typing keys.'''
self.click()
self._parent.send_keys(text) | python | def send_keys(self, text: str = 'cerium') -> None:
'''Simulates typing keys.'''
self.click()
self._parent.send_keys(text) | [
"def",
"send_keys",
"(",
"self",
",",
"text",
":",
"str",
"=",
"'cerium'",
")",
"->",
"None",
":",
"self",
".",
"click",
"(",
")",
"self",
".",
"_parent",
".",
"send_keys",
"(",
"text",
")"
] | Simulates typing keys. | [
"Simulates",
"typing",
"keys",
"."
] | f6e06e0dcf83a0bc924828e9d6cb81383ed2364f | https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/elements.py#L87-L90 | train | Simulates typing keys. |
Kortemme-Lab/klab | klab/bio/sifts.py | retrieve_file_from_EBI | def retrieve_file_from_EBI(resource, silent = True):
'''Retrieve a file from the RCSB.'''
#import sys
#import traceback
#print(resource)
#print('\n'.join(traceback.format_stack()))
#sys.exit(0)
if not silent:
colortext.printf("Retrieving %s from EBI" % os.path.split(resource)[1], col... | python | def retrieve_file_from_EBI(resource, silent = True):
'''Retrieve a file from the RCSB.'''
#import sys
#import traceback
#print(resource)
#print('\n'.join(traceback.format_stack()))
#sys.exit(0)
if not silent:
colortext.printf("Retrieving %s from EBI" % os.path.split(resource)[1], col... | [
"def",
"retrieve_file_from_EBI",
"(",
"resource",
",",
"silent",
"=",
"True",
")",
":",
"#import sys",
"#import traceback",
"#print(resource)",
"#print('\\n'.join(traceback.format_stack()))",
"#sys.exit(0)",
"if",
"not",
"silent",
":",
"colortext",
".",
"printf",
"(",
"... | Retrieve a file from the RCSB. | [
"Retrieve",
"a",
"file",
"from",
"the",
"RCSB",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/sifts.py#L51-L67 | train | Retrieve a file from the RCSB. |
Kortemme-Lab/klab | klab/bio/sifts.py | DomainMatch.add | def add(self, domain_accession, domain_type, match_quality):
'''match_quality should be a value between 0 and 1.'''
self.matches[domain_type] = self.matches.get(domain_type, {})
self.matches[domain_type][domain_accession] = match_quality | python | def add(self, domain_accession, domain_type, match_quality):
'''match_quality should be a value between 0 and 1.'''
self.matches[domain_type] = self.matches.get(domain_type, {})
self.matches[domain_type][domain_accession] = match_quality | [
"def",
"add",
"(",
"self",
",",
"domain_accession",
",",
"domain_type",
",",
"match_quality",
")",
":",
"self",
".",
"matches",
"[",
"domain_type",
"]",
"=",
"self",
".",
"matches",
".",
"get",
"(",
"domain_type",
",",
"{",
"}",
")",
"self",
".",
"matc... | match_quality should be a value between 0 and 1. | [
"match_quality",
"should",
"be",
"a",
"value",
"between",
"0",
"and",
"1",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/sifts.py#L129-L132 | train | Add a new entry to the matches dictionary. |
Kortemme-Lab/klab | klab/bio/sifts.py | SIFTS.retrieve | def retrieve(pdb_id, cache_dir = None, acceptable_sequence_percentage_match = 70.0, require_uniprot_residue_mapping = True, bio_cache = None):
'''Creates a PDBML object by using a cached copy of the files if they exists or by retrieving the files from the RCSB.
bio_cache should be a klab.bio.cache.py... | python | def retrieve(pdb_id, cache_dir = None, acceptable_sequence_percentage_match = 70.0, require_uniprot_residue_mapping = True, bio_cache = None):
'''Creates a PDBML object by using a cached copy of the files if they exists or by retrieving the files from the RCSB.
bio_cache should be a klab.bio.cache.py... | [
"def",
"retrieve",
"(",
"pdb_id",
",",
"cache_dir",
"=",
"None",
",",
"acceptable_sequence_percentage_match",
"=",
"70.0",
",",
"require_uniprot_residue_mapping",
"=",
"True",
",",
"bio_cache",
"=",
"None",
")",
":",
"pdb_contents",
"=",
"None",
"xml_contents",
"=... | Creates a PDBML object by using a cached copy of the files if they exists or by retrieving the files from the RCSB.
bio_cache should be a klab.bio.cache.py::BioCache object and is used to avoid reading/downloading cached files repeatedly. | [
"Creates",
"a",
"PDBML",
"object",
"by",
"using",
"a",
"cached",
"copy",
"of",
"the",
"files",
"if",
"they",
"exists",
"or",
"by",
"retrieving",
"the",
"files",
"from",
"the",
"RCSB",
".",
"bio_cache",
"should",
"be",
"a",
"klab",
".",
"bio",
".",
"cac... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/sifts.py#L325-L375 | train | Creates a PDBML object by using a cached copy of the files if they exists or by retrieving the XML files from the RCSB. |
Kortemme-Lab/klab | klab/bio/sifts.py | SIFTS._validate | def _validate(self):
'''Tests that the maps agree through composition.'''
# I used to use the assertion "self.atom_to_uniparc_sequence_maps.keys() == self.atom_to_seqres_sequence_maps.keys() == self.seqres_to_uniparc_sequence_maps.keys()"
# but that failed for 2IMM where "self.atom_to_uniparc_s... | python | def _validate(self):
'''Tests that the maps agree through composition.'''
# I used to use the assertion "self.atom_to_uniparc_sequence_maps.keys() == self.atom_to_seqres_sequence_maps.keys() == self.seqres_to_uniparc_sequence_maps.keys()"
# but that failed for 2IMM where "self.atom_to_uniparc_s... | [
"def",
"_validate",
"(",
"self",
")",
":",
"# I used to use the assertion \"self.atom_to_uniparc_sequence_maps.keys() == self.atom_to_seqres_sequence_maps.keys() == self.seqres_to_uniparc_sequence_maps.keys()\"",
"# but that failed for 2IMM where \"self.atom_to_uniparc_sequence_maps.keys() == self.seq... | Tests that the maps agree through composition. | [
"Tests",
"that",
"the",
"maps",
"agree",
"through",
"composition",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/sifts.py#L729-L747 | train | Tests that the maps agree through composition. |
adaptive-learning/proso-apps | proso_user/views_classes.py | classes | def classes(request):
"""Get all classes of current user"""
if not request.user.is_authenticated() or not hasattr(request.user, "userprofile"):
return render_json(request, {
'error': _('User is not logged in'),
'error_type': 'user_unauthorized'
}, template='user_json.htm... | python | def classes(request):
"""Get all classes of current user"""
if not request.user.is_authenticated() or not hasattr(request.user, "userprofile"):
return render_json(request, {
'error': _('User is not logged in'),
'error_type': 'user_unauthorized'
}, template='user_json.htm... | [
"def",
"classes",
"(",
"request",
")",
":",
"if",
"not",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
"or",
"not",
"hasattr",
"(",
"request",
".",
"user",
",",
"\"userprofile\"",
")",
":",
"return",
"render_json",
"(",
"request",
",",
"{",
... | Get all classes of current user | [
"Get",
"all",
"classes",
"of",
"current",
"user"
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views_classes.py#L13-L23 | train | Get all classes of current user |
adaptive-learning/proso-apps | proso_user/views_classes.py | create_class | def create_class(request):
"""Create new class
POST parameters (JSON):
name:
Human readable name of class
code (optional):
unique code of class used for joining to class
"""
if request.method == 'GET':
return render(request, 'classes_create.html', {}, he... | python | def create_class(request):
"""Create new class
POST parameters (JSON):
name:
Human readable name of class
code (optional):
unique code of class used for joining to class
"""
if request.method == 'GET':
return render(request, 'classes_create.html', {}, he... | [
"def",
"create_class",
"(",
"request",
")",
":",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"return",
"render",
"(",
"request",
",",
"'classes_create.html'",
",",
"{",
"}",
",",
"help_text",
"=",
"create_class",
".",
"__doc__",
")",
"if",
"request... | Create new class
POST parameters (JSON):
name:
Human readable name of class
code (optional):
unique code of class used for joining to class | [
"Create",
"new",
"class"
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views_classes.py#L26-L63 | train | Create a new class in the class hierarchy. |
adaptive-learning/proso-apps | proso_user/views_classes.py | join_class | def join_class(request):
"""Join a class
POST parameters (JSON):
code:
code of the class
"""
if request.method == 'GET':
return render(request, 'classes_join.html', {}, help_text=join_class.__doc__)
if request.method == 'POST':
if not request.user.is_authentica... | python | def join_class(request):
"""Join a class
POST parameters (JSON):
code:
code of the class
"""
if request.method == 'GET':
return render(request, 'classes_join.html', {}, help_text=join_class.__doc__)
if request.method == 'POST':
if not request.user.is_authentica... | [
"def",
"join_class",
"(",
"request",
")",
":",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"return",
"render",
"(",
"request",
",",
"'classes_join.html'",
",",
"{",
"}",
",",
"help_text",
"=",
"join_class",
".",
"__doc__",
")",
"if",
"request",
"... | Join a class
POST parameters (JSON):
code:
code of the class | [
"Join",
"a",
"class"
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views_classes.py#L66-L101 | train | Join a class in a class tree. |
adaptive-learning/proso-apps | proso_user/views_classes.py | create_student | def create_student(request):
""" Create new user in class
POST parameters (JSON):
class:
id of the class
username (optional):
username of student, if not provided username is create based on name
password (optional):
password of student
first_... | python | def create_student(request):
""" Create new user in class
POST parameters (JSON):
class:
id of the class
username (optional):
username of student, if not provided username is create based on name
password (optional):
password of student
first_... | [
"def",
"create_student",
"(",
"request",
")",
":",
"if",
"not",
"get_config",
"(",
"'proso_user'",
",",
"'allow_create_students'",
",",
"default",
"=",
"False",
")",
":",
"return",
"render_json",
"(",
"request",
",",
"{",
"'error'",
":",
"_",
"(",
"'Creation... | Create new user in class
POST parameters (JSON):
class:
id of the class
username (optional):
username of student, if not provided username is create based on name
password (optional):
password of student
first_name:
first_name of stude... | [
"Create",
"new",
"user",
"in",
"class"
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views_classes.py#L104-L178 | train | Create new user in class
Arc using POST parameters. |
adaptive-learning/proso-apps | proso_user/views_classes.py | login_student | def login_student(request):
"""
Log in student
POST parameters (JSON):
student:
profile id of the student
"""
if not get_config('proso_user', 'allow_login_students', default=False):
return render_json(request, {
'error': _('Log in as student is not allowed.')... | python | def login_student(request):
"""
Log in student
POST parameters (JSON):
student:
profile id of the student
"""
if not get_config('proso_user', 'allow_login_students', default=False):
return render_json(request, {
'error': _('Log in as student is not allowed.')... | [
"def",
"login_student",
"(",
"request",
")",
":",
"if",
"not",
"get_config",
"(",
"'proso_user'",
",",
"'allow_login_students'",
",",
"default",
"=",
"False",
")",
":",
"return",
"render_json",
"(",
"request",
",",
"{",
"'error'",
":",
"_",
"(",
"'Log in as ... | Log in student
POST parameters (JSON):
student:
profile id of the student | [
"Log",
"in",
"student"
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_user/views_classes.py#L181-L222 | train | Log in student |
ZEDGR/pychal | challonge/participants.py | create | def create(tournament, name, **params):
"""Add a participant to a tournament."""
params.update({"name": name})
return api.fetch_and_parse(
"POST",
"tournaments/%s/participants" % tournament,
"participant",
**params) | python | def create(tournament, name, **params):
"""Add a participant to a tournament."""
params.update({"name": name})
return api.fetch_and_parse(
"POST",
"tournaments/%s/participants" % tournament,
"participant",
**params) | [
"def",
"create",
"(",
"tournament",
",",
"name",
",",
"*",
"*",
"params",
")",
":",
"params",
".",
"update",
"(",
"{",
"\"name\"",
":",
"name",
"}",
")",
"return",
"api",
".",
"fetch_and_parse",
"(",
"\"POST\"",
",",
"\"tournaments/%s/participants\"",
"%",... | Add a participant to a tournament. | [
"Add",
"a",
"participant",
"to",
"a",
"tournament",
"."
] | 3600fa9e0557a2a14eb1ad0c0711d28dad3693d7 | https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/participants.py#L11-L19 | train | Add a participant to a tournament. |
ZEDGR/pychal | challonge/participants.py | bulk_add | def bulk_add(tournament, names, **params):
"""Bulk add participants to a tournament (up until it is started).
:param tournament: the tournament's name or id
:param names: the names of the participants
:type tournament: int or string
:type names: list or tuple
:return: each participants info
... | python | def bulk_add(tournament, names, **params):
"""Bulk add participants to a tournament (up until it is started).
:param tournament: the tournament's name or id
:param names: the names of the participants
:type tournament: int or string
:type names: list or tuple
:return: each participants info
... | [
"def",
"bulk_add",
"(",
"tournament",
",",
"names",
",",
"*",
"*",
"params",
")",
":",
"params",
".",
"update",
"(",
"{",
"\"name\"",
":",
"names",
"}",
")",
"return",
"api",
".",
"fetch_and_parse",
"(",
"\"POST\"",
",",
"\"tournaments/%s/participants/bulk_a... | Bulk add participants to a tournament (up until it is started).
:param tournament: the tournament's name or id
:param names: the names of the participants
:type tournament: int or string
:type names: list or tuple
:return: each participants info
:rtype: a list of dictionaries | [
"Bulk",
"add",
"participants",
"to",
"a",
"tournament",
"(",
"up",
"until",
"it",
"is",
"started",
")",
"."
] | 3600fa9e0557a2a14eb1ad0c0711d28dad3693d7 | https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/participants.py#L22-L39 | train | Bulk add participants to a tournament. |
uogbuji/versa | tools/py/query/miniparser.py | p_arglist | def p_arglist(p):
'''
arglist : arg
| arglist COMMA arg
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1]
p[0].append(p[3]) | python | def p_arglist(p):
'''
arglist : arg
| arglist COMMA arg
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1]
p[0].append(p[3]) | [
"def",
"p_arglist",
"(",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"2",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"p",
"[",
"1",
"]",
"]",
"else",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
".",
"append",
... | arglist : arg
| arglist COMMA arg | [
"arglist",
":",
"arg",
"|",
"arglist",
"COMMA",
"arg"
] | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/query/miniparser.py#L133-L142 | train | arglist is a list of comma separated list of argument names |
uogbuji/versa | tools/py/query/miniparser.py | p_matcharglist | def p_matcharglist(p):
'''
matcharglist : matcharg
| matcharglist COMMA matcharg
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1]
p[0].append(p[3]) | python | def p_matcharglist(p):
'''
matcharglist : matcharg
| matcharglist COMMA matcharg
'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1]
p[0].append(p[3]) | [
"def",
"p_matcharglist",
"(",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
"==",
"2",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"p",
"[",
"1",
"]",
"]",
"else",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"1",
"]",
"p",
"[",
"0",
"]",
".",
"append... | matcharglist : matcharg
| matcharglist COMMA matcharg | [
"matcharglist",
":",
"matcharg",
"|",
"matcharglist",
"COMMA",
"matcharg"
] | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/query/miniparser.py#L144-L154 | train | parse a matcharglist into a list of tokens |
fjwCode/cerium | cerium/commands.py | Commands._build_cmd | def _build_cmd(self, args: Union[list, tuple]) -> str:
'''Build command.'''
cmd = [self.path]
cmd.extend(args)
return cmd | python | def _build_cmd(self, args: Union[list, tuple]) -> str:
'''Build command.'''
cmd = [self.path]
cmd.extend(args)
return cmd | [
"def",
"_build_cmd",
"(",
"self",
",",
"args",
":",
"Union",
"[",
"list",
",",
"tuple",
"]",
")",
"->",
"str",
":",
"cmd",
"=",
"[",
"self",
".",
"path",
"]",
"cmd",
".",
"extend",
"(",
"args",
")",
"return",
"cmd"
] | Build command. | [
"Build",
"command",
"."
] | f6e06e0dcf83a0bc924828e9d6cb81383ed2364f | https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/commands.py#L53-L57 | train | Build command. |
fjwCode/cerium | cerium/commands.py | Commands.execute | def execute(self, *, args: Union[list, tuple], options: dict) -> tuple:
'''Execute command.'''
cmd = self._build_cmd(args)
process = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE,
encoding='utf-8', shell=options.get('shell', False), env=options.get... | python | def execute(self, *, args: Union[list, tuple], options: dict) -> tuple:
'''Execute command.'''
cmd = self._build_cmd(args)
process = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE,
encoding='utf-8', shell=options.get('shell', False), env=options.get... | [
"def",
"execute",
"(",
"self",
",",
"*",
",",
"args",
":",
"Union",
"[",
"list",
",",
"tuple",
"]",
",",
"options",
":",
"dict",
")",
"->",
"tuple",
":",
"cmd",
"=",
"self",
".",
"_build_cmd",
"(",
"args",
")",
"process",
"=",
"subprocess",
".",
... | Execute command. | [
"Execute",
"command",
"."
] | f6e06e0dcf83a0bc924828e9d6cb81383ed2364f | https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/commands.py#L59-L64 | train | Execute command. |
TheGhouls/oct | oct/results/graphs.py | get_local_time | def get_local_time(index):
"""Localize datetime for better output in graphs
:param pandas.DateTimeIndex index: pandas datetime index
:return: aware time objet
:rtype: datetime.time
"""
dt = index.to_pydatetime()
dt = dt.replace(tzinfo=pytz.utc)
return dt.astimezone(tzlocal()).time() | python | def get_local_time(index):
"""Localize datetime for better output in graphs
:param pandas.DateTimeIndex index: pandas datetime index
:return: aware time objet
:rtype: datetime.time
"""
dt = index.to_pydatetime()
dt = dt.replace(tzinfo=pytz.utc)
return dt.astimezone(tzlocal()).time() | [
"def",
"get_local_time",
"(",
"index",
")",
":",
"dt",
"=",
"index",
".",
"to_pydatetime",
"(",
")",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
"=",
"pytz",
".",
"utc",
")",
"return",
"dt",
".",
"astimezone",
"(",
"tzlocal",
"(",
")",
")",
"."... | Localize datetime for better output in graphs
:param pandas.DateTimeIndex index: pandas datetime index
:return: aware time objet
:rtype: datetime.time | [
"Localize",
"datetime",
"for",
"better",
"output",
"in",
"graphs"
] | 7e9bddeb3b8495a26442b1c86744e9fb187fe88f | https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/graphs.py#L9-L18 | train | Localize datetime for better output in graphs
|
TheGhouls/oct | oct/results/graphs.py | resp_graph_raw | def resp_graph_raw(dataframe, image_name, dir='./'):
"""Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
factor = int(len(dataframe) / 10)
df =... | python | def resp_graph_raw(dataframe, image_name, dir='./'):
"""Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
factor = int(len(dataframe) / 10)
df =... | [
"def",
"resp_graph_raw",
"(",
"dataframe",
",",
"image_name",
",",
"dir",
"=",
"'./'",
")",
":",
"factor",
"=",
"int",
"(",
"len",
"(",
"dataframe",
")",
"/",
"10",
")",
"df",
"=",
"dataframe",
".",
"reset_index",
"(",
")",
"fig",
"=",
"pygal",
".",
... | Response time graph for raw data
:param pandas.DataFrame dataframe: the raw results dataframe
:param str image_name: the output file name
:param str dir: the output directory
:return: None | [
"Response",
"time",
"graph",
"for",
"raw",
"data"
] | 7e9bddeb3b8495a26442b1c86744e9fb187fe88f | https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/graphs.py#L21-L43 | train | Generate a response time graph for raw data |
TheGhouls/oct | oct/results/graphs.py | resp_graph | def resp_graph(dataframe, image_name, dir='./'):
"""Response time graph for bucketed data
:param pandas.DataFrame dataframe: dataframe containing all data
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
fig = pygal.TimeLine(x_title='Elapsed... | python | def resp_graph(dataframe, image_name, dir='./'):
"""Response time graph for bucketed data
:param pandas.DataFrame dataframe: dataframe containing all data
:param str image_name: the output file name
:param str dir: the output directory
:return: None
"""
fig = pygal.TimeLine(x_title='Elapsed... | [
"def",
"resp_graph",
"(",
"dataframe",
",",
"image_name",
",",
"dir",
"=",
"'./'",
")",
":",
"fig",
"=",
"pygal",
".",
"TimeLine",
"(",
"x_title",
"=",
"'Elapsed Time In Test (secs)'",
",",
"y_title",
"=",
"'Response Time (secs)'",
",",
"x_label_rotation",
"=",
... | Response time graph for bucketed data
:param pandas.DataFrame dataframe: dataframe containing all data
:param str image_name: the output file name
:param str dir: the output directory
:return: None | [
"Response",
"time",
"graph",
"for",
"bucketed",
"data"
] | 7e9bddeb3b8495a26442b1c86744e9fb187fe88f | https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/graphs.py#L46-L64 | train | Response time graph for bucketed data |
TheGhouls/oct | oct/results/graphs.py | tp_graph | def tp_graph(dataframe, image_name, dir='./'):
"""Throughput graph
:param pandas.DataFrame dataframe: dataframe containing all data
:param str dir: the output directory
:return: None
"""
fig = pygal.TimeLine(x_title='Elapsed Time In Test (secs)',
x_label_rotation=25,
... | python | def tp_graph(dataframe, image_name, dir='./'):
"""Throughput graph
:param pandas.DataFrame dataframe: dataframe containing all data
:param str dir: the output directory
:return: None
"""
fig = pygal.TimeLine(x_title='Elapsed Time In Test (secs)',
x_label_rotation=25,
... | [
"def",
"tp_graph",
"(",
"dataframe",
",",
"image_name",
",",
"dir",
"=",
"'./'",
")",
":",
"fig",
"=",
"pygal",
".",
"TimeLine",
"(",
"x_title",
"=",
"'Elapsed Time In Test (secs)'",
",",
"x_label_rotation",
"=",
"25",
",",
"y_title",
"=",
"'Transactions Per S... | Throughput graph
:param pandas.DataFrame dataframe: dataframe containing all data
:param str dir: the output directory
:return: None | [
"Throughput",
"graph"
] | 7e9bddeb3b8495a26442b1c86744e9fb187fe88f | https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/graphs.py#L67-L81 | train | This function creates a throughput graph from a pandas. DataFrame dataframe containing all data and outputs it in a single image. |
uogbuji/versa | tools/py/driver/postgres.py | connection.size | def size(self):
'''Return the number of links in the model'''
cur = self._conn.cursor()
querystr = "SELECT COUNT(*) FROM relationship;"
cur.execute(querystr)
result = cur.fetchone()
return result[0] | python | def size(self):
'''Return the number of links in the model'''
cur = self._conn.cursor()
querystr = "SELECT COUNT(*) FROM relationship;"
cur.execute(querystr)
result = cur.fetchone()
return result[0] | [
"def",
"size",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"querystr",
"=",
"\"SELECT COUNT(*) FROM relationship;\"",
"cur",
".",
"execute",
"(",
"querystr",
")",
"result",
"=",
"cur",
".",
"fetchone",
"(",
")",
"ret... | Return the number of links in the model | [
"Return",
"the",
"number",
"of",
"links",
"in",
"the",
"model"
] | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/driver/postgres.py#L52-L58 | train | Return the number of links in the model |
uogbuji/versa | tools/py/driver/postgres.py | connection._process_db_rows_iter | def _process_db_rows_iter(self, cursor):
'''
Turn the low-level rows from the result of a standard query join
into higher-level statements, yielded iteratively. Note this might lead to
idle transaction errors?
'''
#Be aware of: http://packages.python.org/psycopg2/faq.htm... | python | def _process_db_rows_iter(self, cursor):
'''
Turn the low-level rows from the result of a standard query join
into higher-level statements, yielded iteratively. Note this might lead to
idle transaction errors?
'''
#Be aware of: http://packages.python.org/psycopg2/faq.htm... | [
"def",
"_process_db_rows_iter",
"(",
"self",
",",
"cursor",
")",
":",
"#Be aware of: http://packages.python.org/psycopg2/faq.html#problems-with-transactions-handling",
"#The results will come back grouped by the raw relationship IDs, in order",
"for",
"relid",
",",
"relgroup",
"in",
"g... | Turn the low-level rows from the result of a standard query join
into higher-level statements, yielded iteratively. Note this might lead to
idle transaction errors? | [
"Turn",
"the",
"low",
"-",
"level",
"rows",
"from",
"the",
"result",
"of",
"a",
"standard",
"query",
"join",
"into",
"higher",
"-",
"level",
"statements",
"yielded",
"iteratively",
".",
"Note",
"this",
"might",
"lead",
"to",
"idle",
"transaction",
"errors?"
... | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/driver/postgres.py#L113-L139 | train | Yields the low - level rows from the result of a standard query join
into yielded iteratively. |
uogbuji/versa | tools/py/driver/postgres.py | connection.add | def add(self, origin, rel, target, attrs=None, rid=None):
'''
Add one relationship to the extent
origin - origin of the relationship (similar to an RDF subject)
rel - type IRI of the relationship (similar to an RDF predicate)
target - target of the relationship (similar to an RD... | python | def add(self, origin, rel, target, attrs=None, rid=None):
'''
Add one relationship to the extent
origin - origin of the relationship (similar to an RDF subject)
rel - type IRI of the relationship (similar to an RDF predicate)
target - target of the relationship (similar to an RD... | [
"def",
"add",
"(",
"self",
",",
"origin",
",",
"rel",
",",
"target",
",",
"attrs",
"=",
"None",
",",
"rid",
"=",
"None",
")",
":",
"#FIXME no it doesn't re:",
"#returns an ID (IRI) for the resulting relationship",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor... | Add one relationship to the extent
origin - origin of the relationship (similar to an RDF subject)
rel - type IRI of the relationship (similar to an RDF predicate)
target - target of the relationship (similar to an RDF object), a boolean, floating point or unicode object
attrs - optiona... | [
"Add",
"one",
"relationship",
"to",
"the",
"extent"
] | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/driver/postgres.py#L141-L168 | train | Add one relationship to the extent. |
assamite/creamas | creamas/core/artifact.py | Artifact.add_eval | def add_eval(self, agent, e, fr=None):
"""Add or change agent's evaluation of the artifact with given framing
information.
:param agent: Name of the agent which did the evaluation.
:param float e: Evaluation for the artifact.
:param object fr: Framing information for the evaluat... | python | def add_eval(self, agent, e, fr=None):
"""Add or change agent's evaluation of the artifact with given framing
information.
:param agent: Name of the agent which did the evaluation.
:param float e: Evaluation for the artifact.
:param object fr: Framing information for the evaluat... | [
"def",
"add_eval",
"(",
"self",
",",
"agent",
",",
"e",
",",
"fr",
"=",
"None",
")",
":",
"self",
".",
"_evals",
"[",
"agent",
".",
"name",
"]",
"=",
"e",
"self",
".",
"_framings",
"[",
"agent",
".",
"name",
"]",
"=",
"fr"
] | Add or change agent's evaluation of the artifact with given framing
information.
:param agent: Name of the agent which did the evaluation.
:param float e: Evaluation for the artifact.
:param object fr: Framing information for the evaluation. | [
"Add",
"or",
"change",
"agent",
"s",
"evaluation",
"of",
"the",
"artifact",
"with",
"given",
"framing",
"information",
"."
] | 54dc3e31c97a3f938e58272f8ab80b6bcafeff58 | https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/artifact.py#L63-L72 | train | Add or change agent s evaluation of the artifact with given framing
information. |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container.attach | def attach(self, stdout=True, stderr=True, stream=True, logs=False):
"""
Keeping this simple until we need to extend later.
"""
try:
data = parse_stream(self.client.attach(self.id, stdout, stderr, stream, logs))
except KeyboardInterrupt:
logger.warning(
... | python | def attach(self, stdout=True, stderr=True, stream=True, logs=False):
"""
Keeping this simple until we need to extend later.
"""
try:
data = parse_stream(self.client.attach(self.id, stdout, stderr, stream, logs))
except KeyboardInterrupt:
logger.warning(
... | [
"def",
"attach",
"(",
"self",
",",
"stdout",
"=",
"True",
",",
"stderr",
"=",
"True",
",",
"stream",
"=",
"True",
",",
"logs",
"=",
"False",
")",
":",
"try",
":",
"data",
"=",
"parse_stream",
"(",
"self",
".",
"client",
".",
"attach",
"(",
"self",
... | Keeping this simple until we need to extend later. | [
"Keeping",
"this",
"simple",
"until",
"we",
"need",
"to",
"extend",
"later",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L84-L99 | train | Attaches the current instance to the service container. |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container.start | def start(self, attach=False):
"""
Start a container. If the container is running it will return itself.
returns a running Container.
"""
if self.state()['running']:
logger.info('is already running.', extra={'formatter': 'container', 'container': self.name})
... | python | def start(self, attach=False):
"""
Start a container. If the container is running it will return itself.
returns a running Container.
"""
if self.state()['running']:
logger.info('is already running.', extra={'formatter': 'container', 'container': self.name})
... | [
"def",
"start",
"(",
"self",
",",
"attach",
"=",
"False",
")",
":",
"if",
"self",
".",
"state",
"(",
")",
"[",
"'running'",
"]",
":",
"logger",
".",
"info",
"(",
"'is already running.'",
",",
"extra",
"=",
"{",
"'formatter'",
":",
"'container'",
",",
... | Start a container. If the container is running it will return itself.
returns a running Container. | [
"Start",
"a",
"container",
".",
"If",
"the",
"container",
"is",
"running",
"it",
"will",
"return",
"itself",
"."
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L139-L176 | train | Start a container. |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container.state | def state(self):
"""
{
"State": {
"ExitCode": 0,
"FinishedAt": "2014-10-20T16:45:35.908823764Z",
"Paused": false,
"Pid": 774,
"Restarting": false,
"Running": true,
"StartedAt": "20... | python | def state(self):
"""
{
"State": {
"ExitCode": 0,
"FinishedAt": "2014-10-20T16:45:35.908823764Z",
"Paused": false,
"Pid": 774,
"Restarting": false,
"Running": true,
"StartedAt": "20... | [
"def",
"state",
"(",
"self",
")",
":",
"response",
"=",
"normalize_keys",
"(",
"self",
".",
"client",
".",
"inspect_container",
"(",
"self",
".",
"id",
")",
")",
"return",
"response",
"[",
"'state'",
"]"
] | {
"State": {
"ExitCode": 0,
"FinishedAt": "2014-10-20T16:45:35.908823764Z",
"Paused": false,
"Pid": 774,
"Restarting": false,
"Running": true,
"StartedAt": "2014-10-20T16:47:02.804735752Z"
... | [
"{",
"State",
":",
"{",
"ExitCode",
":",
"0",
"FinishedAt",
":",
"2014",
"-",
"10",
"-",
"20T16",
":",
"45",
":",
"35",
".",
"908823764Z",
"Paused",
":",
"false",
"Pid",
":",
"774",
"Restarting",
":",
"false",
"Running",
":",
"true",
"StartedAt",
":"... | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L196-L211 | train | Get the state of the user. |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container.stop | def stop(self):
"""
stop the container
"""
logger.info('is being stopped', extra={'formatter': 'container', 'container': self.name})
response = self.client.stop(self.id)
while self.state()['running']:
time.sleep(1)
return response | python | def stop(self):
"""
stop the container
"""
logger.info('is being stopped', extra={'formatter': 'container', 'container': self.name})
response = self.client.stop(self.id)
while self.state()['running']:
time.sleep(1)
return response | [
"def",
"stop",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'is being stopped'",
",",
"extra",
"=",
"{",
"'formatter'",
":",
"'container'",
",",
"'container'",
":",
"self",
".",
"name",
"}",
")",
"response",
"=",
"self",
".",
"client",
".",
"sto... | stop the container | [
"stop",
"the",
"container"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L218-L228 | train | stop the container |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container.dump_logs | def dump_logs(self):
"""dump entirety of the container logs to stdout
:returns None
"""
msg = "log dump: \n"
if self._transcribe:
if self._transcribe_queue:
while not self._transcribe_queue.empty():
logs = self._transcribe_queu... | python | def dump_logs(self):
"""dump entirety of the container logs to stdout
:returns None
"""
msg = "log dump: \n"
if self._transcribe:
if self._transcribe_queue:
while not self._transcribe_queue.empty():
logs = self._transcribe_queu... | [
"def",
"dump_logs",
"(",
"self",
")",
":",
"msg",
"=",
"\"log dump: \\n\"",
"if",
"self",
".",
"_transcribe",
":",
"if",
"self",
".",
"_transcribe_queue",
":",
"while",
"not",
"self",
".",
"_transcribe_queue",
".",
"empty",
"(",
")",
":",
"logs",
"=",
"s... | dump entirety of the container logs to stdout
:returns None | [
"dump",
"entirety",
"of",
"the",
"container",
"logs",
"to",
"stdout"
] | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L238-L260 | train | dump all logs of the current instance to stdout |
TUNE-Archive/freight_forwarder | freight_forwarder/container/container.py | Container._find_by_id | def _find_by_id(self, id):
"""
Expected response:
{
"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
"Created": "2013-05-07T14:51:42.041847+02:00",
"Path": "date",
"Args": [],
... | python | def _find_by_id(self, id):
"""
Expected response:
{
"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
"Created": "2013-05-07T14:51:42.041847+02:00",
"Path": "date",
"Args": [],
... | [
"def",
"_find_by_id",
"(",
"self",
",",
"id",
")",
":",
"if",
"not",
"isinstance",
"(",
"id",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'must supply a string as the id'",
")",
"# TODO: We should probably catch container not found error and... | Expected response:
{
"Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
"Created": "2013-05-07T14:51:42.041847+02:00",
"Path": "date",
"Args": [],
"Config": {
... | [
"Expected",
"response",
":",
"{",
"Id",
":",
"4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
"Created",
":",
"2013",
"-",
"05",
"-",
"07T14",
":",
"51",
":",
"42",
".",
"041847",
"+",
"02",
":",
"00",
"Path",
":",
"date",
"Args",
":",
"[]... | 6ea4a49f474ec04abb8bb81b175c774a16b5312f | https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L341-L426 | train | Find a specific instance of a specific ID. |
Kortemme-Lab/klab | klab/google/gauth.py | OAuthCredentials.from_JSON | def from_JSON(oauth_json, type = "service"):
'''At the time of writing, keys include:
client_secret, client_email, redirect_uris (list), client_x509_cert_url, client_id, javascript_origins (list)
auth_provider_x509_cert_url, auth_uri, token_uri.'''
assert(type == "service" or typ... | python | def from_JSON(oauth_json, type = "service"):
'''At the time of writing, keys include:
client_secret, client_email, redirect_uris (list), client_x509_cert_url, client_id, javascript_origins (list)
auth_provider_x509_cert_url, auth_uri, token_uri.'''
assert(type == "service" or typ... | [
"def",
"from_JSON",
"(",
"oauth_json",
",",
"type",
"=",
"\"service\"",
")",
":",
"assert",
"(",
"type",
"==",
"\"service\"",
"or",
"type",
"==",
"\"web\"",
")",
"return",
"NestedBunch",
"(",
"json",
".",
"loads",
"(",
"oauth_json",
")",
"[",
"type",
"]"... | At the time of writing, keys include:
client_secret, client_email, redirect_uris (list), client_x509_cert_url, client_id, javascript_origins (list)
auth_provider_x509_cert_url, auth_uri, token_uri. | [
"At",
"the",
"time",
"of",
"writing",
"keys",
"include",
":",
"client_secret",
"client_email",
"redirect_uris",
"(",
"list",
")",
"client_x509_cert_url",
"client_id",
"javascript_origins",
"(",
"list",
")",
"auth_provider_x509_cert_url",
"auth_uri",
"token_uri",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/google/gauth.py#L16-L21 | train | Create a new instance of the class from a JSON string. |
uw-it-aca/uw-restclients-sws | uw_sws/registration.py | _registrations_for_section_with_active_flag | def _registrations_for_section_with_active_flag(section, is_active,
transcriptable_course=""):
"""
Returns a list of all uw_sws.models.Registration objects
for a section. There can be duplicates for a person.
If is_active is True, the objects will have is_... | python | def _registrations_for_section_with_active_flag(section, is_active,
transcriptable_course=""):
"""
Returns a list of all uw_sws.models.Registration objects
for a section. There can be duplicates for a person.
If is_active is True, the objects will have is_... | [
"def",
"_registrations_for_section_with_active_flag",
"(",
"section",
",",
"is_active",
",",
"transcriptable_course",
"=",
"\"\"",
")",
":",
"instructor_reg_id",
"=",
"\"\"",
"if",
"(",
"section",
".",
"is_independent_study",
"and",
"section",
".",
"independent_study_in... | Returns a list of all uw_sws.models.Registration objects
for a section. There can be duplicates for a person.
If is_active is True, the objects will have is_active set to True.
Otherwise, is_active is undefined, and out of scope for this method. | [
"Returns",
"a",
"list",
"of",
"all",
"uw_sws",
".",
"models",
".",
"Registration",
"objects",
"for",
"a",
"section",
".",
"There",
"can",
"be",
"duplicates",
"for",
"a",
"person",
".",
"If",
"is_active",
"is",
"True",
"the",
"objects",
"will",
"have",
"i... | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/registration.py#L40-L69 | train | Returns a list of all registrations for a section with the given is_active flag. |
uw-it-aca/uw-restclients-sws | uw_sws/registration.py | _json_to_registrations | def _json_to_registrations(data, section):
"""
Returns a list of all uw_sws.models.Registration objects
"""
registrations = []
person_threads = {}
for reg_data in data.get("Registrations", []):
registration = Registration()
registration.section = section
registration.is_a... | python | def _json_to_registrations(data, section):
"""
Returns a list of all uw_sws.models.Registration objects
"""
registrations = []
person_threads = {}
for reg_data in data.get("Registrations", []):
registration = Registration()
registration.section = section
registration.is_a... | [
"def",
"_json_to_registrations",
"(",
"data",
",",
"section",
")",
":",
"registrations",
"=",
"[",
"]",
"person_threads",
"=",
"{",
"}",
"for",
"reg_data",
"in",
"data",
".",
"get",
"(",
"\"Registrations\"",
",",
"[",
"]",
")",
":",
"registration",
"=",
... | Returns a list of all uw_sws.models.Registration objects | [
"Returns",
"a",
"list",
"of",
"all",
"uw_sws",
".",
"models",
".",
"Registration",
"objects"
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/registration.py#L72-L114 | train | Convert JSON data to list of uw_sws. models. Registration objects. |
uw-it-aca/uw-restclients-sws | uw_sws/registration.py | get_credits_by_section_and_regid | def get_credits_by_section_and_regid(section, regid):
"""
Returns a uw_sws.models.Registration object
for the section and regid passed in.
"""
deprecation("Use get_credits_by_reg_url")
# note trailing comma in URL, it's required for the optional dup_code param
url = "{}{},{},{},{},{},{},.jso... | python | def get_credits_by_section_and_regid(section, regid):
"""
Returns a uw_sws.models.Registration object
for the section and regid passed in.
"""
deprecation("Use get_credits_by_reg_url")
# note trailing comma in URL, it's required for the optional dup_code param
url = "{}{},{},{},{},{},{},.jso... | [
"def",
"get_credits_by_section_and_regid",
"(",
"section",
",",
"regid",
")",
":",
"deprecation",
"(",
"\"Use get_credits_by_reg_url\"",
")",
"# note trailing comma in URL, it's required for the optional dup_code param",
"url",
"=",
"\"{}{},{},{},{},{},{},.json\"",
".",
"format",
... | Returns a uw_sws.models.Registration object
for the section and regid passed in. | [
"Returns",
"a",
"uw_sws",
".",
"models",
".",
"Registration",
"object",
"for",
"the",
"section",
"and",
"regid",
"passed",
"in",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/registration.py#L141-L163 | train | Get the credits for a given section and regid. |
uw-it-aca/uw-restclients-sws | uw_sws/registration.py | get_schedule_by_regid_and_term | def get_schedule_by_regid_and_term(regid, term,
non_time_schedule_instructors=True,
per_section_prefetch_callback=None,
transcriptable_course="", **kwargs):
"""
Returns a uw_sws.models.ClassSchedule object
... | python | def get_schedule_by_regid_and_term(regid, term,
non_time_schedule_instructors=True,
per_section_prefetch_callback=None,
transcriptable_course="", **kwargs):
"""
Returns a uw_sws.models.ClassSchedule object
... | [
"def",
"get_schedule_by_regid_and_term",
"(",
"regid",
",",
"term",
",",
"non_time_schedule_instructors",
"=",
"True",
",",
"per_section_prefetch_callback",
"=",
"None",
",",
"transcriptable_course",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"include_i... | Returns a uw_sws.models.ClassSchedule object
for the regid and term passed in. | [
"Returns",
"a",
"uw_sws",
".",
"models",
".",
"ClassSchedule",
"object",
"for",
"the",
"regid",
"and",
"term",
"passed",
"in",
"."
] | 4d36776dcca36855fc15c1b8fe7650ae045194cf | https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/registration.py#L178-L207 | train | Get the class schedule for the regid and term passed in. |
clement-alexandre/TotemBionet | totembionet/src/discrete_model/discrete_model.py | DiscreteModel.find_transition | def find_transition(self, gene: Gene, multiplexes: Tuple[Multiplex, ...]) -> Transition:
"""
Find and return a transition in the model for the given gene and multiplexes.
Raise an AttributeError if there is no multiplex in the graph with the given name.
"""
multiplexes = tuple(m... | python | def find_transition(self, gene: Gene, multiplexes: Tuple[Multiplex, ...]) -> Transition:
"""
Find and return a transition in the model for the given gene and multiplexes.
Raise an AttributeError if there is no multiplex in the graph with the given name.
"""
multiplexes = tuple(m... | [
"def",
"find_transition",
"(",
"self",
",",
"gene",
":",
"Gene",
",",
"multiplexes",
":",
"Tuple",
"[",
"Multiplex",
",",
"...",
"]",
")",
"->",
"Transition",
":",
"multiplexes",
"=",
"tuple",
"(",
"multiplex",
"for",
"multiplex",
"in",
"multiplexes",
"if"... | Find and return a transition in the model for the given gene and multiplexes.
Raise an AttributeError if there is no multiplex in the graph with the given name. | [
"Find",
"and",
"return",
"a",
"transition",
"in",
"the",
"model",
"for",
"the",
"given",
"gene",
"and",
"multiplexes",
".",
"Raise",
"an",
"AttributeError",
"if",
"there",
"is",
"no",
"multiplex",
"in",
"the",
"graph",
"with",
"the",
"given",
"name",
"."
] | f37a2f9358c1ce49f21c4a868b904da5dcd4614f | https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/discrete_model.py#L43-L52 | train | Find and return a transition in the model for the given gene and multiplexes. Raise an AttributeError if there is no transition in the model for the given gene and multiplexes. |
clement-alexandre/TotemBionet | totembionet/src/discrete_model/discrete_model.py | DiscreteModel.available_state | def available_state(self, state: State) -> Tuple[State, ...]:
""" Return the state reachable from a given state. """
result = []
for gene in self.genes:
result.extend(self.available_state_for_gene(gene, state))
if len(result) > 1 and state in result:
result.remove... | python | def available_state(self, state: State) -> Tuple[State, ...]:
""" Return the state reachable from a given state. """
result = []
for gene in self.genes:
result.extend(self.available_state_for_gene(gene, state))
if len(result) > 1 and state in result:
result.remove... | [
"def",
"available_state",
"(",
"self",
",",
"state",
":",
"State",
")",
"->",
"Tuple",
"[",
"State",
",",
"...",
"]",
":",
"result",
"=",
"[",
"]",
"for",
"gene",
"in",
"self",
".",
"genes",
":",
"result",
".",
"extend",
"(",
"self",
".",
"availabl... | Return the state reachable from a given state. | [
"Return",
"the",
"state",
"reachable",
"from",
"a",
"given",
"state",
"."
] | f37a2f9358c1ce49f21c4a868b904da5dcd4614f | https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/discrete_model.py#L54-L61 | train | Return the available state for a given state. |
clement-alexandre/TotemBionet | totembionet/src/discrete_model/discrete_model.py | DiscreteModel.available_state_for_gene | def available_state_for_gene(self, gene: Gene, state: State) -> Tuple[State, ...]:
""" Return the state reachable from a given state for a particular gene. """
result: List[State] = []
active_multiplex: Tuple[Multiplex] = gene.active_multiplex(state)
transition: Transition = self.find_tr... | python | def available_state_for_gene(self, gene: Gene, state: State) -> Tuple[State, ...]:
""" Return the state reachable from a given state for a particular gene. """
result: List[State] = []
active_multiplex: Tuple[Multiplex] = gene.active_multiplex(state)
transition: Transition = self.find_tr... | [
"def",
"available_state_for_gene",
"(",
"self",
",",
"gene",
":",
"Gene",
",",
"state",
":",
"State",
")",
"->",
"Tuple",
"[",
"State",
",",
"...",
"]",
":",
"result",
":",
"List",
"[",
"State",
"]",
"=",
"[",
"]",
"active_multiplex",
":",
"Tuple",
"... | Return the state reachable from a given state for a particular gene. | [
"Return",
"the",
"state",
"reachable",
"from",
"a",
"given",
"state",
"for",
"a",
"particular",
"gene",
"."
] | f37a2f9358c1ce49f21c4a868b904da5dcd4614f | https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/discrete_model.py#L63-L77 | train | Return the state reachable from a given state for a particular gene. |
clement-alexandre/TotemBionet | totembionet/src/discrete_model/discrete_model.py | DiscreteModel._state_after_transition | def _state_after_transition(self, current_state: int, target_state: int) -> int:
"""
Return the state reachable after a transition.
Since the state for a gene can only change by 1, if the absolute value of the
difference current_state - target_state is greater than 1, we lower it to 1 or... | python | def _state_after_transition(self, current_state: int, target_state: int) -> int:
"""
Return the state reachable after a transition.
Since the state for a gene can only change by 1, if the absolute value of the
difference current_state - target_state is greater than 1, we lower it to 1 or... | [
"def",
"_state_after_transition",
"(",
"self",
",",
"current_state",
":",
"int",
",",
"target_state",
":",
"int",
")",
"->",
"int",
":",
"return",
"current_state",
"+",
"(",
"current_state",
"<",
"target_state",
")",
"-",
"(",
"current_state",
">",
"target_sta... | Return the state reachable after a transition.
Since the state for a gene can only change by 1, if the absolute value of the
difference current_state - target_state is greater than 1, we lower it to 1 or -1.
Examples
--------
>>> model._state_after_transition(0, 2)
... | [
"Return",
"the",
"state",
"reachable",
"after",
"a",
"transition",
".",
"Since",
"the",
"state",
"for",
"a",
"gene",
"can",
"only",
"change",
"by",
"1",
"if",
"the",
"absolute",
"value",
"of",
"the",
"difference",
"current_state",
"-",
"target_state",
"is",
... | f37a2f9358c1ce49f21c4a868b904da5dcd4614f | https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/discrete_model.py#L79-L98 | train | Return the state after a transition. |
Kortemme-Lab/klab | klab/biblio/pubmed.py | convert | def convert(ids, from_type):
'''Uses the NCBI IP Converter API to converts a list of publication IDs in the same format e.g. DOI identifiers to
another format e.g. PubMed identifiers.
ids is a list of IDs of the type from_type e.g. a from_type of 'doi' specifies DOI identifiers.
The function ret... | python | def convert(ids, from_type):
'''Uses the NCBI IP Converter API to converts a list of publication IDs in the same format e.g. DOI identifiers to
another format e.g. PubMed identifiers.
ids is a list of IDs of the type from_type e.g. a from_type of 'doi' specifies DOI identifiers.
The function ret... | [
"def",
"convert",
"(",
"ids",
",",
"from_type",
")",
":",
"if",
"from_type",
"not",
"in",
"converter_types",
":",
"raise",
"PubMedConverterTypeException",
"(",
"from_type",
")",
"# Avoid multiple requests of the same ID",
"mapping",
"=",
"{",
"}",
"ids",
"=",
"lis... | Uses the NCBI IP Converter API to converts a list of publication IDs in the same format e.g. DOI identifiers to
another format e.g. PubMed identifiers.
ids is a list of IDs of the type from_type e.g. a from_type of 'doi' specifies DOI identifiers.
The function returns a Python dict with the mappings... | [
"Uses",
"the",
"NCBI",
"IP",
"Converter",
"API",
"to",
"converts",
"a",
"list",
"of",
"publication",
"IDs",
"in",
"the",
"same",
"format",
"e",
".",
"g",
".",
"DOI",
"identifiers",
"to",
"another",
"format",
"e",
".",
"g",
".",
"PubMed",
"identifiers",
... | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/biblio/pubmed.py#L43-L86 | train | Uses the NCBI IP Converter API to convert a list of publication IDs to a list of publication IDs of the specified type from_type e. g. DOI identifiers to PubMed identifiers. |
Kortemme-Lab/klab | klab/biblio/pubmed.py | convert_single | def convert_single(ID, from_type, to_type):
'''Convenience function wrapper for convert. Takes a single ID and converts it from from_type to to_type.
The return value is the ID in the scheme of to_type.'''
if from_type not in converter_types:
raise PubMedConverterTypeException(from_type)
if ... | python | def convert_single(ID, from_type, to_type):
'''Convenience function wrapper for convert. Takes a single ID and converts it from from_type to to_type.
The return value is the ID in the scheme of to_type.'''
if from_type not in converter_types:
raise PubMedConverterTypeException(from_type)
if ... | [
"def",
"convert_single",
"(",
"ID",
",",
"from_type",
",",
"to_type",
")",
":",
"if",
"from_type",
"not",
"in",
"converter_types",
":",
"raise",
"PubMedConverterTypeException",
"(",
"from_type",
")",
"if",
"to_type",
"not",
"in",
"converter_types",
":",
"raise",... | Convenience function wrapper for convert. Takes a single ID and converts it from from_type to to_type.
The return value is the ID in the scheme of to_type. | [
"Convenience",
"function",
"wrapper",
"for",
"convert",
".",
"Takes",
"a",
"single",
"ID",
"and",
"converts",
"it",
"from",
"from_type",
"to",
"to_type",
".",
"The",
"return",
"value",
"is",
"the",
"ID",
"in",
"the",
"scheme",
"of",
"to_type",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/biblio/pubmed.py#L89-L102 | train | Convenience function wrapper for convert. Takes a single ID and converts it from from_type to to_type. Returns the value of to_type. |
projectshift/shift-boiler | boiler/user/validators.py | UniqueUserProperty.validate | def validate(self, value, model=None, context=None):
""" Perform validation """
from boiler.user.services import user_service
self_id = None
if model:
if isinstance(model, dict):
self_id = model.get('id')
else:
self_id = getattr(mo... | python | def validate(self, value, model=None, context=None):
""" Perform validation """
from boiler.user.services import user_service
self_id = None
if model:
if isinstance(model, dict):
self_id = model.get('id')
else:
self_id = getattr(mo... | [
"def",
"validate",
"(",
"self",
",",
"value",
",",
"model",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"from",
"boiler",
".",
"user",
".",
"services",
"import",
"user_service",
"self_id",
"=",
"None",
"if",
"model",
":",
"if",
"isinstance",
"(... | Perform validation | [
"Perform",
"validation"
] | 8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b | https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/validators.py#L9-L26 | train | Validate the value of the attribute. |
projectshift/shift-boiler | boiler/user/validators.py | UniqueRoleHandle.validate | def validate(self, value, model=None, context=None):
""" Perform validation """
from boiler.user.services import role_service
self_id = None
if model:
if isinstance(model, dict):
self_id = model.get('id')
else:
self_id = getattr(mo... | python | def validate(self, value, model=None, context=None):
""" Perform validation """
from boiler.user.services import role_service
self_id = None
if model:
if isinstance(model, dict):
self_id = model.get('id')
else:
self_id = getattr(mo... | [
"def",
"validate",
"(",
"self",
",",
"value",
",",
"model",
"=",
"None",
",",
"context",
"=",
"None",
")",
":",
"from",
"boiler",
".",
"user",
".",
"services",
"import",
"role_service",
"self_id",
"=",
"None",
"if",
"model",
":",
"if",
"isinstance",
"(... | Perform validation | [
"Perform",
"validation"
] | 8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b | https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/user/validators.py#L39-L54 | train | Validate the handle value. |
PBR/MQ2 | MQ2/mq2.py | _get_arguments | def _get_arguments(): # pragma: no cover
""" Handle the command line arguments given to this program """
LOG.debug('Parse command line argument')
parser = argparse.ArgumentParser(
description='Command line interface for the MQ² program')
parser.add_argument(
'-z', '--zipfile', dest='in... | python | def _get_arguments(): # pragma: no cover
""" Handle the command line arguments given to this program """
LOG.debug('Parse command line argument')
parser = argparse.ArgumentParser(
description='Command line interface for the MQ² program')
parser.add_argument(
'-z', '--zipfile', dest='in... | [
"def",
"_get_arguments",
"(",
")",
":",
"# pragma: no cover",
"LOG",
".",
"debug",
"(",
"'Parse command line argument'",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Command line interface for the MQ² program')",
"",
"parser",
".",
... | Handle the command line arguments given to this program | [
"Handle",
"the",
"command",
"line",
"arguments",
"given",
"to",
"this",
"program"
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L58-L92 | train | Handle the command line arguments given to this program. |
PBR/MQ2 | MQ2/mq2.py | cli_main | def cli_main(): # pragma: no cover
""" Main function when running from CLI. """
if '--debug' in sys.argv:
LOG.setLevel(logging.DEBUG)
elif '--verbose' in sys.argv:
LOG.setLevel(logging.INFO)
args = _get_arguments()
try:
plugin, folder = get_plugin_and_folder(
in... | python | def cli_main(): # pragma: no cover
""" Main function when running from CLI. """
if '--debug' in sys.argv:
LOG.setLevel(logging.DEBUG)
elif '--verbose' in sys.argv:
LOG.setLevel(logging.INFO)
args = _get_arguments()
try:
plugin, folder = get_plugin_and_folder(
in... | [
"def",
"cli_main",
"(",
")",
":",
"# pragma: no cover",
"if",
"'--debug'",
"in",
"sys",
".",
"argv",
":",
"LOG",
".",
"setLevel",
"(",
"logging",
".",
"DEBUG",
")",
"elif",
"'--verbose'",
"in",
"sys",
".",
"argv",
":",
"LOG",
".",
"setLevel",
"(",
"log... | Main function when running from CLI. | [
"Main",
"function",
"when",
"running",
"from",
"CLI",
"."
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L95-L114 | train | Main function when running from CLI. |
PBR/MQ2 | MQ2/mq2.py | get_plugin_and_folder | def get_plugin_and_folder(inputzip=None, inputdir=None, inputfile=None):
""" Main function. """
if (inputzip and inputdir) \
or (inputzip and inputfile) \
or (inputdir and inputfile):
raise MQ2Exception('You must provide either a zip file or a '
'direc... | python | def get_plugin_and_folder(inputzip=None, inputdir=None, inputfile=None):
""" Main function. """
if (inputzip and inputdir) \
or (inputzip and inputfile) \
or (inputdir and inputfile):
raise MQ2Exception('You must provide either a zip file or a '
'direc... | [
"def",
"get_plugin_and_folder",
"(",
"inputzip",
"=",
"None",
",",
"inputdir",
"=",
"None",
",",
"inputfile",
"=",
"None",
")",
":",
"if",
"(",
"inputzip",
"and",
"inputdir",
")",
"or",
"(",
"inputzip",
"and",
"inputfile",
")",
"or",
"(",
"inputdir",
"an... | Main function. | [
"Main",
"function",
"."
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L117-L164 | train | This function returns the plugin and folder for the current node. |
PBR/MQ2 | MQ2/mq2.py | run_mq2 | def run_mq2(plugin, folder, lod_threshold=None, session=None,
outputfolder=None):
""" Run the plugin. """
qtls_file = 'qtls.csv'
matrix_file = 'qtls_matrix.csv'
map_file = 'map.csv'
map_qtl_file = 'map_with_qtls.csv'
qtls_mk_file = 'qtls_with_mk.csv'
map_chart_file = 'MapChart.m... | python | def run_mq2(plugin, folder, lod_threshold=None, session=None,
outputfolder=None):
""" Run the plugin. """
qtls_file = 'qtls.csv'
matrix_file = 'qtls_matrix.csv'
map_file = 'map.csv'
map_qtl_file = 'map_with_qtls.csv'
qtls_mk_file = 'qtls_with_mk.csv'
map_chart_file = 'MapChart.m... | [
"def",
"run_mq2",
"(",
"plugin",
",",
"folder",
",",
"lod_threshold",
"=",
"None",
",",
"session",
"=",
"None",
",",
"outputfolder",
"=",
"None",
")",
":",
"qtls_file",
"=",
"'qtls.csv'",
"matrix_file",
"=",
"'qtls_matrix.csv'",
"map_file",
"=",
"'map.csv'",
... | Run the plugin. | [
"Run",
"the",
"plugin",
"."
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L167-L218 | train | Run the MQ2 plugin. |
PBR/MQ2 | MQ2/mq2.py | _append_count_to_matrix | def _append_count_to_matrix(qtl_matrixfile, lod_threshold):
""" Append an extra column at the end of the matrix file containing
for each row (marker) the number of QTL found if the marker is known
ie: Locus != ''
:arg qtl_matrix, the matrix in which to save the output.
:arg threshold, threshold use... | python | def _append_count_to_matrix(qtl_matrixfile, lod_threshold):
""" Append an extra column at the end of the matrix file containing
for each row (marker) the number of QTL found if the marker is known
ie: Locus != ''
:arg qtl_matrix, the matrix in which to save the output.
:arg threshold, threshold use... | [
"def",
"_append_count_to_matrix",
"(",
"qtl_matrixfile",
",",
"lod_threshold",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"qtl_matrixfile",
")",
":",
"# pragma: no cover",
"raise",
"MQ2Exception",
"(",
"'File not found: \"%s\"'",
"%",
"qtl_matrixf... | Append an extra column at the end of the matrix file containing
for each row (marker) the number of QTL found if the marker is known
ie: Locus != ''
:arg qtl_matrix, the matrix in which to save the output.
:arg threshold, threshold used to determine if a given LOD value is
reflective the presen... | [
"Append",
"an",
"extra",
"column",
"at",
"the",
"end",
"of",
"the",
"matrix",
"file",
"containing",
"for",
"each",
"row",
"(",
"marker",
")",
"the",
"number",
"of",
"QTL",
"found",
"if",
"the",
"marker",
"is",
"known",
"ie",
":",
"Locus",
"!",
"="
] | 6d84dea47e6751333004743f588f03158e35c28d | https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L221-L247 | train | Append an extra column to the matrix file containing the number of QTLs found if the marker is known by the given LOD value. |
ronhanson/python-tbx | tbx/service.py | Service.loop | def loop(self):
"""
Run the demo suite in a loop.
"""
logging.info("Running %s in loop mode." % self.service_name)
res = None
while True:
try:
res = self.run()
time.sleep(self.loop_duration)
except KeyboardInterrupt... | python | def loop(self):
"""
Run the demo suite in a loop.
"""
logging.info("Running %s in loop mode." % self.service_name)
res = None
while True:
try:
res = self.run()
time.sleep(self.loop_duration)
except KeyboardInterrupt... | [
"def",
"loop",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"Running %s in loop mode.\"",
"%",
"self",
".",
"service_name",
")",
"res",
"=",
"None",
"while",
"True",
":",
"try",
":",
"res",
"=",
"self",
".",
"run",
"(",
")",
"time",
".",
"sl... | Run the demo suite in a loop. | [
"Run",
"the",
"demo",
"suite",
"in",
"a",
"loop",
"."
] | 87f72ae0cadecafbcd144f1e930181fba77f6b83 | https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/service.py#L70-L87 | train | Main loop for the demo suite. |
uogbuji/versa | tools/py/writer/rdf.py | prep | def prep(s, p, o):
'''
Prepare a triple for rdflib
'''
def bnode_check(r):
return isinstance(r, mock_bnode) or r.startswith('VERSABLANKNODE_')
s = BNode() if bnode_check(s) else URIRef(s)
p = URIRef(p)
o = BNode() if bnode_check(o) else (URIRef(o) if isinstance(o, I) else Literal(o)... | python | def prep(s, p, o):
'''
Prepare a triple for rdflib
'''
def bnode_check(r):
return isinstance(r, mock_bnode) or r.startswith('VERSABLANKNODE_')
s = BNode() if bnode_check(s) else URIRef(s)
p = URIRef(p)
o = BNode() if bnode_check(o) else (URIRef(o) if isinstance(o, I) else Literal(o)... | [
"def",
"prep",
"(",
"s",
",",
"p",
",",
"o",
")",
":",
"def",
"bnode_check",
"(",
"r",
")",
":",
"return",
"isinstance",
"(",
"r",
",",
"mock_bnode",
")",
"or",
"r",
".",
"startswith",
"(",
"'VERSABLANKNODE_'",
")",
"s",
"=",
"BNode",
"(",
")",
"... | Prepare a triple for rdflib | [
"Prepare",
"a",
"triple",
"for",
"rdflib"
] | f092ffc7ed363a5b170890955168500f32de0dd5 | https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/writer/rdf.py#L44-L54 | train | Prepare a triple for rdflib
|
adaptive-learning/proso-apps | proso_common/json_enrich.py | url | def url(request, json_list, nested, url_name='show_{}', ignore_get=None):
"""
Enrich the given list of objects, so they have URL.
Args:
request (django.http.request.HttpRequest): request which is currently processed
json_list (list): list of dicts (JSON objects to be enriched)
url_n... | python | def url(request, json_list, nested, url_name='show_{}', ignore_get=None):
"""
Enrich the given list of objects, so they have URL.
Args:
request (django.http.request.HttpRequest): request which is currently processed
json_list (list): list of dicts (JSON objects to be enriched)
url_n... | [
"def",
"url",
"(",
"request",
",",
"json_list",
",",
"nested",
",",
"url_name",
"=",
"'show_{}'",
",",
"ignore_get",
"=",
"None",
")",
":",
"if",
"not",
"ignore_get",
":",
"ignore_get",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"url_name",
",",
"str",
")... | Enrich the given list of objects, so they have URL.
Args:
request (django.http.request.HttpRequest): request which is currently processed
json_list (list): list of dicts (JSON objects to be enriched)
url_name (str|fun): pattern to create a url name taking object_type
ignore_get (lis... | [
"Enrich",
"the",
"given",
"list",
"of",
"objects",
"so",
"they",
"have",
"URL",
"."
] | 8278c72e498d6ef8d392cc47b48473f4ec037142 | https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_common/json_enrich.py#L13-L50 | train | Enrich the given list of objects so they have URL. |
clement-alexandre/TotemBionet | totembionet/src/discrete_model/state.py | State.sub_state_by_gene_name | def sub_state_by_gene_name(self, *gene_names: str) -> 'State':
"""
Create a sub state with only the gene passed in arguments.
Example
-------
>>> state.sub_state_by_gene_name('operon')
{operon: 2}
>>> state.sub_state_by_gene_name('mucuB')
{mucuB: 0}
... | python | def sub_state_by_gene_name(self, *gene_names: str) -> 'State':
"""
Create a sub state with only the gene passed in arguments.
Example
-------
>>> state.sub_state_by_gene_name('operon')
{operon: 2}
>>> state.sub_state_by_gene_name('mucuB')
{mucuB: 0}
... | [
"def",
"sub_state_by_gene_name",
"(",
"self",
",",
"*",
"gene_names",
":",
"str",
")",
"->",
"'State'",
":",
"return",
"State",
"(",
"{",
"gene",
":",
"state",
"for",
"gene",
",",
"state",
"in",
"self",
".",
"items",
"(",
")",
"if",
"gene",
".",
"nam... | Create a sub state with only the gene passed in arguments.
Example
-------
>>> state.sub_state_by_gene_name('operon')
{operon: 2}
>>> state.sub_state_by_gene_name('mucuB')
{mucuB: 0} | [
"Create",
"a",
"sub",
"state",
"with",
"only",
"the",
"gene",
"passed",
"in",
"arguments",
"."
] | f37a2f9358c1ce49f21c4a868b904da5dcd4614f | https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/state.py#L41-L54 | train | Create a sub state with only the gene passed in names. |
peergradeio/flask-mongo-profiler | flask_mongo_profiler/utils.py | combine_events_to_queries | def combine_events_to_queries(_mongo_events):
"""Combines pymongo.monitoring events to queries.
CommandStartedEvent has queries information.
CommandSuccessfulEvent has timing information.
Iterate over events and map against mongo's request_id (the query).
"""
queries = {} # map on the request... | python | def combine_events_to_queries(_mongo_events):
"""Combines pymongo.monitoring events to queries.
CommandStartedEvent has queries information.
CommandSuccessfulEvent has timing information.
Iterate over events and map against mongo's request_id (the query).
"""
queries = {} # map on the request... | [
"def",
"combine_events_to_queries",
"(",
"_mongo_events",
")",
":",
"queries",
"=",
"{",
"}",
"# map on the request_id",
"for",
"event",
"in",
"_mongo_events",
":",
"if",
"event",
".",
"request_id",
"not",
"in",
"queries",
":",
"try",
":",
"connection",
"=",
"... | Combines pymongo.monitoring events to queries.
CommandStartedEvent has queries information.
CommandSuccessfulEvent has timing information.
Iterate over events and map against mongo's request_id (the query). | [
"Combines",
"pymongo",
".",
"monitoring",
"events",
"to",
"queries",
"."
] | a267eeb49fea07c9a24fb370bd9d7a90ed313ccf | https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/utils.py#L60-L96 | train | Combines pymongo. monitoring events to queries. |
brunato/lograptor | lograptor/api.py | create_argument_parser | def create_argument_parser():
"""
Command line options and arguments parsing. This function return
a list of options and the list of arguments (pattern, filenames).
"""
parser = argparse.ArgumentParser(prog='lograptor', description=__description__, add_help=False)
parser.usage = """%(prog)s [opt... | python | def create_argument_parser():
"""
Command line options and arguments parsing. This function return
a list of options and the list of arguments (pattern, filenames).
"""
parser = argparse.ArgumentParser(prog='lograptor', description=__description__, add_help=False)
parser.usage = """%(prog)s [opt... | [
"def",
"create_argument_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"'lograptor'",
",",
"description",
"=",
"__description__",
",",
"add_help",
"=",
"False",
")",
"parser",
".",
"usage",
"=",
"\"\"\"%(prog)s [optio... | Command line options and arguments parsing. This function return
a list of options and the list of arguments (pattern, filenames). | [
"Command",
"line",
"options",
"and",
"arguments",
"parsing",
".",
"This",
"function",
"return",
"a",
"list",
"of",
"options",
"and",
"the",
"list",
"of",
"arguments",
"(",
"pattern",
"filenames",
")",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/api.py#L116-L330 | train | Create an argument parser for the lograptor command line options and arguments parsing. |
brunato/lograptor | lograptor/api.py | has_void_args | def has_void_args(argv):
"""
Check if the command line has no arguments or only the --conf optional argument.
"""
n_args = len(argv)
return n_args == 1 or n_args == 2 and argv[1].startswith('--conf=') or n_args == 3 and argv[1] == '--conf' | python | def has_void_args(argv):
"""
Check if the command line has no arguments or only the --conf optional argument.
"""
n_args = len(argv)
return n_args == 1 or n_args == 2 and argv[1].startswith('--conf=') or n_args == 3 and argv[1] == '--conf' | [
"def",
"has_void_args",
"(",
"argv",
")",
":",
"n_args",
"=",
"len",
"(",
"argv",
")",
"return",
"n_args",
"==",
"1",
"or",
"n_args",
"==",
"2",
"and",
"argv",
"[",
"1",
"]",
".",
"startswith",
"(",
"'--conf='",
")",
"or",
"n_args",
"==",
"3",
"and... | Check if the command line has no arguments or only the --conf optional argument. | [
"Check",
"if",
"the",
"command",
"line",
"has",
"no",
"arguments",
"or",
"only",
"the",
"--",
"conf",
"optional",
"argument",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/api.py#L333-L338 | train | Check if the command line has void arguments. |
brunato/lograptor | lograptor/api.py | lograptor | def lograptor(files, patterns=None, matcher='ruled', cfgfiles=None, apps=None, hosts=None,
filters=None, time_period=None, time_range=None, case=False, invert=False,
word=False, files_with_match=None, count=False, quiet=False, max_count=0,
only_matching=False, line_number=False... | python | def lograptor(files, patterns=None, matcher='ruled', cfgfiles=None, apps=None, hosts=None,
filters=None, time_period=None, time_range=None, case=False, invert=False,
word=False, files_with_match=None, count=False, quiet=False, max_count=0,
only_matching=False, line_number=False... | [
"def",
"lograptor",
"(",
"files",
",",
"patterns",
"=",
"None",
",",
"matcher",
"=",
"'ruled'",
",",
"cfgfiles",
"=",
"None",
",",
"apps",
"=",
"None",
",",
"hosts",
"=",
"None",
",",
"filters",
"=",
"None",
",",
"time_period",
"=",
"None",
",",
"tim... | Run lograptor with arguments. Experimental feature to use the log processor into
generic Python scripts. This part is still under development, do not use.
:param files: Input files. Each argument can be a file path or a glob pathname.
:param patterns: Regex patterns, select the log line if at least one pat... | [
"Run",
"lograptor",
"with",
"arguments",
".",
"Experimental",
"feature",
"to",
"use",
"the",
"log",
"processor",
"into",
"generic",
"Python",
"scripts",
".",
"This",
"part",
"is",
"still",
"under",
"development",
"do",
"not",
"use",
"."
] | b1f09fe1b429ed15110610092704ef12d253f3c9 | https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/api.py#L341-L413 | train | Log Processor with arguments. |
46elks/elkme | elkme/config.py | generate_config | def generate_config(conf):
"""
Generates a configuration file using the ConfigParser library that
can be saved to a file for subsequent reads
"""
c = {}
def to_key(key, default):
if conf.get(key):
c[key] = '{} = {}'.format(key, conf.get(key))
else:
c[key]... | python | def generate_config(conf):
"""
Generates a configuration file using the ConfigParser library that
can be saved to a file for subsequent reads
"""
c = {}
def to_key(key, default):
if conf.get(key):
c[key] = '{} = {}'.format(key, conf.get(key))
else:
c[key]... | [
"def",
"generate_config",
"(",
"conf",
")",
":",
"c",
"=",
"{",
"}",
"def",
"to_key",
"(",
"key",
",",
"default",
")",
":",
"if",
"conf",
".",
"get",
"(",
"key",
")",
":",
"c",
"[",
"key",
"]",
"=",
"'{} = {}'",
".",
"format",
"(",
"key",
",",
... | Generates a configuration file using the ConfigParser library that
can be saved to a file for subsequent reads | [
"Generates",
"a",
"configuration",
"file",
"using",
"the",
"ConfigParser",
"library",
"that",
"can",
"be",
"saved",
"to",
"a",
"file",
"for",
"subsequent",
"reads"
] | 6ebdce6f8ac852fc6f714d1f1b836f2777fece4e | https://github.com/46elks/elkme/blob/6ebdce6f8ac852fc6f714d1f1b836f2777fece4e/elkme/config.py#L144-L161 | train | Generates a configuration file for the next read read |
Kortemme-Lab/klab | klab/bio/rcsb.py | retrieve_file_from_RCSB | def retrieve_file_from_RCSB(http_connection, resource, silent = True):
'''Retrieve a file from the RCSB.'''
if not silent:
colortext.printf("Retrieving %s from RCSB" % os.path.split(resource)[1], color = "aqua")
return http_connection.get(resource) | python | def retrieve_file_from_RCSB(http_connection, resource, silent = True):
'''Retrieve a file from the RCSB.'''
if not silent:
colortext.printf("Retrieving %s from RCSB" % os.path.split(resource)[1], color = "aqua")
return http_connection.get(resource) | [
"def",
"retrieve_file_from_RCSB",
"(",
"http_connection",
",",
"resource",
",",
"silent",
"=",
"True",
")",
":",
"if",
"not",
"silent",
":",
"colortext",
".",
"printf",
"(",
"\"Retrieving %s from RCSB\"",
"%",
"os",
".",
"path",
".",
"split",
"(",
"resource",
... | Retrieve a file from the RCSB. | [
"Retrieve",
"a",
"file",
"from",
"the",
"RCSB",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/rcsb.py#L41-L45 | train | Retrieve a file from the RCSB. |
Kortemme-Lab/klab | klab/bio/rcsb.py | retrieve_xml | def retrieve_xml(pdb_id, silent = True):
'''The RCSB website now compresses XML files.'''
xml_gz = retrieve_file_from_RCSB(get_rcsb_files_connection(), "/download/%s.xml.gz" % pdb_id, silent = silent)
cf = StringIO.StringIO()
cf.write(xml_gz)
cf.seek(0)
df = gzip.GzipFile(fileobj = cf, mode='rb'... | python | def retrieve_xml(pdb_id, silent = True):
'''The RCSB website now compresses XML files.'''
xml_gz = retrieve_file_from_RCSB(get_rcsb_files_connection(), "/download/%s.xml.gz" % pdb_id, silent = silent)
cf = StringIO.StringIO()
cf.write(xml_gz)
cf.seek(0)
df = gzip.GzipFile(fileobj = cf, mode='rb'... | [
"def",
"retrieve_xml",
"(",
"pdb_id",
",",
"silent",
"=",
"True",
")",
":",
"xml_gz",
"=",
"retrieve_file_from_RCSB",
"(",
"get_rcsb_files_connection",
"(",
")",
",",
"\"/download/%s.xml.gz\"",
"%",
"pdb_id",
",",
"silent",
"=",
"silent",
")",
"cf",
"=",
"Stri... | The RCSB website now compresses XML files. | [
"The",
"RCSB",
"website",
"now",
"compresses",
"XML",
"files",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/rcsb.py#L92-L101 | train | The RCSB website now compresses XML files. |
projectshift/shift-boiler | boiler/log/mail.py | mail_logger | def mail_logger(app, level = None):
"""
Get mail logger
Returns configured instance of mail logger ready to be attached to app.
Important: app.config['DEBUG'] must be False!
:param app: application instance
:param level: mail errors of this level
:return: SMTPHandl... | python | def mail_logger(app, level = None):
"""
Get mail logger
Returns configured instance of mail logger ready to be attached to app.
Important: app.config['DEBUG'] must be False!
:param app: application instance
:param level: mail errors of this level
:return: SMTPHandl... | [
"def",
"mail_logger",
"(",
"app",
",",
"level",
"=",
"None",
")",
":",
"credentials",
"=",
"None",
"if",
"app",
".",
"config",
"[",
"'MAIL_USERNAME'",
"]",
"and",
"app",
".",
"config",
"[",
"'MAIL_PASSWORD'",
"]",
":",
"credentials",
"=",
"(",
"app",
"... | Get mail logger
Returns configured instance of mail logger ready to be attached to app.
Important: app.config['DEBUG'] must be False!
:param app: application instance
:param level: mail errors of this level
:return: SMTPHandler | [
"Get",
"mail",
"logger",
"Returns",
"configured",
"instance",
"of",
"mail",
"logger",
"ready",
"to",
"be",
"attached",
"to",
"app",
"."
] | 8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b | https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/log/mail.py#L5-L53 | train | Returns a new instance of SMTPHandler that will log mails. |
Kortemme-Lab/klab | klab/plot/rtools.py | run_r_script | def run_r_script(r_script_filename, cwd = '.'):
'''This function was adapted from the covariation benchmark.'''
p = subprocess.Popen(["R", "CMD", "BATCH", r_script_filename], cwd = cwd)
while True:
time.sleep(0.3)
errcode = p.poll()
if errcode != None:
break
rout = "{... | python | def run_r_script(r_script_filename, cwd = '.'):
'''This function was adapted from the covariation benchmark.'''
p = subprocess.Popen(["R", "CMD", "BATCH", r_script_filename], cwd = cwd)
while True:
time.sleep(0.3)
errcode = p.poll()
if errcode != None:
break
rout = "{... | [
"def",
"run_r_script",
"(",
"r_script_filename",
",",
"cwd",
"=",
"'.'",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"R\"",
",",
"\"CMD\"",
",",
"\"BATCH\"",
",",
"r_script_filename",
"]",
",",
"cwd",
"=",
"cwd",
")",
"while",
"True",
"... | This function was adapted from the covariation benchmark. | [
"This",
"function",
"was",
"adapted",
"from",
"the",
"covariation",
"benchmark",
"."
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/plot/rtools.py#L59-L78 | train | This function was adapted from the covariation benchmark. |
Kortemme-Lab/klab | klab/plot/rtools.py | RInterface.correlation_coefficient_gplot | def correlation_coefficient_gplot(inputfname, output_filename, filetype, experiment_field = "Experimental", title = ''):
'''File suffix: pearsons_r_gplot
Description: Pearson's r
Filename: ggplot_pearsons.R
Priority: 1
'''
script_path = os.path.abspath(os.path... | python | def correlation_coefficient_gplot(inputfname, output_filename, filetype, experiment_field = "Experimental", title = ''):
'''File suffix: pearsons_r_gplot
Description: Pearson's r
Filename: ggplot_pearsons.R
Priority: 1
'''
script_path = os.path.abspath(os.path... | [
"def",
"correlation_coefficient_gplot",
"(",
"inputfname",
",",
"output_filename",
",",
"filetype",
",",
"experiment_field",
"=",
"\"Experimental\"",
",",
"title",
"=",
"''",
")",
":",
"script_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"pat... | File suffix: pearsons_r_gplot
Description: Pearson's r
Filename: ggplot_pearsons.R
Priority: 1 | [
"File",
"suffix",
":",
"pearsons_r_gplot",
"Description",
":",
"Pearson",
"s",
"r",
"Filename",
":",
"ggplot_pearsons",
".",
"R",
"Priority",
":",
"1"
] | 6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b | https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/plot/rtools.py#L48-L56 | train | This function is used to run the GPlot correlation coefficient function. |
trendels/rhino | rhino/util.py | sse_event | def sse_event(event=None, data=None, id=None, retry=None, comment=None,
encoding='utf-8'):
"""Encode a Server-Sent Event (SSE).
At least one field must be present. All fields are strings, except retry,
which must be an integer. The event and id fields can not contain newlines.
"""
if all(x ... | python | def sse_event(event=None, data=None, id=None, retry=None, comment=None,
encoding='utf-8'):
"""Encode a Server-Sent Event (SSE).
At least one field must be present. All fields are strings, except retry,
which must be an integer. The event and id fields can not contain newlines.
"""
if all(x ... | [
"def",
"sse_event",
"(",
"event",
"=",
"None",
",",
"data",
"=",
"None",
",",
"id",
"=",
"None",
",",
"retry",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"if",
"all",
"(",
"x",
"is",
"None",
"for",
"x",
... | Encode a Server-Sent Event (SSE).
At least one field must be present. All fields are strings, except retry,
which must be an integer. The event and id fields can not contain newlines. | [
"Encode",
"a",
"Server",
"-",
"Sent",
"Event",
"(",
"SSE",
")",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/util.py#L23-L43 | train | Encode a Server - Sent Event. |
trendels/rhino | rhino/util.py | dual_use_decorator | def dual_use_decorator(fn):
"""Turn a function into a decorator that can be called with or without
arguments."""
@functools.wraps(fn)
def decorator(*args, **kw):
if len(args) == 1 and not kw and callable(args[0]):
return fn()(args[0])
else:
return fn(*args, **kw)
... | python | def dual_use_decorator(fn):
"""Turn a function into a decorator that can be called with or without
arguments."""
@functools.wraps(fn)
def decorator(*args, **kw):
if len(args) == 1 and not kw and callable(args[0]):
return fn()(args[0])
else:
return fn(*args, **kw)
... | [
"def",
"dual_use_decorator",
"(",
"fn",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"fn",
")",
"def",
"decorator",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"not",
"kw",
"and",
"callable"... | Turn a function into a decorator that can be called with or without
arguments. | [
"Turn",
"a",
"function",
"into",
"a",
"decorator",
"that",
"can",
"be",
"called",
"with",
"or",
"without",
"arguments",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/util.py#L46-L55 | train | Turn a function into a decorator that can be called with or without
arguments. |
trendels/rhino | rhino/util.py | get_args | def get_args(obj):
"""Get a list of argument names for a callable."""
if inspect.isfunction(obj):
return inspect.getargspec(obj).args
elif inspect.ismethod(obj):
return inspect.getargspec(obj).args[1:]
elif inspect.isclass(obj):
return inspect.getargspec(obj.__init__).args[1:]
... | python | def get_args(obj):
"""Get a list of argument names for a callable."""
if inspect.isfunction(obj):
return inspect.getargspec(obj).args
elif inspect.ismethod(obj):
return inspect.getargspec(obj).args[1:]
elif inspect.isclass(obj):
return inspect.getargspec(obj.__init__).args[1:]
... | [
"def",
"get_args",
"(",
"obj",
")",
":",
"if",
"inspect",
".",
"isfunction",
"(",
"obj",
")",
":",
"return",
"inspect",
".",
"getargspec",
"(",
"obj",
")",
".",
"args",
"elif",
"inspect",
".",
"ismethod",
"(",
"obj",
")",
":",
"return",
"inspect",
".... | Get a list of argument names for a callable. | [
"Get",
"a",
"list",
"of",
"argument",
"names",
"for",
"a",
"callable",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/util.py#L70-L81 | train | Get a list of argument names for a callable. |
trendels/rhino | rhino/util.py | apply_ctx | def apply_ctx(fn, ctx):
"""Return fn with ctx partially applied, if requested.
If the `fn` callable accepts an argument named "ctx", returns a
functools.partial object with ctx=ctx applied, else returns `fn` unchanged.
For this to work, the 'ctx' argument must come after any arguments that are
pas... | python | def apply_ctx(fn, ctx):
"""Return fn with ctx partially applied, if requested.
If the `fn` callable accepts an argument named "ctx", returns a
functools.partial object with ctx=ctx applied, else returns `fn` unchanged.
For this to work, the 'ctx' argument must come after any arguments that are
pas... | [
"def",
"apply_ctx",
"(",
"fn",
",",
"ctx",
")",
":",
"if",
"'ctx'",
"in",
"get_args",
"(",
"fn",
")",
":",
"return",
"functools",
".",
"partial",
"(",
"fn",
",",
"ctx",
"=",
"ctx",
")",
"else",
":",
"return",
"fn"
] | Return fn with ctx partially applied, if requested.
If the `fn` callable accepts an argument named "ctx", returns a
functools.partial object with ctx=ctx applied, else returns `fn` unchanged.
For this to work, the 'ctx' argument must come after any arguments that are
passed as positional arguments. Fo... | [
"Return",
"fn",
"with",
"ctx",
"partially",
"applied",
"if",
"requested",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/util.py#L84-L99 | train | Return fn with ctx applied if requested. |
trendels/rhino | rhino/util.py | log_exception | def log_exception(exc_info=None, stream=None):
"""Log the 'exc_info' tuple in the server log."""
exc_info = exc_info or sys.exc_info()
stream = stream or sys.stderr
try:
from traceback import print_exception
print_exception(exc_info[0], exc_info[1], exc_info[2], None, stream)
str... | python | def log_exception(exc_info=None, stream=None):
"""Log the 'exc_info' tuple in the server log."""
exc_info = exc_info or sys.exc_info()
stream = stream or sys.stderr
try:
from traceback import print_exception
print_exception(exc_info[0], exc_info[1], exc_info[2], None, stream)
str... | [
"def",
"log_exception",
"(",
"exc_info",
"=",
"None",
",",
"stream",
"=",
"None",
")",
":",
"exc_info",
"=",
"exc_info",
"or",
"sys",
".",
"exc_info",
"(",
")",
"stream",
"=",
"stream",
"or",
"sys",
".",
"stderr",
"try",
":",
"from",
"traceback",
"impo... | Log the 'exc_info' tuple in the server log. | [
"Log",
"the",
"exc_info",
"tuple",
"in",
"the",
"server",
"log",
"."
] | f1f0ef21b6080a2bd130b38b5bef163074c94aed | https://github.com/trendels/rhino/blob/f1f0ef21b6080a2bd130b38b5bef163074c94aed/rhino/util.py#L102-L111 | train | Log the exc_info tuple in the server log. |
bykof/billomapy | billomapy/billomapy.py | Billomapy._create_get_request | def _create_get_request(self, resource, billomat_id='', command=None, params=None):
"""
Creates a get request and return the response data
"""
if not params:
params = {}
if not command:
command = ''
else:
command = '/' + command
... | python | def _create_get_request(self, resource, billomat_id='', command=None, params=None):
"""
Creates a get request and return the response data
"""
if not params:
params = {}
if not command:
command = ''
else:
command = '/' + command
... | [
"def",
"_create_get_request",
"(",
"self",
",",
"resource",
",",
"billomat_id",
"=",
"''",
",",
"command",
"=",
"None",
",",
"params",
"=",
"None",
")",
":",
"if",
"not",
"params",
":",
"params",
"=",
"{",
"}",
"if",
"not",
"command",
":",
"command",
... | Creates a get request and return the response data | [
"Creates",
"a",
"get",
"request",
"and",
"return",
"the",
"response",
"data"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L40-L63 | train | Creates a get request and returns the response |
bykof/billomapy | billomapy/billomapy.py | Billomapy._create_put_request | def _create_put_request(self, resource, billomat_id, command=None, send_data=None):
"""
Creates a put request and return the response data
"""
assert (isinstance(resource, str))
if isinstance(billomat_id, int):
billomat_id = str(billomat_id)
if not command:
... | python | def _create_put_request(self, resource, billomat_id, command=None, send_data=None):
"""
Creates a put request and return the response data
"""
assert (isinstance(resource, str))
if isinstance(billomat_id, int):
billomat_id = str(billomat_id)
if not command:
... | [
"def",
"_create_put_request",
"(",
"self",
",",
"resource",
",",
"billomat_id",
",",
"command",
"=",
"None",
",",
"send_data",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"resource",
",",
"str",
")",
")",
"if",
"isinstance",
"(",
"billomat_id"... | Creates a put request and return the response data | [
"Creates",
"a",
"put",
"request",
"and",
"return",
"the",
"response",
"data"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L87-L106 | train | Creates a put request and returns the response |
bykof/billomapy | billomapy/billomapy.py | Billomapy._create_delete_request | def _create_delete_request(self, resource, billomat_id):
"""
Creates a post request and return the response data
"""
assert (isinstance(resource, str))
if isinstance(billomat_id, int):
billomat_id = str(billomat_id)
response = self.session.delete(
... | python | def _create_delete_request(self, resource, billomat_id):
"""
Creates a post request and return the response data
"""
assert (isinstance(resource, str))
if isinstance(billomat_id, int):
billomat_id = str(billomat_id)
response = self.session.delete(
... | [
"def",
"_create_delete_request",
"(",
"self",
",",
"resource",
",",
"billomat_id",
")",
":",
"assert",
"(",
"isinstance",
"(",
"resource",
",",
"str",
")",
")",
"if",
"isinstance",
"(",
"billomat_id",
",",
"int",
")",
":",
"billomat_id",
"=",
"str",
"(",
... | Creates a post request and return the response data | [
"Creates",
"a",
"post",
"request",
"and",
"return",
"the",
"response",
"data"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L108-L121 | train | Creates a post request and returns the response |
bykof/billomapy | billomapy/billomapy.py | Billomapy._handle_response | def _handle_response(self, response):
"""
Handle all responses
:param response:
:type response:
:return:
:rtype:
"""
if response.status_code == requests.codes.ok or response.status_code == requests.codes.created:
try:
return res... | python | def _handle_response(self, response):
"""
Handle all responses
:param response:
:type response:
:return:
:rtype:
"""
if response.status_code == requests.codes.ok or response.status_code == requests.codes.created:
try:
return res... | [
"def",
"_handle_response",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"requests",
".",
"codes",
".",
"ok",
"or",
"response",
".",
"status_code",
"==",
"requests",
".",
"codes",
".",
"created",
":",
"try",
":",
"re... | Handle all responses
:param response:
:type response:
:return:
:rtype: | [
"Handle",
"all",
"responses",
":",
"param",
"response",
":",
":",
"type",
"response",
":",
":",
"return",
":",
":",
"rtype",
":"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L123-L137 | train | Handle all responses from the server |
bykof/billomapy | billomapy/billomapy.py | Billomapy._handle_failed_response | def _handle_failed_response(self, response):
"""
Handle the failed response and check for rate limit exceeded
If rate limit exceeded it runs the rate_limit_exceeded function which you should overwrite
:param response: requests.Response
:type response: requests.Reponse
:r... | python | def _handle_failed_response(self, response):
"""
Handle the failed response and check for rate limit exceeded
If rate limit exceeded it runs the rate_limit_exceeded function which you should overwrite
:param response: requests.Response
:type response: requests.Reponse
:r... | [
"def",
"_handle_failed_response",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"requests",
".",
"codes",
".",
"too_many_requests",
":",
"return",
"self",
".",
"rate_limit_exceeded",
"(",
"response",
")",
"else",
":",
"res... | Handle the failed response and check for rate limit exceeded
If rate limit exceeded it runs the rate_limit_exceeded function which you should overwrite
:param response: requests.Response
:type response: requests.Reponse
:return: None
:rtype: None | [
"Handle",
"the",
"failed",
"response",
"and",
"check",
"for",
"rate",
"limit",
"exceeded",
"If",
"rate",
"limit",
"exceeded",
"it",
"runs",
"the",
"rate_limit_exceeded",
"function",
"which",
"you",
"should",
"overwrite"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L139-L152 | train | Handle the failed response and raise an exception if rate limit exceeded |
bykof/billomapy | billomapy/billomapy.py | Billomapy._iterate_through_pages | def _iterate_through_pages(get_function, resource, **kwargs):
"""
Iterate through all pages and return the collected data
:rtype: list
"""
request_data = True
data = []
page = 1
while request_data:
temp_response = get_function(page=page, **kw... | python | def _iterate_through_pages(get_function, resource, **kwargs):
"""
Iterate through all pages and return the collected data
:rtype: list
"""
request_data = True
data = []
page = 1
while request_data:
temp_response = get_function(page=page, **kw... | [
"def",
"_iterate_through_pages",
"(",
"get_function",
",",
"resource",
",",
"*",
"*",
"kwargs",
")",
":",
"request_data",
"=",
"True",
"data",
"=",
"[",
"]",
"page",
"=",
"1",
"while",
"request_data",
":",
"temp_response",
"=",
"get_function",
"(",
"page",
... | Iterate through all pages and return the collected data
:rtype: list | [
"Iterate",
"through",
"all",
"pages",
"and",
"return",
"the",
"collected",
"data",
":",
"rtype",
":",
"list"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L155-L177 | train | Iterate through all pages and return the collected data. |
bykof/billomapy | billomapy/billomapy.py | Billomapy._get_resource_per_page | def _get_resource_per_page(self, resource, per_page=1000, page=1, params=None):
"""
Gets specific data per resource page and per page
"""
assert (isinstance(resource, str))
common_params = {'per_page': per_page, 'page': page}
if not params:
params = common_pa... | python | def _get_resource_per_page(self, resource, per_page=1000, page=1, params=None):
"""
Gets specific data per resource page and per page
"""
assert (isinstance(resource, str))
common_params = {'per_page': per_page, 'page': page}
if not params:
params = common_pa... | [
"def",
"_get_resource_per_page",
"(",
"self",
",",
"resource",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
",",
"params",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"resource",
",",
"str",
")",
")",
"common_params",
"=",
"{",
"'p... | Gets specific data per resource page and per page | [
"Gets",
"specific",
"data",
"per",
"resource",
"page",
"and",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L179-L190 | train | Gets specific data per resource page and per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.resolve_response_data | def resolve_response_data(head_key, data_key, data):
"""
Resolves the responses you get from billomat
If you have done a get_one_element request then you will get a dictionary
If you have done a get_all_elements request then you will get a list with all elements in it
:param hea... | python | def resolve_response_data(head_key, data_key, data):
"""
Resolves the responses you get from billomat
If you have done a get_one_element request then you will get a dictionary
If you have done a get_all_elements request then you will get a list with all elements in it
:param hea... | [
"def",
"resolve_response_data",
"(",
"head_key",
",",
"data_key",
",",
"data",
")",
":",
"new_data",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"for",
"data_row",
"in",
"data",
":",
"if",
"head_key",
"in",
"data_row",
"and",
... | Resolves the responses you get from billomat
If you have done a get_one_element request then you will get a dictionary
If you have done a get_all_elements request then you will get a list with all elements in it
:param head_key: the head key e.g: CLIENTS
:param data_key: the data key e.... | [
"Resolves",
"the",
"responses",
"you",
"get",
"from",
"billomat",
"If",
"you",
"have",
"done",
"a",
"get_one_element",
"request",
"then",
"you",
"will",
"get",
"a",
"dictionary",
"If",
"you",
"have",
"done",
"a",
"get_all_elements",
"request",
"then",
"you",
... | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L193-L220 | train | Resolves the responses you get from billomat
|
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_clients_per_page | def get_clients_per_page(self, per_page=1000, page=1, params=None):
"""
Get clients per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
retu... | python | def get_clients_per_page(self, per_page=1000, page=1, params=None):
"""
Get clients per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
retu... | [
"def",
"get_clients_per_page",
"(",
"self",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_resource_per_page",
"(",
"resource",
"=",
"CLIENTS",
",",
"per_page",
"=",
"per_page",
",",
... | Get clients per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list | [
"Get",
"clients",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L241-L250 | train | Get clients per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_all_clients | def get_all_clients(self, params=None):
"""
Get all clients
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
retur... | python | def get_all_clients(self, params=None):
"""
Get all clients
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
retur... | [
"def",
"get_all_clients",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_iterate_through_pages",
"(",
"get_function",
"=",
"self",
".",
"get_clients_per_page",
",",
"resource",
"=",
"CLIENTS",
",",
"*",
"*",
"{",
"'params'",
":",... | Get all clients
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list | [
"Get",
"all",
"clients",
"This",
"will",
"iterate",
"over",
"all",
"pages",
"until",
"it",
"gets",
"all",
"elements",
".",
"So",
"if",
"the",
"rate",
"limit",
"exceeded",
"it",
"will",
"throw",
"an",
"Exception",
"and",
"you",
"will",
"get",
"nothing"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L252-L265 | train | This will iterate over all the clients in the resource provider and return a list of all the clients in the system |
bykof/billomapy | billomapy/billomapy.py | Billomapy.update_client | def update_client(self, client_id, client_dict):
"""
Updates a client
:param client_id: the client id
:param client_dict: dict
:return: dict
"""
return self._create_put_request(
resource=CLIENTS,
billomat_id=client_id,
send_dat... | python | def update_client(self, client_id, client_dict):
"""
Updates a client
:param client_id: the client id
:param client_dict: dict
:return: dict
"""
return self._create_put_request(
resource=CLIENTS,
billomat_id=client_id,
send_dat... | [
"def",
"update_client",
"(",
"self",
",",
"client_id",
",",
"client_dict",
")",
":",
"return",
"self",
".",
"_create_put_request",
"(",
"resource",
"=",
"CLIENTS",
",",
"billomat_id",
"=",
"client_id",
",",
"send_data",
"=",
"client_dict",
")"
] | Updates a client
:param client_id: the client id
:param client_dict: dict
:return: dict | [
"Updates",
"a",
"client"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L285-L297 | train | Updates a client s attributes |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_client_properties_per_page | def get_client_properties_per_page(self, per_page=1000, page=1, params=None):
"""
Get client properties per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
... | python | def get_client_properties_per_page(self, per_page=1000, page=1, params=None):
"""
Get client properties per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
... | [
"def",
"get_client_properties_per_page",
"(",
"self",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_resource_per_page",
"(",
"resource",
"=",
"CLIENT_PROPERTIES",
",",
"per_page",
"=",
... | Get client properties per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list | [
"Get",
"client",
"properties",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L315-L329 | train | Get client properties per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_all_client_properties | def get_all_client_properties(self, params=None):
"""
Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
... | python | def get_all_client_properties(self, params=None):
"""
Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
... | [
"def",
"get_all_client_properties",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_iterate_through_pages",
"(",
"get_function",
"=",
"self",
".",
"get_client_properties_per_page",
",",
"resource",
"=",
"CLIENT_PROPERTIES",
",",
"*",
"*... | Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list | [
"Get",
"all",
"contacts",
"of",
"client",
"This",
"will",
"iterate",
"over",
"all",
"pages",
"until",
"it",
"gets",
"all",
"elements",
".",
"So",
"if",
"the",
"rate",
"limit",
"exceeded",
"it",
"will",
"throw",
"an",
"Exception",
"and",
"you",
"will",
"g... | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L331-L344 | train | This will iterate over all contacts of client
and return a list of all client properties |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_client_tags_per_page | def get_client_tags_per_page(self, per_page=1000, page=1, params=None):
"""
Get client tags per page
If you search tags, you can only search by client_id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search ... | python | def get_client_tags_per_page(self, per_page=1000, page=1, params=None):
"""
Get client tags per page
If you search tags, you can only search by client_id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search ... | [
"def",
"get_client_tags_per_page",
"(",
"self",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_resource_per_page",
"(",
"resource",
"=",
"CLIENT_TAGS",
",",
"per_page",
"=",
"per_page",... | Get client tags per page
If you search tags, you can only search by client_id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list | [
"Get",
"client",
"tags",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L371-L387 | train | Get client tags per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_all_client_tags | def get_all_client_tags(self, params=None):
"""
Get all client tags
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
... | python | def get_all_client_tags(self, params=None):
"""
Get all client tags
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
... | [
"def",
"get_all_client_tags",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_iterate_through_pages",
"(",
"get_function",
"=",
"self",
".",
"get_client_tags_per_page",
",",
"resource",
"=",
"CLIENT_TAGS",
",",
"*",
"*",
"{",
"'para... | Get all client tags
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list | [
"Get",
"all",
"client",
"tags",
"This",
"will",
"iterate",
"over",
"all",
"pages",
"until",
"it",
"gets",
"all",
"elements",
".",
"So",
"if",
"the",
"rate",
"limit",
"exceeded",
"it",
"will",
"throw",
"an",
"Exception",
"and",
"you",
"will",
"get",
"noth... | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L389-L402 | train | This will iterate over all client tags and return a list of all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_contacts_of_client_per_page | def get_contacts_of_client_per_page(self, client_id, per_page=1000, page=1):
"""
Get contacts of client per page
:param client_id: the client id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:return: list
"""
... | python | def get_contacts_of_client_per_page(self, client_id, per_page=1000, page=1):
"""
Get contacts of client per page
:param client_id: the client id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:return: list
"""
... | [
"def",
"get_contacts_of_client_per_page",
"(",
"self",
",",
"client_id",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
")",
":",
"return",
"self",
".",
"_get_resource_per_page",
"(",
"resource",
"=",
"CONTACTS",
",",
"per_page",
"=",
"per_page",
",",
... | Get contacts of client per page
:param client_id: the client id
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:return: list | [
"Get",
"contacts",
"of",
"client",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L438-L452 | train | Get contacts of a client per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_all_contacts_of_client | def get_all_contacts_of_client(self, client_id):
"""
Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param client_id: The id of the client
:return: ... | python | def get_all_contacts_of_client(self, client_id):
"""
Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param client_id: The id of the client
:return: ... | [
"def",
"get_all_contacts_of_client",
"(",
"self",
",",
"client_id",
")",
":",
"return",
"self",
".",
"_iterate_through_pages",
"(",
"get_function",
"=",
"self",
".",
"get_contacts_of_client_per_page",
",",
"resource",
"=",
"CONTACTS",
",",
"*",
"*",
"{",
"'client_... | Get all contacts of client
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param client_id: The id of the client
:return: list | [
"Get",
"all",
"contacts",
"of",
"client",
"This",
"will",
"iterate",
"over",
"all",
"pages",
"until",
"it",
"gets",
"all",
"elements",
".",
"So",
"if",
"the",
"rate",
"limit",
"exceeded",
"it",
"will",
"throw",
"an",
"Exception",
"and",
"you",
"will",
"g... | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L454-L467 | train | This will iterate over all contacts of client and return a list of contacts |
bykof/billomapy | billomapy/billomapy.py | Billomapy.update_contact_of_client | def update_contact_of_client(self, contact_id, contact_dict):
"""
Updates a contact
:param contact_id: the id of the contact
:param contact_dict: dict
:return: dict
"""
return self._create_put_request(resource=CONTACTS, billomat_id=contact_id, send_data=contact_d... | python | def update_contact_of_client(self, contact_id, contact_dict):
"""
Updates a contact
:param contact_id: the id of the contact
:param contact_dict: dict
:return: dict
"""
return self._create_put_request(resource=CONTACTS, billomat_id=contact_id, send_data=contact_d... | [
"def",
"update_contact_of_client",
"(",
"self",
",",
"contact_id",
",",
"contact_dict",
")",
":",
"return",
"self",
".",
"_create_put_request",
"(",
"resource",
"=",
"CONTACTS",
",",
"billomat_id",
"=",
"contact_id",
",",
"send_data",
"=",
"contact_dict",
")"
] | Updates a contact
:param contact_id: the id of the contact
:param contact_dict: dict
:return: dict | [
"Updates",
"a",
"contact"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L487-L495 | train | Updates a contact of a client |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_suppliers_per_page | def get_suppliers_per_page(self, per_page=1000, page=1, params=None):
"""
Get suppliers per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
... | python | def get_suppliers_per_page(self, per_page=1000, page=1, params=None):
"""
Get suppliers per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list
"""
... | [
"def",
"get_suppliers_per_page",
"(",
"self",
",",
"per_page",
"=",
"1000",
",",
"page",
"=",
"1",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get_resource_per_page",
"(",
"resource",
"=",
"SUPPLIERS",
",",
"per_page",
"=",
"per_page",
"... | Get suppliers per page
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
:param params: Search parameters. Default: {}
:return: list | [
"Get",
"suppliers",
"per",
"page"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L513-L522 | train | Get suppliers per page |
bykof/billomapy | billomapy/billomapy.py | Billomapy.get_all_suppliers | def get_all_suppliers(self, params=None):
"""
Get all suppliers
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
i... | python | def get_all_suppliers(self, params=None):
"""
Get all suppliers
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list
"""
i... | [
"def",
"get_all_suppliers",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"if",
"not",
"params",
":",
"params",
"=",
"{",
"}",
"return",
"self",
".",
"_iterate_through_pages",
"(",
"get_function",
"=",
"self",
".",
"get_suppliers_per_page",
",",
"resour... | Get all suppliers
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param params: search params
:return: list | [
"Get",
"all",
"suppliers",
"This",
"will",
"iterate",
"over",
"all",
"pages",
"until",
"it",
"gets",
"all",
"elements",
".",
"So",
"if",
"the",
"rate",
"limit",
"exceeded",
"it",
"will",
"throw",
"an",
"Exception",
"and",
"you",
"will",
"get",
"nothing"
] | a28ba69fd37654fa145d0411d52c200e7f8984ab | https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L524-L539 | train | This will iterate over all suppliers and return a list of all suppliers |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.