partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
http_date
Formats the @value in required HTTP style @value: :class:datetime.datetime, #int, #float, #str time-like object -> #str HTTP-style formatted date (c)2014, Marcel Hellkamp
vital/tools/http.py
def http_date(value): """ Formats the @value in required HTTP style @value: :class:datetime.datetime, #int, #float, #str time-like object -> #str HTTP-style formatted date (c)2014, Marcel Hellkamp """ if isinstance(value, datetime.datetime): value = value.utctimetuple() ...
def http_date(value): """ Formats the @value in required HTTP style @value: :class:datetime.datetime, #int, #float, #str time-like object -> #str HTTP-style formatted date (c)2014, Marcel Hellkamp """ if isinstance(value, datetime.datetime): value = value.utctimetuple() ...
[ "Formats", "the", "@value", "in", "required", "HTTP", "style" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/http.py#L25-L40
[ "def", "http_date", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", ":", "value", "=", "value", ".", "utctimetuple", "(", ")", "elif", "isinstance", "(", "value", ",", "(", "int", ",", "float", ")", ")...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
parse_auth
Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None (c)2014, Marcel Hellkamp
vital/tools/http.py
def parse_auth(header): """ Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None (c)2014, Marcel Hellkamp """ try: method, data = header.split(None, 1) if method.lower() == 'basic': data = base64.b64decode(uniorbytes(data, b...
def parse_auth(header): """ Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None (c)2014, Marcel Hellkamp """ try: method, data = header.split(None, 1) if method.lower() == 'basic': data = base64.b64decode(uniorbytes(data, b...
[ "Parse", "rfc2617", "HTTP", "authentication", "header", "string", "(", "basic", ")", "and", "return", "(", "user", "pass", ")", "tuple", "or", "None", "(", "c", ")", "2014", "Marcel", "Hellkamp" ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/tools/http.py#L54-L66
[ "def", "parse_auth", "(", "header", ")", ":", "try", ":", "method", ",", "data", "=", "header", ".", "split", "(", "None", ",", "1", ")", "if", "method", ".", "lower", "(", ")", "==", "'basic'", ":", "data", "=", "base64", ".", "b64decode", "(", ...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
image
Generates identicon image based on passed data. Arguments: data - Data which should be used for generating an identicon. This data will be used in order to create a digest which is used for generating the identicon. If the data passed is a hex digest already, the digest will be used as-is....
django_pydenticon/views.py
def image(request, data): """ Generates identicon image based on passed data. Arguments: data - Data which should be used for generating an identicon. This data will be used in order to create a digest which is used for generating the identicon. If the data passed is a hex digest already...
def image(request, data): """ Generates identicon image based on passed data. Arguments: data - Data which should be used for generating an identicon. This data will be used in order to create a digest which is used for generating the identicon. If the data passed is a hex digest already...
[ "Generates", "identicon", "image", "based", "on", "passed", "data", "." ]
azaghal/django-pydenticon
python
https://github.com/azaghal/django-pydenticon/blob/dd21a87693505614eb5ce1da6ff1b6146d341b2c/django_pydenticon/views.py#L14-L85
[ "def", "image", "(", "request", ",", "data", ")", ":", "# Get image width, height, padding, and format from GET parameters, or", "# fall-back to default values from settings.", "try", ":", "width", "=", "int", "(", "request", ".", "GET", ".", "get", "(", "\"w\"", ",", ...
dd21a87693505614eb5ce1da6ff1b6146d341b2c
train
rename
Give the currently developed hotfix a new name.
src/peltak/extra/gitflow/commands/hotfix.py
def rename(name): # type: (str) -> None """ Give the currently developed hotfix a new name. """ from peltak.extra.gitflow import logic if name is None: name = click.prompt('Hotfix name') logic.hotfix.rename(name)
def rename(name): # type: (str) -> None """ Give the currently developed hotfix a new name. """ from peltak.extra.gitflow import logic if name is None: name = click.prompt('Hotfix name') logic.hotfix.rename(name)
[ "Give", "the", "currently", "developed", "hotfix", "a", "new", "name", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/commands/hotfix.py#L53-L61
[ "def", "rename", "(", "name", ")", ":", "# type: (str) -> None", "from", "peltak", ".", "extra", ".", "gitflow", "import", "logic", "if", "name", "is", "None", ":", "name", "=", "click", ".", "prompt", "(", "'Hotfix name'", ")", "logic", ".", "hotfix", "...
b627acc019e3665875fe76cdca0a14773b69beaa
train
local_lru
Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size .. class Foo(object): def __init__(self, cache_size=5000): self._cache = OrderedDict() self._cache_size...
vital/cache/decorators.py
def local_lru(obj): """ Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size .. class Foo(object): def __init__(self, cache_size=5000): self._cache = OrderedDict() ...
def local_lru(obj): """ Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size .. class Foo(object): def __init__(self, cache_size=5000): self._cache = OrderedDict() ...
[ "Property", "that", "maps", "to", "a", "key", "in", "a", "local", "dict", "-", "like", "attribute", ".", "self", ".", "_cache", "must", "be", "an", "OrderedDict", "self", ".", "_cache_size", "must", "be", "defined", "as", "LRU", "size", "..", "class", ...
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/cache/decorators.py#L42-L74
[ "def", "local_lru", "(", "obj", ")", ":", "@", "wraps", "(", "obj", ")", "def", "memoizer", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "args", "[", "0", "]", "lru_size", "=", "instance", ".", "_cache_size", "if", "lru_siz...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
typed_lru
:func:functools.lru_cache wrapper which allows you to prevent object types outside of @types from being cached. The main use case for this is preventing unhashable type errors when you still want to cache some results. .. from vital.cache import typed_lru @typed...
vital/cache/decorators.py
def typed_lru(maxsize, types=None): """ :func:functools.lru_cache wrapper which allows you to prevent object types outside of @types from being cached. The main use case for this is preventing unhashable type errors when you still want to cache some results. .. from vita...
def typed_lru(maxsize, types=None): """ :func:functools.lru_cache wrapper which allows you to prevent object types outside of @types from being cached. The main use case for this is preventing unhashable type errors when you still want to cache some results. .. from vita...
[ ":", "func", ":", "functools", ".", "lru_cache", "wrapper", "which", "allows", "you", "to", "prevent", "object", "types", "outside", "of", "@types", "from", "being", "cached", "." ]
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/cache/decorators.py#L77-L124
[ "def", "typed_lru", "(", "maxsize", ",", "types", "=", "None", ")", ":", "types", "=", "types", "or", "collections", ".", "Hashable", "def", "lru", "(", "obj", ")", ":", "@", "lru_cache", "(", "maxsize", ")", "def", "_lru_cache", "(", "*", "args", ",...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
local_expiring_lru
Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size self._cache_ttl is the expiration time in seconds .. class Foo(object): def __init__(self, cache_size=5000, cache_ttl=600): ...
vital/cache/decorators.py
def local_expiring_lru(obj): """ Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size self._cache_ttl is the expiration time in seconds .. class Foo(object): def __init__(self,...
def local_expiring_lru(obj): """ Property that maps to a key in a local dict-like attribute. self._cache must be an OrderedDict self._cache_size must be defined as LRU size self._cache_ttl is the expiration time in seconds .. class Foo(object): def __init__(self,...
[ "Property", "that", "maps", "to", "a", "key", "in", "a", "local", "dict", "-", "like", "attribute", ".", "self", ".", "_cache", "must", "be", "an", "OrderedDict", "self", ".", "_cache_size", "must", "be", "defined", "as", "LRU", "size", "self", ".", "_...
jaredLunde/vital-tools
python
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/cache/decorators.py#L127-L172
[ "def", "local_expiring_lru", "(", "obj", ")", ":", "@", "wraps", "(", "obj", ")", "def", "memoizer", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "args", "[", "0", "]", "lru_size", "=", "instance", ".", "_cache_size", "cache_...
ea924c9bbb6ec22aa66f8095f018b1ee0099ac04
train
GlobalContext.get
Get context value with the given name and optional default. Args: name (str): The name of the context value. *default (Any): If given and the key doesn't not exist, this will be returned instead. If it's not given and the context value doe...
src/peltak/core/context.py
def get(self, name, *default): # type: (str, Any) -> Any """ Get context value with the given name and optional default. Args: name (str): The name of the context value. *default (Any): If given and the key doesn't not exist, this will be ...
def get(self, name, *default): # type: (str, Any) -> Any """ Get context value with the given name and optional default. Args: name (str): The name of the context value. *default (Any): If given and the key doesn't not exist, this will be ...
[ "Get", "context", "value", "with", "the", "given", "name", "and", "optional", "default", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/context.py#L57-L90
[ "def", "get", "(", "self", ",", "name", ",", "*", "default", ")", ":", "# type: (str, Any) -> Any", "curr", "=", "self", ".", "values", "for", "part", "in", "name", ".", "split", "(", "'.'", ")", ":", "if", "part", "in", "curr", ":", "curr", "=", "...
b627acc019e3665875fe76cdca0a14773b69beaa
train
GlobalContext.set
Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value
src/peltak/core/context.py
def set(self, name, value): """ Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value """ curr = self.values parts = name.split('.') ...
def set(self, name, value): """ Set context value. Args: name (str): The name of the context value to change. value (Any): The new value for the selected context value """ curr = self.values parts = name.split('.') ...
[ "Set", "context", "value", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/context.py#L92-L113
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "curr", "=", "self", ".", "values", "parts", "=", "name", ".", "split", "(", "'.'", ")", "for", "i", ",", "part", "in", "enumerate", "(", "parts", "[", ":", "-", "1", "]", ")", "...
b627acc019e3665875fe76cdca0a14773b69beaa
train
alias_exists
Checks if an alias already exists in a keystore :param alias: :param keystore_path: :param keystore_password: :return: (bool) True when the alias already exists in the keystore :raises: OSError
pycons3rt/pyjavakeys.py
def alias_exists(alias, keystore_path=None, keystore_password='changeit'): """Checks if an alias already exists in a keystore :param alias: :param keystore_path: :param keystore_password: :return: (bool) True when the alias already exists in the keystore :raises: OSError """ log = loggi...
def alias_exists(alias, keystore_path=None, keystore_password='changeit'): """Checks if an alias already exists in a keystore :param alias: :param keystore_path: :param keystore_password: :return: (bool) True when the alias already exists in the keystore :raises: OSError """ log = loggi...
[ "Checks", "if", "an", "alias", "already", "exists", "in", "a", "keystore" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/pyjavakeys.py#L34-L103
[ "def", "alias_exists", "(", "alias", ",", "keystore_path", "=", "None", ",", "keystore_password", "=", "'changeit'", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.alias_exists'", ")", "if", "not", "isinstance", "(", "alias", "...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
TreeNode.filter
Define the filter function that every node must to implement. :param query: The sqlalchemy query. :type query: Query :param entity: The entity model. :type entity: type :return: The filtered query. :rtype: Tuple[Query, Any]
src/sqla_filters/nodes/base/base.py
def filter(self, query: Query, entity: type) -> Tuple[Query, Any]: """Define the filter function that every node must to implement. :param query: The sqlalchemy query. :type query: Query :param entity: The entity model. :type entity: type :return: The filtered query. ...
def filter(self, query: Query, entity: type) -> Tuple[Query, Any]: """Define the filter function that every node must to implement. :param query: The sqlalchemy query. :type query: Query :param entity: The entity model. :type entity: type :return: The filtered query. ...
[ "Define", "the", "filter", "function", "that", "every", "node", "must", "to", "implement", "." ]
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/nodes/base/base.py#L50-L62
[ "def", "filter", "(", "self", ",", "query", ":", "Query", ",", "entity", ":", "type", ")", "->", "Tuple", "[", "Query", ",", "Any", "]", ":", "raise", "NotImplementedError", "(", "'You must implement this.'", ")" ]
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
BaseOperationalNode._extract_relations
Split and return the list of relation(s) and the attribute. :param attribute: :type attribute: str :return: A tuple where the first element is the list of related entities and the second is the attribute. :rtype: Tuple[List[str], str]
src/sqla_filters/nodes/base/base.py
def _extract_relations(self, attribute: str) -> Tuple[List[str], str]: """Split and return the list of relation(s) and the attribute. :param attribute: :type attribute: str :return: A tuple where the first element is the list of related entities and the second is the attrib...
def _extract_relations(self, attribute: str) -> Tuple[List[str], str]: """Split and return the list of relation(s) and the attribute. :param attribute: :type attribute: str :return: A tuple where the first element is the list of related entities and the second is the attrib...
[ "Split", "and", "return", "the", "list", "of", "relation", "(", "s", ")", "and", "the", "attribute", "." ]
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/nodes/base/base.py#L104-L115
[ "def", "_extract_relations", "(", "self", ",", "attribute", ":", "str", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "str", "]", ":", "splitted", "=", "attribute", ".", "split", "(", "self", ".", "_attr_sep", ")", "return", "(", "splitted", ...
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
BaseOperationalNode._get_relation
Transform the list of relation to list of class. :param related_mode: The model of the query. :type related_mode: type :param relations: The relation list get from the `_extract_relations`. :type relations: List[str] :return: Tuple with the list of relations (class) and the se...
src/sqla_filters/nodes/base/base.py
def _get_relation(self, related_model: type, relations: List[str]) -> Tuple[Optional[List[type]], Optional[type]]: """Transform the list of relation to list of class. :param related_mode: The model of the query. :type related_mode: type :param relations: The relation list get from the ...
def _get_relation(self, related_model: type, relations: List[str]) -> Tuple[Optional[List[type]], Optional[type]]: """Transform the list of relation to list of class. :param related_mode: The model of the query. :type related_mode: type :param relations: The relation list get from the ...
[ "Transform", "the", "list", "of", "relation", "to", "list", "of", "class", "." ]
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/nodes/base/base.py#L117-L137
[ "def", "_get_relation", "(", "self", ",", "related_model", ":", "type", ",", "relations", ":", "List", "[", "str", "]", ")", "->", "Tuple", "[", "Optional", "[", "List", "[", "type", "]", "]", ",", "Optional", "[", "type", "]", "]", ":", "relations_l...
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
BaseOperationalNode._join_tables
Method to make the join when relation is found. :param query: The sqlalchemy query. :type query: Query :param join_models: The list of joined models get from the method `_get_relation`. :type join_models: Optional[List[type]] :return: The new Query with the joined ...
src/sqla_filters/nodes/base/base.py
def _join_tables(self, query: Query, join_models: Optional[List[type]]) -> Query: """Method to make the join when relation is found. :param query: The sqlalchemy query. :type query: Query :param join_models: The list of joined models get from the method `_get_relation`. ...
def _join_tables(self, query: Query, join_models: Optional[List[type]]) -> Query: """Method to make the join when relation is found. :param query: The sqlalchemy query. :type query: Query :param join_models: The list of joined models get from the method `_get_relation`. ...
[ "Method", "to", "make", "the", "join", "when", "relation", "is", "found", "." ]
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/nodes/base/base.py#L139-L160
[ "def", "_join_tables", "(", "self", ",", "query", ":", "Query", ",", "join_models", ":", "Optional", "[", "List", "[", "type", "]", "]", ")", "->", "Query", ":", "joined_query", "=", "query", "# Create the list of already joined entities", "joined_tables", "=", ...
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
BaseLogicalNode.filter
Apply the `_method` to all childs of the node. :param query: The sqlachemy query. :type query: Query :param entity: The entity model of the query. :type entity: type :return: A tuple with in first place the updated query and in second place the list of filt...
src/sqla_filters/nodes/base/base.py
def filter(self, query: Query, entity: type) -> Tuple[Query, Any]: """Apply the `_method` to all childs of the node. :param query: The sqlachemy query. :type query: Query :param entity: The entity model of the query. :type entity: type :return: A tuple with in ...
def filter(self, query: Query, entity: type) -> Tuple[Query, Any]: """Apply the `_method` to all childs of the node. :param query: The sqlachemy query. :type query: Query :param entity: The entity model of the query. :type entity: type :return: A tuple with in ...
[ "Apply", "the", "_method", "to", "all", "childs", "of", "the", "node", ".", ":", "param", "query", ":", "The", "sqlachemy", "query", ".", ":", "type", "query", ":", "Query" ]
MarcAureleCoste/sqla-filters
python
https://github.com/MarcAureleCoste/sqla-filters/blob/a9596f660a11d275bf0e831ecd9e502b0af2a087/src/sqla_filters/nodes/base/base.py#L207-L228
[ "def", "filter", "(", "self", ",", "query", ":", "Query", ",", "entity", ":", "type", ")", "->", "Tuple", "[", "Query", ",", "Any", "]", ":", "new_query", "=", "query", "c_filter_list", "=", "[", "]", "for", "child", "in", "self", ".", "_childs", "...
a9596f660a11d275bf0e831ecd9e502b0af2a087
train
send_sms
Sends SMS via Kajala Group SMS API. Contact info@kajala.com for access. :param phone: Phone number :param message: Message to be esnd :param sender: Sender (max 11 characters) :param kw: Variable key-value pairs to be sent to SMS API :return: Response from requests.post
jutil/sms.py
def send_sms(phone: str, message: str, sender: str='', **kw): """ Sends SMS via Kajala Group SMS API. Contact info@kajala.com for access. :param phone: Phone number :param message: Message to be esnd :param sender: Sender (max 11 characters) :param kw: Variable key-value pairs to be sent to SMS ...
def send_sms(phone: str, message: str, sender: str='', **kw): """ Sends SMS via Kajala Group SMS API. Contact info@kajala.com for access. :param phone: Phone number :param message: Message to be esnd :param sender: Sender (max 11 characters) :param kw: Variable key-value pairs to be sent to SMS ...
[ "Sends", "SMS", "via", "Kajala", "Group", "SMS", "API", ".", "Contact", "info" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/sms.py#L6-L32
[ "def", "send_sms", "(", "phone", ":", "str", ",", "message", ":", "str", ",", "sender", ":", "str", "=", "''", ",", "*", "*", "kw", ")", ":", "if", "not", "hasattr", "(", "settings", ",", "'SMS_TOKEN'", ")", ":", "raise", "Exception", "(", "'Invali...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
_meta_get_resource_sync
Just a meta func to get execution time
isogeo_pysdk/samples/dev_perfs_sync_async.py
def _meta_get_resource_sync(md_uuid): """Just a meta func to get execution time""" isogeo.resource(id_resource=md_uuid) elapsed = default_timer() - START_TIME time_completed_at = "{:5.2f}s".format(elapsed) print("{0:<30} {1:>20}".format(md_uuid, time_completed_at)) return
def _meta_get_resource_sync(md_uuid): """Just a meta func to get execution time""" isogeo.resource(id_resource=md_uuid) elapsed = default_timer() - START_TIME time_completed_at = "{:5.2f}s".format(elapsed) print("{0:<30} {1:>20}".format(md_uuid, time_completed_at)) return
[ "Just", "a", "meta", "func", "to", "get", "execution", "time" ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/dev_perfs_sync_async.py#L35-L43
[ "def", "_meta_get_resource_sync", "(", "md_uuid", ")", ":", "isogeo", ".", "resource", "(", "id_resource", "=", "md_uuid", ")", "elapsed", "=", "default_timer", "(", ")", "-", "START_TIME", "time_completed_at", "=", "\"{:5.2f}s\"", ".", "format", "(", "elapsed",...
57a604be92c7767b26abd247012cc1a584b386a0
train
Command.setup
Setup properties from parent app on the command
chuda/commands.py
def setup(self, app): ''' Setup properties from parent app on the command ''' self.logger = app.logger self.shell.logger = self.logger if not self.command_name: raise EmptyCommandNameException() self.app = app self.arguments_declaration = sel...
def setup(self, app): ''' Setup properties from parent app on the command ''' self.logger = app.logger self.shell.logger = self.logger if not self.command_name: raise EmptyCommandNameException() self.app = app self.arguments_declaration = sel...
[ "Setup", "properties", "from", "parent", "app", "on", "the", "command" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/commands.py#L92-L109
[ "def", "setup", "(", "self", ",", "app", ")", ":", "self", ".", "logger", "=", "app", ".", "logger", "self", ".", "shell", ".", "logger", "=", "self", ".", "logger", "if", "not", "self", ".", "command_name", ":", "raise", "EmptyCommandNameException", "...
0d93b716dede35231c21be97bcc19a656655983f
train
LogExceptionMiddleware.process_exception
Logs exception error message and sends email to ADMINS if hostname is not testserver and DEBUG=False. :param request: HttpRequest :param e: Exception
jutil/middleware.py
def process_exception(self, request, e): """ Logs exception error message and sends email to ADMINS if hostname is not testserver and DEBUG=False. :param request: HttpRequest :param e: Exception """ from jutil.email import send_email assert isinstance(request, Ht...
def process_exception(self, request, e): """ Logs exception error message and sends email to ADMINS if hostname is not testserver and DEBUG=False. :param request: HttpRequest :param e: Exception """ from jutil.email import send_email assert isinstance(request, Ht...
[ "Logs", "exception", "error", "message", "and", "sends", "email", "to", "ADMINS", "if", "hostname", "is", "not", "testserver", "and", "DEBUG", "=", "False", ".", ":", "param", "request", ":", "HttpRequest", ":", "param", "e", ":", "Exception" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/middleware.py#L47-L63
[ "def", "process_exception", "(", "self", ",", "request", ",", "e", ")", ":", "from", "jutil", ".", "email", "import", "send_email", "assert", "isinstance", "(", "request", ",", "HttpRequest", ")", "full_path", "=", "request", ".", "get_full_path", "(", ")", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
get_first_builder_window
Get the first toplevel widget in a Gtk.Builder hierarchy. This is mostly used for guessing purposes, and an explicit naming is always going to be a better situation.
pygtk3_helpers/delegates.py
def get_first_builder_window(builder): """Get the first toplevel widget in a Gtk.Builder hierarchy. This is mostly used for guessing purposes, and an explicit naming is always going to be a better situation. """ for obj in builder.get_objects(): if isinstance(obj, Gtk.Window): #...
def get_first_builder_window(builder): """Get the first toplevel widget in a Gtk.Builder hierarchy. This is mostly used for guessing purposes, and an explicit naming is always going to be a better situation. """ for obj in builder.get_objects(): if isinstance(obj, Gtk.Window): #...
[ "Get", "the", "first", "toplevel", "widget", "in", "a", "Gtk", ".", "Builder", "hierarchy", "." ]
cfobel/pygtk3-helpers
python
https://github.com/cfobel/pygtk3-helpers/blob/ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519/pygtk3_helpers/delegates.py#L20-L29
[ "def", "get_first_builder_window", "(", "builder", ")", ":", "for", "obj", "in", "builder", ".", "get_objects", "(", ")", ":", "if", "isinstance", "(", "obj", ",", "Gtk", ".", "Window", ")", ":", "# first window", "return", "obj" ]
ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519
train
BaseDelegate.add_slave
Add a slave delegate
pygtk3_helpers/delegates.py
def add_slave(self, slave, container_name="widget"): """Add a slave delegate """ cont = getattr(self, container_name, None) if cont is None: raise AttributeError( 'Container name must be a member of the delegate') cont.add(slave.widget) self.sl...
def add_slave(self, slave, container_name="widget"): """Add a slave delegate """ cont = getattr(self, container_name, None) if cont is None: raise AttributeError( 'Container name must be a member of the delegate') cont.add(slave.widget) self.sl...
[ "Add", "a", "slave", "delegate" ]
cfobel/pygtk3-helpers
python
https://github.com/cfobel/pygtk3-helpers/blob/ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519/pygtk3_helpers/delegates.py#L103-L112
[ "def", "add_slave", "(", "self", ",", "slave", ",", "container_name", "=", "\"widget\"", ")", ":", "cont", "=", "getattr", "(", "self", ",", "container_name", ",", "None", ")", "if", "cont", "is", "None", ":", "raise", "AttributeError", "(", "'Container na...
ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519
train
SlaveView.get_builder_toplevel
Get the toplevel widget from a Gtk.Builder file. The slave view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, the first toplevel widget is discovered in the Builder file, and it's immediate child is used as the to...
pygtk3_helpers/delegates.py
def get_builder_toplevel(self, builder): """Get the toplevel widget from a Gtk.Builder file. The slave view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, the first toplevel widget is discovered in the Builder file...
def get_builder_toplevel(self, builder): """Get the toplevel widget from a Gtk.Builder file. The slave view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, the first toplevel widget is discovered in the Builder file...
[ "Get", "the", "toplevel", "widget", "from", "a", "Gtk", ".", "Builder", "file", "." ]
cfobel/pygtk3-helpers
python
https://github.com/cfobel/pygtk3-helpers/blob/ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519/pygtk3_helpers/delegates.py#L231-L246
[ "def", "get_builder_toplevel", "(", "self", ",", "builder", ")", ":", "toplevel", "=", "builder", ".", "get_object", "(", "self", ".", "toplevel_name", ")", "if", "toplevel", "is", "None", ":", "toplevel", "=", "get_first_builder_window", "(", "builder", ")", ...
ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519
train
SlaveView.show_and_run
Show the main widget in a window and run the gtk loop
pygtk3_helpers/delegates.py
def show_and_run(self): """Show the main widget in a window and run the gtk loop""" if not self._ui_ready: self.prepare_ui() self.display_widget = Gtk.Window() self.display_widget.add(self.widget) self.display_widget.show() self.display_widget.connect('destroy...
def show_and_run(self): """Show the main widget in a window and run the gtk loop""" if not self._ui_ready: self.prepare_ui() self.display_widget = Gtk.Window() self.display_widget.add(self.widget) self.display_widget.show() self.display_widget.connect('destroy...
[ "Show", "the", "main", "widget", "in", "a", "window", "and", "run", "the", "gtk", "loop" ]
cfobel/pygtk3-helpers
python
https://github.com/cfobel/pygtk3-helpers/blob/ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519/pygtk3_helpers/delegates.py#L251-L259
[ "def", "show_and_run", "(", "self", ")", ":", "if", "not", "self", ".", "_ui_ready", ":", "self", ".", "prepare_ui", "(", ")", "self", ".", "display_widget", "=", "Gtk", ".", "Window", "(", ")", "self", ".", "display_widget", ".", "add", "(", "self", ...
ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519
train
ToplevelView.get_builder_toplevel
Get the toplevel widget from a Gtk.Builder file. The main view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, or not a Gtk.Window, the first toplevel window found in the Gtk.Builder is used.
pygtk3_helpers/delegates.py
def get_builder_toplevel(self, builder): """Get the toplevel widget from a Gtk.Builder file. The main view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, or not a Gtk.Window, the first toplevel window found in the ...
def get_builder_toplevel(self, builder): """Get the toplevel widget from a Gtk.Builder file. The main view implementation first searches for the widget named as self.toplevel_name (which defaults to "main". If this is missing, or not a Gtk.Window, the first toplevel window found in the ...
[ "Get", "the", "toplevel", "widget", "from", "a", "Gtk", ".", "Builder", "file", "." ]
cfobel/pygtk3-helpers
python
https://github.com/cfobel/pygtk3-helpers/blob/ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519/pygtk3_helpers/delegates.py#L265-L278
[ "def", "get_builder_toplevel", "(", "self", ",", "builder", ")", ":", "toplevel", "=", "builder", ".", "get_object", "(", "self", ".", "toplevel_name", ")", "if", "not", "GObject", ".", "type_is_a", "(", "toplevel", ",", "Gtk", ".", "Window", ")", ":", "...
ae793cb34a5c1bbe40cc83bb8a6084f0eeed2519
train
round_sig
Round the number to the specified number of significant figures
src/python/pipelines_utils/utils.py
def round_sig(x, sig): """Round the number to the specified number of significant figures""" return round(x, sig - int(floor(log10(abs(x)))) - 1)
def round_sig(x, sig): """Round the number to the specified number of significant figures""" return round(x, sig - int(floor(log10(abs(x)))) - 1)
[ "Round", "the", "number", "to", "the", "specified", "number", "of", "significant", "figures" ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L30-L32
[ "def", "round_sig", "(", "x", ",", "sig", ")", ":", "return", "round", "(", "x", ",", "sig", "-", "int", "(", "floor", "(", "log10", "(", "abs", "(", "x", ")", ")", ")", ")", "-", "1", ")" ]
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
open_file
Open the file gunzipping it if it ends with .gz. If as_text the file is opened in text mode, otherwise the file's opened in binary mode.
src/python/pipelines_utils/utils.py
def open_file(filename, as_text=False): """Open the file gunzipping it if it ends with .gz. If as_text the file is opened in text mode, otherwise the file's opened in binary mode.""" if filename.lower().endswith('.gz'): if as_text: return gzip.open(filename, 'rt') else: ...
def open_file(filename, as_text=False): """Open the file gunzipping it if it ends with .gz. If as_text the file is opened in text mode, otherwise the file's opened in binary mode.""" if filename.lower().endswith('.gz'): if as_text: return gzip.open(filename, 'rt') else: ...
[ "Open", "the", "file", "gunzipping", "it", "if", "it", "ends", "with", ".", "gz", ".", "If", "as_text", "the", "file", "is", "opened", "in", "text", "mode", "otherwise", "the", "file", "s", "opened", "in", "binary", "mode", "." ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L35-L48
[ "def", "open_file", "(", "filename", ",", "as_text", "=", "False", ")", ":", "if", "filename", ".", "lower", "(", ")", ".", "endswith", "(", "'.gz'", ")", ":", "if", "as_text", ":", "return", "gzip", ".", "open", "(", "filename", ",", "'rt'", ")", ...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
create_simple_writer
Create a simple writer suitable for writing flat data e.g. as BasicObject or TSV.
src/python/pipelines_utils/utils.py
def create_simple_writer(outputDef, defaultOutput, outputFormat, fieldNames, compress=True, valueClassMappings=None, datasetMetaProps=None, fieldMetaProps=None): """Create a simple writer suitable for writing flat data e.g. as BasicObject or TSV.""" if not ...
def create_simple_writer(outputDef, defaultOutput, outputFormat, fieldNames, compress=True, valueClassMappings=None, datasetMetaProps=None, fieldMetaProps=None): """Create a simple writer suitable for writing flat data e.g. as BasicObject or TSV.""" if not ...
[ "Create", "a", "simple", "writer", "suitable", "for", "writing", "flat", "data", "e", ".", "g", ".", "as", "BasicObject", "or", "TSV", "." ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L51-L71
[ "def", "create_simple_writer", "(", "outputDef", ",", "defaultOutput", ",", "outputFormat", ",", "fieldNames", ",", "compress", "=", "True", ",", "valueClassMappings", "=", "None", ",", "datasetMetaProps", "=", "None", ",", "fieldMetaProps", "=", "None", ")", ":...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
write_squonk_datasetmetadata
This is a temp hack to write the minimal metadata that Squonk needs. Will needs to be replaced with something that allows something more complete to be written. :param outputBase: Base name for the file to write to :param thinOutput: Write only new data, not structures. Result type will be BasicObject ...
src/python/pipelines_utils/utils.py
def write_squonk_datasetmetadata(outputBase, thinOutput, valueClassMappings, datasetMetaProps, fieldMetaProps): """This is a temp hack to write the minimal metadata that Squonk needs. Will needs to be replaced with something that allows something more complete to be written. :param outputBase: Base name fo...
def write_squonk_datasetmetadata(outputBase, thinOutput, valueClassMappings, datasetMetaProps, fieldMetaProps): """This is a temp hack to write the minimal metadata that Squonk needs. Will needs to be replaced with something that allows something more complete to be written. :param outputBase: Base name fo...
[ "This", "is", "a", "temp", "hack", "to", "write", "the", "minimal", "metadata", "that", "Squonk", "needs", ".", "Will", "needs", "to", "be", "replaced", "with", "something", "that", "allows", "something", "more", "complete", "to", "be", "written", "." ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L90-L124
[ "def", "write_squonk_datasetmetadata", "(", "outputBase", ",", "thinOutput", ",", "valueClassMappings", ",", "datasetMetaProps", ",", "fieldMetaProps", ")", ":", "meta", "=", "{", "}", "props", "=", "{", "}", "# TODO add created property - how to handle date formats?", ...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
write_metrics
Write the metrics data :param baseName: The base name of the output files. e.g. extensions will be appended to this base name :param values dictionary of values to write
src/python/pipelines_utils/utils.py
def write_metrics(baseName, values): """Write the metrics data :param baseName: The base name of the output files. e.g. extensions will be appended to this base name :param values dictionary of values to write """ m = open(baseName + '_metrics.txt', 'w') for key in values:...
def write_metrics(baseName, values): """Write the metrics data :param baseName: The base name of the output files. e.g. extensions will be appended to this base name :param values dictionary of values to write """ m = open(baseName + '_metrics.txt', 'w') for key in values:...
[ "Write", "the", "metrics", "data" ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L127-L138
[ "def", "write_metrics", "(", "baseName", ",", "values", ")", ":", "m", "=", "open", "(", "baseName", "+", "'_metrics.txt'", ",", "'w'", ")", "for", "key", "in", "values", ":", "m", ".", "write", "(", "key", "+", "'='", "+", "str", "(", "values", "[...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
generate_molecule_object_dict
Generate a dictionary that represents a Squonk MoleculeObject when written as JSON :param source: Molecules in molfile or smiles format :param format: The format of the molecule. Either 'mol' or 'smiles' :param values: Optional dict of values (properties) for the MoleculeObject
src/python/pipelines_utils/utils.py
def generate_molecule_object_dict(source, format, values): """Generate a dictionary that represents a Squonk MoleculeObject when written as JSON :param source: Molecules in molfile or smiles format :param format: The format of the molecule. Either 'mol' or 'smiles' :param values: Optional dict of v...
def generate_molecule_object_dict(source, format, values): """Generate a dictionary that represents a Squonk MoleculeObject when written as JSON :param source: Molecules in molfile or smiles format :param format: The format of the molecule. Either 'mol' or 'smiles' :param values: Optional dict of v...
[ "Generate", "a", "dictionary", "that", "represents", "a", "Squonk", "MoleculeObject", "when", "written", "as", "JSON" ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L141-L152
[ "def", "generate_molecule_object_dict", "(", "source", ",", "format", ",", "values", ")", ":", "m", "=", "{", "\"uuid\"", ":", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", ",", "\"source\"", ":", "source", ",", "\"format\"", ":", "format", "}", "if...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
get_undecorated_calling_module
Returns the module name of the caller's calling module. If a.py makes a call to b() in b.py, b() can get the name of the calling module (i.e. a) by calling get_undecorated_calling_module(). The module also includes its full path. As the name suggests, this does not work for decorated functions.
src/python/pipelines_utils/utils.py
def get_undecorated_calling_module(): """Returns the module name of the caller's calling module. If a.py makes a call to b() in b.py, b() can get the name of the calling module (i.e. a) by calling get_undecorated_calling_module(). The module also includes its full path. As the name suggests, this ...
def get_undecorated_calling_module(): """Returns the module name of the caller's calling module. If a.py makes a call to b() in b.py, b() can get the name of the calling module (i.e. a) by calling get_undecorated_calling_module(). The module also includes its full path. As the name suggests, this ...
[ "Returns", "the", "module", "name", "of", "the", "caller", "s", "calling", "module", ".", "If", "a", ".", "py", "makes", "a", "call", "to", "b", "()", "in", "b", ".", "py", "b", "()", "can", "get", "the", "name", "of", "the", "calling", "module", ...
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/utils.py#L155-L169
[ "def", "get_undecorated_calling_module", "(", ")", ":", "frame", "=", "inspect", ".", "stack", "(", ")", "[", "2", "]", "module", "=", "inspect", ".", "getmodule", "(", "frame", "[", "0", "]", ")", "# Return the module's file and its path", "# and omit the exten...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
query_nexus
Queries Nexus for an artifact :param query_url: (str) Query URL :param timeout_sec: (int) query timeout :param basic_auth (HTTPBasicAuth) object or none :return: requests.Response object :raises: RuntimeError
pycons3rt/nexus.py
def query_nexus(query_url, timeout_sec, basic_auth=None): """Queries Nexus for an artifact :param query_url: (str) Query URL :param timeout_sec: (int) query timeout :param basic_auth (HTTPBasicAuth) object or none :return: requests.Response object :raises: RuntimeError """ log = logging...
def query_nexus(query_url, timeout_sec, basic_auth=None): """Queries Nexus for an artifact :param query_url: (str) Query URL :param timeout_sec: (int) query timeout :param basic_auth (HTTPBasicAuth) object or none :return: requests.Response object :raises: RuntimeError """ log = logging...
[ "Queries", "Nexus", "for", "an", "artifact" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/nexus.py#L39-L93
[ "def", "query_nexus", "(", "query_url", ",", "timeout_sec", ",", "basic_auth", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.query_nexus'", ")", "# Attempt to query Nexus", "retry_sec", "=", "5", "max_retries", "=", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
get_artifact
Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of the Nexus Server :param timeout_sec: (int) Number of seconds to wait before timing out the artifact retrieval. :param overwrite: (bool) True overwrites...
pycons3rt/nexus.py
def get_artifact(suppress_status=False, nexus_url=sample_nexus_url, timeout_sec=600, overwrite=True, username=None, password=None, **kwargs): """Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of t...
def get_artifact(suppress_status=False, nexus_url=sample_nexus_url, timeout_sec=600, overwrite=True, username=None, password=None, **kwargs): """Retrieves an artifact from Nexus :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_url: (str) URL of t...
[ "Retrieves", "an", "artifact", "from", "Nexus" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/nexus.py#L96-L299
[ "def", "get_artifact", "(", "suppress_status", "=", "False", ",", "nexus_url", "=", "sample_nexus_url", ",", "timeout_sec", "=", "600", ",", "overwrite", "=", "True", ",", "username", "=", "None", ",", "password", "=", "None", ",", "*", "*", "kwargs", ")",...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
get_artifact_nexus3
Retrieves an artifact from the Nexus 3 ReST API :param suppress_status: (bool) Set to True to suppress printing download status :param nexus_base_url: (str) Base URL of the Nexus Server (domain name portion only, see sample) :param repository: (str) Repository to query (e.g. snapshots) if not provided, wil...
pycons3rt/nexus.py
def get_artifact_nexus3(suppress_status=False, nexus_base_url=sample_nexus_base_url, repository=None, timeout_sec=600, overwrite=True, username=None, password=None, **kwargs): """Retrieves an artifact from the Nexus 3 ReST API :param suppress_status: (bool) Set to True to suppress print...
def get_artifact_nexus3(suppress_status=False, nexus_base_url=sample_nexus_base_url, repository=None, timeout_sec=600, overwrite=True, username=None, password=None, **kwargs): """Retrieves an artifact from the Nexus 3 ReST API :param suppress_status: (bool) Set to True to suppress print...
[ "Retrieves", "an", "artifact", "from", "the", "Nexus", "3", "ReST", "API" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/nexus.py#L302-L553
[ "def", "get_artifact_nexus3", "(", "suppress_status", "=", "False", ",", "nexus_base_url", "=", "sample_nexus_base_url", ",", "repository", "=", "None", ",", "timeout_sec", "=", "600", ",", "overwrite", "=", "True", ",", "username", "=", "None", ",", "password",...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
main
Handles calling this module as a script :return: None
pycons3rt/nexus.py
def main(): """Handles calling this module as a script :return: None """ log = logging.getLogger(mod_logger + '.main') parser = argparse.ArgumentParser(description='This Python module retrieves artifacts from Nexus.') parser.add_argument('-u', '--url', help='Nexus Server URL', required=False) ...
def main(): """Handles calling this module as a script :return: None """ log = logging.getLogger(mod_logger + '.main') parser = argparse.ArgumentParser(description='This Python module retrieves artifacts from Nexus.') parser.add_argument('-u', '--url', help='Nexus Server URL', required=False) ...
[ "Handles", "calling", "this", "module", "as", "a", "script" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/nexus.py#L556-L591
[ "def", "main", "(", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.main'", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'This Python module retrieves artifacts from Nexus.'", ")", "parser", ".", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
get_doc
Return a formated string containing documentation about the audio fields.
phrydy/doc.py
def get_doc(additional_doc=False, field_prefix='$', field_suffix=':', indent=4): """Return a formated string containing documentation about the audio fields. """ if additional_doc: f = fields.copy() f.update(additional_doc) else: f = fields...
def get_doc(additional_doc=False, field_prefix='$', field_suffix=':', indent=4): """Return a formated string containing documentation about the audio fields. """ if additional_doc: f = fields.copy() f.update(additional_doc) else: f = fields...
[ "Return", "a", "formated", "string", "containing", "documentation", "about", "the", "audio", "fields", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/doc.py#L413-L440
[ "def", "get_doc", "(", "additional_doc", "=", "False", ",", "field_prefix", "=", "'$'", ",", "field_suffix", "=", "':'", ",", "indent", "=", "4", ")", ":", "if", "additional_doc", ":", "f", "=", "fields", ".", "copy", "(", ")", "f", ".", "update", "(...
aa13755155977b4776e49f79984f9968ac1d74dc
train
RegistryClient.list_images
List images stored in the registry. Returns: list[str]: List of image names.
src/peltak/extra/docker/client.py
def list_images(self): # type: () -> List[str] """ List images stored in the registry. Returns: list[str]: List of image names. """ r = self.get(self.registry_url + '/v2/_catalog', auth=self.auth) return r.json()['repositories']
def list_images(self): # type: () -> List[str] """ List images stored in the registry. Returns: list[str]: List of image names. """ r = self.get(self.registry_url + '/v2/_catalog', auth=self.auth) return r.json()['repositories']
[ "List", "images", "stored", "in", "the", "registry", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/docker/client.py#L53-L61
[ "def", "list_images", "(", "self", ")", ":", "# type: () -> List[str]", "r", "=", "self", ".", "get", "(", "self", ".", "registry_url", "+", "'/v2/_catalog'", ",", "auth", "=", "self", ".", "auth", ")", "return", "r", ".", "json", "(", ")", "[", "'repo...
b627acc019e3665875fe76cdca0a14773b69beaa
train
RegistryClient.list_tags
List all tags for the given image stored in the registry. Args: image_name (str): The name of the image to query. The image must be present on the registry for this call to return any values. Returns: list[str]: List of tags for that image.
src/peltak/extra/docker/client.py
def list_tags(self, image_name): # type: (str) -> Iterator[str] """ List all tags for the given image stored in the registry. Args: image_name (str): The name of the image to query. The image must be present on the registry for this call to return any...
def list_tags(self, image_name): # type: (str) -> Iterator[str] """ List all tags for the given image stored in the registry. Args: image_name (str): The name of the image to query. The image must be present on the registry for this call to return any...
[ "List", "all", "tags", "for", "the", "given", "image", "stored", "in", "the", "registry", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/docker/client.py#L63-L82
[ "def", "list_tags", "(", "self", ",", "image_name", ")", ":", "# type: (str) -> Iterator[str]", "tags_url", "=", "self", ".", "registry_url", "+", "'/v2/{}/tags/list'", "r", "=", "self", ".", "get", "(", "tags_url", ".", "format", "(", "image_name", ")", ",", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
validate_asset_structure
Checks asset structure validity :param asset_dir_path: (str) path to the directory containing the asset :return: (str) Asset name :raises: Cons3rtAssetStructureError
pycons3rt/asset.py
def validate_asset_structure(asset_dir_path): """Checks asset structure validity :param asset_dir_path: (str) path to the directory containing the asset :return: (str) Asset name :raises: Cons3rtAssetStructureError """ log = logging.getLogger(mod_logger + '.validate_asset_structure') log.i...
def validate_asset_structure(asset_dir_path): """Checks asset structure validity :param asset_dir_path: (str) path to the directory containing the asset :return: (str) Asset name :raises: Cons3rtAssetStructureError """ log = logging.getLogger(mod_logger + '.validate_asset_structure') log.i...
[ "Checks", "asset", "structure", "validity" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/asset.py#L122-L253
[ "def", "validate_asset_structure", "(", "asset_dir_path", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.validate_asset_structure'", ")", "log", ".", "info", "(", "'Validating asset directory: {d}'", ".", "format", "(", "d", "=", "as...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
make_asset_zip
Given an asset directory path, creates an asset zip file in the provided destination directory :param asset_dir_path: (str) path to the directory containing the asset :param destination_directory: (str) path to the destination directory for the asset :return: (str) Path to the asset zip fil...
pycons3rt/asset.py
def make_asset_zip(asset_dir_path, destination_directory=None): """Given an asset directory path, creates an asset zip file in the provided destination directory :param asset_dir_path: (str) path to the directory containing the asset :param destination_directory: (str) path to the destination directory...
def make_asset_zip(asset_dir_path, destination_directory=None): """Given an asset directory path, creates an asset zip file in the provided destination directory :param asset_dir_path: (str) path to the directory containing the asset :param destination_directory: (str) path to the destination directory...
[ "Given", "an", "asset", "directory", "path", "creates", "an", "asset", "zip", "file", "in", "the", "provided", "destination", "directory" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/asset.py#L256-L345
[ "def", "make_asset_zip", "(", "asset_dir_path", ",", "destination_directory", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.make_asset_zip'", ")", "log", ".", "info", "(", "'Attempting to create an asset zip from directory:...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
validate
Command line call to validate an asset structure :param asset_dir: (full path to the asset dir) :return: (int)
pycons3rt/asset.py
def validate(asset_dir): """Command line call to validate an asset structure :param asset_dir: (full path to the asset dir) :return: (int) """ try: asset_name = validate_asset_structure(asset_dir_path=asset_dir) except Cons3rtAssetStructureError: _, ex, trace = sys.exc_info() ...
def validate(asset_dir): """Command line call to validate an asset structure :param asset_dir: (full path to the asset dir) :return: (int) """ try: asset_name = validate_asset_structure(asset_dir_path=asset_dir) except Cons3rtAssetStructureError: _, ex, trace = sys.exc_info() ...
[ "Command", "line", "call", "to", "validate", "an", "asset", "structure" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/asset.py#L348-L362
[ "def", "validate", "(", "asset_dir", ")", ":", "try", ":", "asset_name", "=", "validate_asset_structure", "(", "asset_dir_path", "=", "asset_dir", ")", "except", "Cons3rtAssetStructureError", ":", "_", ",", "ex", ",", "trace", "=", "sys", ".", "exc_info", "(",...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
create
Command line call to create an asset zip :param asset_dir: (full path to the asset dir) :param dest_dir: (full path to the destination directory) :return: (int)
pycons3rt/asset.py
def create(asset_dir, dest_dir): """Command line call to create an asset zip :param asset_dir: (full path to the asset dir) :param dest_dir: (full path to the destination directory) :return: (int) """ val = validate(asset_dir=asset_dir) if val != 0: return 1 try: asset_z...
def create(asset_dir, dest_dir): """Command line call to create an asset zip :param asset_dir: (full path to the asset dir) :param dest_dir: (full path to the destination directory) :return: (int) """ val = validate(asset_dir=asset_dir) if val != 0: return 1 try: asset_z...
[ "Command", "line", "call", "to", "create", "an", "asset", "zip" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/asset.py#L365-L383
[ "def", "create", "(", "asset_dir", ",", "dest_dir", ")", ":", "val", "=", "validate", "(", "asset_dir", "=", "asset_dir", ")", "if", "val", "!=", "0", ":", "return", "1", "try", ":", "asset_zip", "=", "make_asset_zip", "(", "asset_dir_path", "=", "asset_...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
get_object_or_none
Returns model instance or None if not found. :param cls: Class or queryset :param kwargs: Filters for get() call :return: Object or None
jutil/model.py
def get_object_or_none(cls, **kwargs): """ Returns model instance or None if not found. :param cls: Class or queryset :param kwargs: Filters for get() call :return: Object or None """ from django.shortcuts import _get_queryset qs = _get_queryset(cls) try: return qs.get(**kwar...
def get_object_or_none(cls, **kwargs): """ Returns model instance or None if not found. :param cls: Class or queryset :param kwargs: Filters for get() call :return: Object or None """ from django.shortcuts import _get_queryset qs = _get_queryset(cls) try: return qs.get(**kwar...
[ "Returns", "model", "instance", "or", "None", "if", "not", "found", ".", ":", "param", "cls", ":", "Class", "or", "queryset", ":", "param", "kwargs", ":", "Filters", "for", "get", "()", "call", ":", "return", ":", "Object", "or", "None" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/model.py#L5-L17
[ "def", "get_object_or_none", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "from", "django", ".", "shortcuts", "import", "_get_queryset", "qs", "=", "_get_queryset", "(", "cls", ")", "try", ":", "return", "qs", ".", "get", "(", "*", "*", "kwargs", ")"...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
get_model_field_label_and_value
Returns model field label and value. :param instance: Model instance :param field_name: Model attribute name :return: (label, value) tuple
jutil/model.py
def get_model_field_label_and_value(instance, field_name) -> (str, str): """ Returns model field label and value. :param instance: Model instance :param field_name: Model attribute name :return: (label, value) tuple """ label = field_name value = str(getattr(instance, field_name)) fo...
def get_model_field_label_and_value(instance, field_name) -> (str, str): """ Returns model field label and value. :param instance: Model instance :param field_name: Model attribute name :return: (label, value) tuple """ label = field_name value = str(getattr(instance, field_name)) fo...
[ "Returns", "model", "field", "label", "and", "value", ".", ":", "param", "instance", ":", "Model", "instance", ":", "param", "field_name", ":", "Model", "attribute", "name", ":", "return", ":", "(", "label", "value", ")", "tuple" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/model.py#L20-L35
[ "def", "get_model_field_label_and_value", "(", "instance", ",", "field_name", ")", "->", "(", "str", ",", "str", ")", ":", "label", "=", "field_name", "value", "=", "str", "(", "getattr", "(", "instance", ",", "field_name", ")", ")", "for", "f", "in", "i...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
clone_model
Assigns model fields to new object. Ignores exclude_fields list and attributes ending with pointer suffix (default '_ptr') :param instance: Instance to copy :param cls: Class name :param commit: Save or not :param exclude_fields: List of fields to exclude :param base_class_suffix: End of name fo...
jutil/model.py
def clone_model(instance, cls, commit: bool=True, exclude_fields: tuple=('id',), base_class_suffix: str='_ptr', **kw): """ Assigns model fields to new object. Ignores exclude_fields list and attributes ending with pointer suffix (default '_ptr') :param instance: Instance to copy :param cls: Class na...
def clone_model(instance, cls, commit: bool=True, exclude_fields: tuple=('id',), base_class_suffix: str='_ptr', **kw): """ Assigns model fields to new object. Ignores exclude_fields list and attributes ending with pointer suffix (default '_ptr') :param instance: Instance to copy :param cls: Class na...
[ "Assigns", "model", "fields", "to", "new", "object", ".", "Ignores", "exclude_fields", "list", "and", "attributes", "ending", "with", "pointer", "suffix", "(", "default", "_ptr", ")", ":", "param", "instance", ":", "Instance", "to", "copy", ":", "param", "cl...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/model.py#L38-L58
[ "def", "clone_model", "(", "instance", ",", "cls", ",", "commit", ":", "bool", "=", "True", ",", "exclude_fields", ":", "tuple", "=", "(", "'id'", ",", ")", ",", "base_class_suffix", ":", "str", "=", "'_ptr'", ",", "*", "*", "kw", ")", ":", "keys", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
IdentitySearchList.get_queryset
This view should return a list of all the Identities for the supplied query parameters. The query parameters should be in the form: {"address_type": "address"} e.g. {"msisdn": "+27123"} {"email": "foo@bar.com"} A special query paramater "include_inactive" can als...
identities/views.py
def get_queryset(self): """ This view should return a list of all the Identities for the supplied query parameters. The query parameters should be in the form: {"address_type": "address"} e.g. {"msisdn": "+27123"} {"email": "foo@bar.com"} A specia...
def get_queryset(self): """ This view should return a list of all the Identities for the supplied query parameters. The query parameters should be in the form: {"address_type": "address"} e.g. {"msisdn": "+27123"} {"email": "foo@bar.com"} A specia...
[ "This", "view", "should", "return", "a", "list", "of", "all", "the", "Identities", "for", "the", "supplied", "query", "parameters", ".", "The", "query", "parameters", "should", "be", "in", "the", "form", ":", "{", "address_type", ":", "address", "}", "e", ...
praekeltfoundation/seed-identity-store
python
https://github.com/praekeltfoundation/seed-identity-store/blob/194e5756b5a74ebce9798c390de958cf5305b105/identities/views.py#L131-L210
[ "def", "get_queryset", "(", "self", ")", ":", "query_params", "=", "list", "(", "self", ".", "request", ".", "query_params", ".", "keys", "(", ")", ")", "# variable that stores criteria to filter identities by", "filter_criteria", "=", "{", "}", "# variable that sto...
194e5756b5a74ebce9798c390de958cf5305b105
train
IdentityAddresses.get_queryset
This view should return a list of all the addresses the identity has for the supplied query parameters. Currently only supports address_type and default params Always excludes addresses with optedout = True
identities/views.py
def get_queryset(self): """ This view should return a list of all the addresses the identity has for the supplied query parameters. Currently only supports address_type and default params Always excludes addresses with optedout = True """ identity_id = self.kwargs...
def get_queryset(self): """ This view should return a list of all the addresses the identity has for the supplied query parameters. Currently only supports address_type and default params Always excludes addresses with optedout = True """ identity_id = self.kwargs...
[ "This", "view", "should", "return", "a", "list", "of", "all", "the", "addresses", "the", "identity", "has", "for", "the", "supplied", "query", "parameters", ".", "Currently", "only", "supports", "address_type", "and", "default", "params", "Always", "excludes", ...
praekeltfoundation/seed-identity-store
python
https://github.com/praekeltfoundation/seed-identity-store/blob/194e5756b5a74ebce9798c390de958cf5305b105/identities/views.py#L279-L299
[ "def", "get_queryset", "(", "self", ")", ":", "identity_id", "=", "self", ".", "kwargs", "[", "\"identity_id\"", "]", "address_type", "=", "self", ".", "kwargs", "[", "\"address_type\"", "]", "use_ct", "=", "\"use_communicate_through\"", "in", "self", ".", "re...
194e5756b5a74ebce9798c390de958cf5305b105
train
IsogeoChecker.check_internet_connection
Test if an internet connection is operational. Src: http://stackoverflow.com/a/20913928/2556577. :param str remote_server: remote server used to check
isogeo_pysdk/checker.py
def check_internet_connection(self, remote_server: str = "api.isogeo.com") -> bool: """Test if an internet connection is operational. Src: http://stackoverflow.com/a/20913928/2556577. :param str remote_server: remote server used to check """ try: # see if we can reso...
def check_internet_connection(self, remote_server: str = "api.isogeo.com") -> bool: """Test if an internet connection is operational. Src: http://stackoverflow.com/a/20913928/2556577. :param str remote_server: remote server used to check """ try: # see if we can reso...
[ "Test", "if", "an", "internet", "connection", "is", "operational", ".", "Src", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "20913928", "/", "2556577", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L109-L125
[ "def", "check_internet_connection", "(", "self", ",", "remote_server", ":", "str", "=", "\"api.isogeo.com\"", ")", "->", "bool", ":", "try", ":", "# see if we can resolve the host name -- tells us if there is", "# a DNS listening", "host", "=", "socket", ".", "gethostbyna...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker.check_bearer_validity
Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this method checks the validity of the token with a 30 mn anticipation limit, and renews it if necessary. See: http://tools.ietf.org/html/rfc6750#section-2 FI: 2...
isogeo_pysdk/checker.py
def check_bearer_validity(self, token: dict, connect_mtd) -> dict: """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this method checks the validity of the token with a 30 mn anticipation limit, and renews it if neces...
def check_bearer_validity(self, token: dict, connect_mtd) -> dict: """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this method checks the validity of the token with a 30 mn anticipation limit, and renews it if neces...
[ "Check", "API", "Bearer", "token", "validity", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L127-L154
[ "def", "check_bearer_validity", "(", "self", ",", "token", ":", "dict", ",", "connect_mtd", ")", "->", "dict", ":", "warnings", ".", "warn", "(", "\"Method is now executed as a decorator within the main SDK class. Will be removed in future versions.\"", ",", "DeprecationWarni...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker.check_api_response
Check API response and raise exceptions if needed. :param requests.models.Response response: request response to check
isogeo_pysdk/checker.py
def check_api_response(self, response): """Check API response and raise exceptions if needed. :param requests.models.Response response: request response to check """ # check response if response.status_code == 200: return True elif response.status_code >= 400...
def check_api_response(self, response): """Check API response and raise exceptions if needed. :param requests.models.Response response: request response to check """ # check response if response.status_code == 200: return True elif response.status_code >= 400...
[ "Check", "API", "response", "and", "raise", "exceptions", "if", "needed", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L156-L173
[ "def", "check_api_response", "(", "self", ",", "response", ")", ":", "# check response", "if", "response", ".", "status_code", "==", "200", ":", "return", "True", "elif", "response", ".", "status_code", ">=", "400", ":", "logging", ".", "error", "(", "\"{}: ...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker.check_request_parameters
Check parameters passed to avoid errors and help debug. :param dict response: search request parameters
isogeo_pysdk/checker.py
def check_request_parameters(self, parameters: dict = dict): """Check parameters passed to avoid errors and help debug. :param dict response: search request parameters """ # -- SEMANTIC QUERY --------------------------------------------------- li_args = parameters.get("q").split...
def check_request_parameters(self, parameters: dict = dict): """Check parameters passed to avoid errors and help debug. :param dict response: search request parameters """ # -- SEMANTIC QUERY --------------------------------------------------- li_args = parameters.get("q").split...
[ "Check", "parameters", "passed", "to", "avoid", "errors", "and", "help", "debug", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L175-L281
[ "def", "check_request_parameters", "(", "self", ",", "parameters", ":", "dict", "=", "dict", ")", ":", "# -- SEMANTIC QUERY ---------------------------------------------------", "li_args", "=", "parameters", ".", "get", "(", "\"q\"", ")", ".", "split", "(", ")", "lo...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker.check_is_uuid
Check if it's an Isogeo UUID handling specific form. :param str uuid_str: UUID string to check
isogeo_pysdk/checker.py
def check_is_uuid(self, uuid_str: str): """Check if it's an Isogeo UUID handling specific form. :param str uuid_str: UUID string to check """ # check uuid type if not isinstance(uuid_str, str): raise TypeError("'uuid_str' expected a str value.") else: ...
def check_is_uuid(self, uuid_str: str): """Check if it's an Isogeo UUID handling specific form. :param str uuid_str: UUID string to check """ # check uuid type if not isinstance(uuid_str, str): raise TypeError("'uuid_str' expected a str value.") else: ...
[ "Check", "if", "it", "s", "an", "Isogeo", "UUID", "handling", "specific", "form", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L283-L306
[ "def", "check_is_uuid", "(", "self", ",", "uuid_str", ":", "str", ")", ":", "# check uuid type", "if", "not", "isinstance", "(", "uuid_str", ",", "str", ")", ":", "raise", "TypeError", "(", "\"'uuid_str' expected a str value.\"", ")", "else", ":", "pass", "# h...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker.check_edit_tab
Check if asked tab is part of Isogeo web form and reliable with metadata type. :param str tab: tab to check. Must be one one of EDIT_TABS attribute :param str md_type: metadata type. Must be one one of FILTER_TYPES
isogeo_pysdk/checker.py
def check_edit_tab(self, tab: str, md_type: str): """Check if asked tab is part of Isogeo web form and reliable with metadata type. :param str tab: tab to check. Must be one one of EDIT_TABS attribute :param str md_type: metadata type. Must be one one of FILTER_TYPES """ ...
def check_edit_tab(self, tab: str, md_type: str): """Check if asked tab is part of Isogeo web form and reliable with metadata type. :param str tab: tab to check. Must be one one of EDIT_TABS attribute :param str md_type: metadata type. Must be one one of FILTER_TYPES """ ...
[ "Check", "if", "asked", "tab", "is", "part", "of", "Isogeo", "web", "form", "and", "reliable", "with", "metadata", "type", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L308-L349
[ "def", "check_edit_tab", "(", "self", ",", "tab", ":", "str", ",", "md_type", ":", "str", ")", ":", "# check parameters types", "if", "not", "isinstance", "(", "tab", ",", "str", ")", ":", "raise", "TypeError", "(", "\"'tab' expected a str value.\"", ")", "e...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker._check_filter_specific_md
Check if specific_md parameter is valid. :param list specific_md: list of specific metadata UUID to check
isogeo_pysdk/checker.py
def _check_filter_specific_md(self, specific_md: list): """Check if specific_md parameter is valid. :param list specific_md: list of specific metadata UUID to check """ if isinstance(specific_md, list): if len(specific_md) > 0: # checking UUIDs and poping bad...
def _check_filter_specific_md(self, specific_md: list): """Check if specific_md parameter is valid. :param list specific_md: list of specific metadata UUID to check """ if isinstance(specific_md, list): if len(specific_md) > 0: # checking UUIDs and poping bad...
[ "Check", "if", "specific_md", "parameter", "is", "valid", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L352-L370
[ "def", "_check_filter_specific_md", "(", "self", ",", "specific_md", ":", "list", ")", ":", "if", "isinstance", "(", "specific_md", ",", "list", ")", ":", "if", "len", "(", "specific_md", ")", ">", "0", ":", "# checking UUIDs and poping bad ones", "for", "md",...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker._check_filter_specific_tag
Check if specific_tag parameter is valid. :param list specific_tag: list of specific tag to check
isogeo_pysdk/checker.py
def _check_filter_specific_tag(self, specific_tag: list): """Check if specific_tag parameter is valid. :param list specific_tag: list of specific tag to check """ if isinstance(specific_tag, list): if len(specific_tag) > 0: specific_tag = ",".join(specific_ta...
def _check_filter_specific_tag(self, specific_tag: list): """Check if specific_tag parameter is valid. :param list specific_tag: list of specific tag to check """ if isinstance(specific_tag, list): if len(specific_tag) > 0: specific_tag = ",".join(specific_ta...
[ "Check", "if", "specific_tag", "parameter", "is", "valid", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L372-L384
[ "def", "_check_filter_specific_tag", "(", "self", ",", "specific_tag", ":", "list", ")", ":", "if", "isinstance", "(", "specific_tag", ",", "list", ")", ":", "if", "len", "(", "specific_tag", ")", ">", "0", ":", "specific_tag", "=", "\",\"", ".", "join", ...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker._check_filter_includes
Check if specific_resources parameter is valid. :param list includes: sub resources to check :param str resource: resource type to check sub resources. Must be one of: metadata | keyword.
isogeo_pysdk/checker.py
def _check_filter_includes(self, includes: list, resource: str = "metadata"): """Check if specific_resources parameter is valid. :param list includes: sub resources to check :param str resource: resource type to check sub resources. Must be one of: metadata | keyword. """ ...
def _check_filter_includes(self, includes: list, resource: str = "metadata"): """Check if specific_resources parameter is valid. :param list includes: sub resources to check :param str resource: resource type to check sub resources. Must be one of: metadata | keyword. """ ...
[ "Check", "if", "specific_resources", "parameter", "is", "valid", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L386-L411
[ "def", "_check_filter_includes", "(", "self", ",", "includes", ":", "list", ",", "resource", ":", "str", "=", "\"metadata\"", ")", ":", "# check resource parameter", "if", "resource", "==", "\"metadata\"", ":", "ref_subresources", "=", "_SUBRESOURCES_MD", "elif", ...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker._check_subresource
Check if specific_resources parameter is valid. :param str resource: subresource to check.
isogeo_pysdk/checker.py
def _check_subresource(self, subresource: str): """Check if specific_resources parameter is valid. :param str resource: subresource to check. """ warnings.warn( "subresource in URL is deprecated." " Use _include mecanism instead.", DeprecationWarning, ) ...
def _check_subresource(self, subresource: str): """Check if specific_resources parameter is valid. :param str resource: subresource to check. """ warnings.warn( "subresource in URL is deprecated." " Use _include mecanism instead.", DeprecationWarning, ) ...
[ "Check", "if", "specific_resources", "parameter", "is", "valid", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L413-L460
[ "def", "_check_subresource", "(", "self", ",", "subresource", ":", "str", ")", ":", "warnings", ".", "warn", "(", "\"subresource in URL is deprecated.\"", "\" Use _include mecanism instead.\"", ",", "DeprecationWarning", ",", ")", "l_subresources", "=", "(", "\"conditio...
57a604be92c7767b26abd247012cc1a584b386a0
train
IsogeoChecker._convert_md_type
Metadata types are not consistent in Isogeo API. A vector dataset is defined as vector-dataset in query filter but as vectorDataset in resource (metadata) details. see: https://github.com/isogeo/isogeo-api-py-minsdk/issues/29
isogeo_pysdk/checker.py
def _convert_md_type(self, type_to_convert: str): """Metadata types are not consistent in Isogeo API. A vector dataset is defined as vector-dataset in query filter but as vectorDataset in resource (metadata) details. see: https://github.com/isogeo/isogeo-api-py-minsdk/issues/29 ...
def _convert_md_type(self, type_to_convert: str): """Metadata types are not consistent in Isogeo API. A vector dataset is defined as vector-dataset in query filter but as vectorDataset in resource (metadata) details. see: https://github.com/isogeo/isogeo-api-py-minsdk/issues/29 ...
[ "Metadata", "types", "are", "not", "consistent", "in", "Isogeo", "API", ".", "A", "vector", "dataset", "is", "defined", "as", "vector", "-", "dataset", "in", "query", "filter", "but", "as", "vectorDataset", "in", "resource", "(", "metadata", ")", "details", ...
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/checker.py#L462-L476
[ "def", "_convert_md_type", "(", "self", ",", "type_to_convert", ":", "str", ")", ":", "if", "type_to_convert", "in", "FILTER_TYPES", ":", "return", "FILTER_TYPES", ".", "get", "(", "type_to_convert", ")", "elif", "type_to_convert", "in", "FILTER_TYPES", ".", "va...
57a604be92c7767b26abd247012cc1a584b386a0
train
version_cli
Show project version. Has sub commands. For this command to work you must specify where the project version is stored. You can do that with version_file conf variable. peltak supports multiple ways to store the project version. Right now you can store it in a python file using built-in __version__ vari...
src/peltak/commands/version.py
def version_cli(ctx, porcelain): # type: (click.Context, bool) -> None """ Show project version. Has sub commands. For this command to work you must specify where the project version is stored. You can do that with version_file conf variable. peltak supports multiple ways to store the project versi...
def version_cli(ctx, porcelain): # type: (click.Context, bool) -> None """ Show project version. Has sub commands. For this command to work you must specify where the project version is stored. You can do that with version_file conf variable. peltak supports multiple ways to store the project versi...
[ "Show", "project", "version", ".", "Has", "sub", "commands", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/commands/version.py#L25-L64
[ "def", "version_cli", "(", "ctx", ",", "porcelain", ")", ":", "# type: (click.Context, bool) -> None", "if", "ctx", ".", "invoked_subcommand", ":", "return", "from", "peltak", ".", "core", "import", "log", "from", "peltak", ".", "core", "import", "versioning", "...
b627acc019e3665875fe76cdca0a14773b69beaa
train
bump_version
Bump current project version without committing anything. No tags are created either. Examples: \b $ peltak version bump patch # Bump patch version component $ peltak version bump minor # Bump minor version component $ peltak version bump major ...
src/peltak/commands/version.py
def bump_version(component='patch', exact=None): # type: (str, str) -> None """ Bump current project version without committing anything. No tags are created either. Examples: \b $ peltak version bump patch # Bump patch version component $ peltak version bump minor...
def bump_version(component='patch', exact=None): # type: (str, str) -> None """ Bump current project version without committing anything. No tags are created either. Examples: \b $ peltak version bump patch # Bump patch version component $ peltak version bump minor...
[ "Bump", "current", "project", "version", "without", "committing", "anything", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/commands/version.py#L76-L99
[ "def", "bump_version", "(", "component", "=", "'patch'", ",", "exact", "=", "None", ")", ":", "# type: (str, str) -> None", "from", "peltak", ".", "core", "import", "log", "from", "peltak", ".", "core", "import", "versioning", "old_ver", ",", "new_ver", "=", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
Meta.get_logfile_name
Creates a name for a log file that is meant to be used in a call to ``logging.FileHandler``. The log file name will incldue the path to the log directory given by the `p.LOG_DIR` constant. The format of the file name is: 'log_$HOST_$TAG.txt', where $HOST is the hostname part of the URL given by...
pulsarpy/models.py
def get_logfile_name(tag): """ Creates a name for a log file that is meant to be used in a call to ``logging.FileHandler``. The log file name will incldue the path to the log directory given by the `p.LOG_DIR` constant. The format of the file name is: 'log_$HOST_$TAG.txt', where ...
def get_logfile_name(tag): """ Creates a name for a log file that is meant to be used in a call to ``logging.FileHandler``. The log file name will incldue the path to the log directory given by the `p.LOG_DIR` constant. The format of the file name is: 'log_$HOST_$TAG.txt', where ...
[ "Creates", "a", "name", "for", "a", "log", "file", "that", "is", "meant", "to", "be", "used", "in", "a", "call", "to", "logging", ".", "FileHandler", ".", "The", "log", "file", "name", "will", "incldue", "the", "path", "to", "the", "log", "directory", ...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L114-L131
[ "def", "get_logfile_name", "(", "tag", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "p", ".", "LOG_DIR", ")", ":", "os", ".", "mkdir", "(", "p", ".", "LOG_DIR", ")", "filename", "=", "\"log_\"", "+", "p", ".", "HOST", "+", "\"_\"...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model._get
Fetches a record by the record's ID or upstream_identifier. Raises: `pulsarpy.models.RecordNotFound`: A record could not be found.
pulsarpy/models.py
def _get(self, rec_id=None, upstream=None): """ Fetches a record by the record's ID or upstream_identifier. Raises: `pulsarpy.models.RecordNotFound`: A record could not be found. """ if rec_id: self.record_url = self.__class__.get_record_url(rec_id) ...
def _get(self, rec_id=None, upstream=None): """ Fetches a record by the record's ID or upstream_identifier. Raises: `pulsarpy.models.RecordNotFound`: A record could not be found. """ if rec_id: self.record_url = self.__class__.get_record_url(rec_id) ...
[ "Fetches", "a", "record", "by", "the", "record", "s", "ID", "or", "upstream_identifier", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L296-L315
[ "def", "_get", "(", "self", ",", "rec_id", "=", "None", ",", "upstream", "=", "None", ")", ":", "if", "rec_id", ":", "self", ".", "record_url", "=", "self", ".", "__class__", ".", "get_record_url", "(", "rec_id", ")", "self", ".", "debug_logger", ".", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.replace_name_with_id
Used to replace a foreign key reference using a name with an ID. Works by searching the record in Pulsar and expects to find exactly one hit. First, will check if the foreign key reference is an integer value and if so, returns that as it is presumed to be the foreign key. Raises: `...
pulsarpy/models.py
def replace_name_with_id(cls, name): """ Used to replace a foreign key reference using a name with an ID. Works by searching the record in Pulsar and expects to find exactly one hit. First, will check if the foreign key reference is an integer value and if so, returns that as it is presu...
def replace_name_with_id(cls, name): """ Used to replace a foreign key reference using a name with an ID. Works by searching the record in Pulsar and expects to find exactly one hit. First, will check if the foreign key reference is an integer value and if so, returns that as it is presu...
[ "Used", "to", "replace", "a", "foreign", "key", "reference", "using", "a", "name", "with", "an", "ID", ".", "Works", "by", "searching", "the", "record", "in", "Pulsar", "and", "expects", "to", "find", "exactly", "one", "hit", ".", "First", "will", "check...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L330-L354
[ "def", "replace_name_with_id", "(", "cls", ",", "name", ")", ":", "try", ":", "int", "(", "name", ")", "return", "name", "#Already a presumed ID.", "except", "ValueError", ":", "pass", "#Not an int, so maybe a combination of MODEL_ABBR and Primary Key, i.e. B-8.", "if", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.add_model_name_to_payload
Checks whether the model name in question is in the payload. If not, the entire payload is set as a value of a key by the name of the model. This method is useful when some server-side Rails API calls expect the parameters to include the parameterized model name. For example, server-side endpoi...
pulsarpy/models.py
def add_model_name_to_payload(cls, payload): """ Checks whether the model name in question is in the payload. If not, the entire payload is set as a value of a key by the name of the model. This method is useful when some server-side Rails API calls expect the parameters to include the ...
def add_model_name_to_payload(cls, payload): """ Checks whether the model name in question is in the payload. If not, the entire payload is set as a value of a key by the name of the model. This method is useful when some server-side Rails API calls expect the parameters to include the ...
[ "Checks", "whether", "the", "model", "name", "in", "question", "is", "in", "the", "payload", ".", "If", "not", "the", "entire", "payload", "is", "set", "as", "a", "value", "of", "a", "key", "by", "the", "name", "of", "the", "model", ".", "This", "met...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L358-L381
[ "def", "add_model_name_to_payload", "(", "cls", ",", "payload", ")", ":", "if", "not", "cls", ".", "MODEL_NAME", "in", "payload", ":", "payload", "=", "{", "cls", ".", "MODEL_NAME", ":", "payload", "}", "return", "payload" ]
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.delete
Deletes the record.
pulsarpy/models.py
def delete(self): """Deletes the record. """ res = requests.delete(url=self.record_url, headers=HEADERS, verify=False) #self.write_response_html_to_file(res,"bob_delete.html") if res.status_code == 204: #No content. Can't render json: return {} ret...
def delete(self): """Deletes the record. """ res = requests.delete(url=self.record_url, headers=HEADERS, verify=False) #self.write_response_html_to_file(res,"bob_delete.html") if res.status_code == 204: #No content. Can't render json: return {} ret...
[ "Deletes", "the", "record", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L413-L421
[ "def", "delete", "(", "self", ")", ":", "res", "=", "requests", ".", "delete", "(", "url", "=", "self", ".", "record_url", ",", "headers", "=", "HEADERS", ",", "verify", "=", "False", ")", "#self.write_response_html_to_file(res,\"bob_delete.html\")", "if", "re...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.find_by
Searches the model in question by AND joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a dict. as well. Only the first hit is returned, and there is no particular ordering specified in the server-side API m...
pulsarpy/models.py
def find_by(cls, payload, require=False): """ Searches the model in question by AND joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a dict. as well. Only the first hit is returned, and there is no ...
def find_by(cls, payload, require=False): """ Searches the model in question by AND joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a dict. as well. Only the first hit is returned, and there is no ...
[ "Searches", "the", "model", "in", "question", "by", "AND", "joining", "the", "query", "parameters", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L424-L463
[ "def", "find_by", "(", "cls", ",", "payload", ",", "require", "=", "False", ")", ":", "if", "not", "isinstance", "(", "payload", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"The 'payload' parameter must be provided a dictionary object.\"", ")", "url", "...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.find_by_or
Searches the model in question by OR joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a string (for the OR operator joining to be specified). Only the first hit is returned, and there is not particular ord...
pulsarpy/models.py
def find_by_or(cls, payload): """ Searches the model in question by OR joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a string (for the OR operator joining to be specified). Only the firs...
def find_by_or(cls, payload): """ Searches the model in question by OR joining the query parameters. Implements a Railsy way of looking for a record using a method by the same name and passing in the query as a string (for the OR operator joining to be specified). Only the firs...
[ "Searches", "the", "model", "in", "question", "by", "OR", "joining", "the", "query", "parameters", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L466-L497
[ "def", "find_by_or", "(", "cls", ",", "payload", ")", ":", "if", "not", "isinstance", "(", "payload", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"The 'payload' parameter must be provided a dictionary object.\"", ")", "url", "=", "os", ".", "path", ".",...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.index
Fetches all records. Returns: `dict`. The JSON formatted response. Raises: `requests.exceptions.HTTPError`: The status code is not ok.
pulsarpy/models.py
def index(cls): """Fetches all records. Returns: `dict`. The JSON formatted response. Raises: `requests.exceptions.HTTPError`: The status code is not ok. """ res = requests.get(cls.URL, headers=HEADERS, verify=False) res.raise_for_status() ...
def index(cls): """Fetches all records. Returns: `dict`. The JSON formatted response. Raises: `requests.exceptions.HTTPError`: The status code is not ok. """ res = requests.get(cls.URL, headers=HEADERS, verify=False) res.raise_for_status() ...
[ "Fetches", "all", "records", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L500-L511
[ "def", "index", "(", "cls", ")", ":", "res", "=", "requests", ".", "get", "(", "cls", ".", "URL", ",", "headers", "=", "HEADERS", ",", "verify", "=", "False", ")", "res", ".", "raise_for_status", "(", ")", "return", "res", ".", "json", "(", ")" ]
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.patch
Patches current record and udpates the current instance's 'attrs' attribute to reflect the new changes. Args: payload - hash. This will be JSON-formatted prior to sending the request. Returns: `dict`. The JSON formatted response. Raises: `requests.e...
pulsarpy/models.py
def patch(self, payload, append_to_arrays=True): """ Patches current record and udpates the current instance's 'attrs' attribute to reflect the new changes. Args: payload - hash. This will be JSON-formatted prior to sending the request. Returns: `dict`. ...
def patch(self, payload, append_to_arrays=True): """ Patches current record and udpates the current instance's 'attrs' attribute to reflect the new changes. Args: payload - hash. This will be JSON-formatted prior to sending the request. Returns: `dict`. ...
[ "Patches", "current", "record", "and", "udpates", "the", "current", "instance", "s", "attrs", "attribute", "to", "reflect", "the", "new", "changes", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L513-L545
[ "def", "patch", "(", "self", ",", "payload", ",", "append_to_arrays", "=", "True", ")", ":", "if", "not", "isinstance", "(", "payload", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"The 'payload' parameter must be provided a dictionary object.\"", ")", "pa...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.set_id_in_fkeys
Looks for any keys in the payload that end with either _id or _ids, signaling a foreign key field. For each foreign key field, checks whether the value is using the name of the record or the actual primary ID of the record (which may include the model abbreviation, i.e. B-1). If the former case,...
pulsarpy/models.py
def set_id_in_fkeys(cls, payload): """ Looks for any keys in the payload that end with either _id or _ids, signaling a foreign key field. For each foreign key field, checks whether the value is using the name of the record or the actual primary ID of the record (which may include the mod...
def set_id_in_fkeys(cls, payload): """ Looks for any keys in the payload that end with either _id or _ids, signaling a foreign key field. For each foreign key field, checks whether the value is using the name of the record or the actual primary ID of the record (which may include the mod...
[ "Looks", "for", "any", "keys", "in", "the", "payload", "that", "end", "with", "either", "_id", "or", "_ids", "signaling", "a", "foreign", "key", "field", ".", "For", "each", "foreign", "key", "field", "checks", "whether", "the", "value", "is", "using", "...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L548-L577
[ "def", "set_id_in_fkeys", "(", "cls", ",", "payload", ")", ":", "for", "key", "in", "payload", ":", "val", "=", "payload", "[", "key", "]", "if", "not", "val", ":", "continue", "if", "key", ".", "endswith", "(", "\"_id\"", ")", ":", "model", "=", "...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.post
Posts the data to the specified record. Args: payload: `dict`. This will be JSON-formatted prior to sending the request. Returns: `dict`. The JSON formatted response. Raises: `Requests.exceptions.HTTPError`: The status code is not ok. `RecordNot...
pulsarpy/models.py
def post(cls, payload): """Posts the data to the specified record. Args: payload: `dict`. This will be JSON-formatted prior to sending the request. Returns: `dict`. The JSON formatted response. Raises: `Requests.exceptions.HTTPError`: The status cod...
def post(cls, payload): """Posts the data to the specified record. Args: payload: `dict`. This will be JSON-formatted prior to sending the request. Returns: `dict`. The JSON formatted response. Raises: `Requests.exceptions.HTTPError`: The status cod...
[ "Posts", "the", "data", "to", "the", "specified", "record", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L585-L619
[ "def", "post", "(", "cls", ",", "payload", ")", ":", "if", "not", "isinstance", "(", "payload", ",", "dict", ")", ":", "raise", "ValueError", "(", "\"The 'payload' parameter must be provided a dictionary object.\"", ")", "payload", "=", "cls", ".", "set_id_in_fkey...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.log_error
Logs the provided error message to both the error logger and the debug logger logging instances. Args: msg: `str`. The error message to log.
pulsarpy/models.py
def log_error(cls, msg): """ Logs the provided error message to both the error logger and the debug logger logging instances. Args: msg: `str`. The error message to log. """ cls.error_logger.error(msg) cls.debug_logger.debug(msg)
def log_error(cls, msg): """ Logs the provided error message to both the error logger and the debug logger logging instances. Args: msg: `str`. The error message to log. """ cls.error_logger.error(msg) cls.debug_logger.debug(msg)
[ "Logs", "the", "provided", "error", "message", "to", "both", "the", "error", "logger", "and", "the", "debug", "logger", "logging", "instances", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L622-L631
[ "def", "log_error", "(", "cls", ",", "msg", ")", ":", "cls", ".", "error_logger", ".", "error", "(", "msg", ")", "cls", ".", "debug_logger", ".", "debug", "(", "msg", ")" ]
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Model.write_response_html_to_file
An aid in troubleshooting internal application errors, i.e. <Response [500]>, to be mainly beneficial when developing the server-side API. This method will write the response HTML for viewing the error details in the browesr. Args: response: `requests.models.Response` instance. ...
pulsarpy/models.py
def write_response_html_to_file(response,filename): """ An aid in troubleshooting internal application errors, i.e. <Response [500]>, to be mainly beneficial when developing the server-side API. This method will write the response HTML for viewing the error details in the browesr. ...
def write_response_html_to_file(response,filename): """ An aid in troubleshooting internal application errors, i.e. <Response [500]>, to be mainly beneficial when developing the server-side API. This method will write the response HTML for viewing the error details in the browesr. ...
[ "An", "aid", "in", "troubleshooting", "internal", "application", "errors", "i", ".", "e", ".", "<Response", "[", "500", "]", ">", "to", "be", "mainly", "beneficial", "when", "developing", "the", "server", "-", "side", "API", ".", "This", "method", "will", ...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L634-L648
[ "def", "write_response_html_to_file", "(", "response", ",", "filename", ")", ":", "fout", "=", "open", "(", "filename", ",", "'w'", ")", "if", "not", "str", "(", "response", ".", "status_code", ")", ".", "startswith", "(", "\"2\"", ")", ":", "Model", "."...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Biosample.parent_ids
Returns an array of parent Biosample IDs. If the current Biosample has a part_of relationship, the Biosampled referenced there will be returned. Otherwise, if the current Biosample was generated from a pool of Biosamples (pooled_from_biosample_ids), then those will be returned. Otherwise, the re...
pulsarpy/models.py
def parent_ids(self): """ Returns an array of parent Biosample IDs. If the current Biosample has a part_of relationship, the Biosampled referenced there will be returned. Otherwise, if the current Biosample was generated from a pool of Biosamples (pooled_from_biosample_ids), then those w...
def parent_ids(self): """ Returns an array of parent Biosample IDs. If the current Biosample has a part_of relationship, the Biosampled referenced there will be returned. Otherwise, if the current Biosample was generated from a pool of Biosamples (pooled_from_biosample_ids), then those w...
[ "Returns", "an", "array", "of", "parent", "Biosample", "IDs", ".", "If", "the", "current", "Biosample", "has", "a", "part_of", "relationship", "the", "Biosampled", "referenced", "there", "will", "be", "returned", ".", "Otherwise", "if", "the", "current", "Bios...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L696-L706
[ "def", "parent_ids", "(", "self", ")", ":", "action", "=", "os", ".", "path", ".", "join", "(", "self", ".", "record_url", ",", "\"parent_ids\"", ")", "res", "=", "requests", ".", "get", "(", "url", "=", "action", ",", "headers", "=", "HEADERS", ",",...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Biosample.find_first_wt_parent
Recursively looks at the part_of parent ancestry line (ignoring pooled_from parents) and returns a parent Biosample ID if its wild_type attribute is True. Args: with_ip: `bool`. True means to restrict the search to the first parental Wild Type that also has an Immunoblot l...
pulsarpy/models.py
def find_first_wt_parent(self, with_ip=False): """ Recursively looks at the part_of parent ancestry line (ignoring pooled_from parents) and returns a parent Biosample ID if its wild_type attribute is True. Args: with_ip: `bool`. True means to restrict the search to the firs...
def find_first_wt_parent(self, with_ip=False): """ Recursively looks at the part_of parent ancestry line (ignoring pooled_from parents) and returns a parent Biosample ID if its wild_type attribute is True. Args: with_ip: `bool`. True means to restrict the search to the firs...
[ "Recursively", "looks", "at", "the", "part_of", "parent", "ancestry", "line", "(", "ignoring", "pooled_from", "parents", ")", "and", "returns", "a", "parent", "Biosample", "ID", "if", "its", "wild_type", "attribute", "is", "True", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L708-L734
[ "def", "find_first_wt_parent", "(", "self", ",", "with_ip", "=", "False", ")", ":", "parent_id", "=", "self", ".", "part_of_id", "if", "not", "parent_id", ":", "return", "False", "parent", "=", "Biosample", "(", "parent_id", ")", "if", "parent", ".", "wild...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Document.upload
Args: path: `str`. The path to the document to upload. document_type: `str`. DocumentType identified by the value of its name attribute. is_protocol: `bool`. description: `str`.
pulsarpy/models.py
def upload(cls, path, document_type, is_protocol, description=""): """ Args: path: `str`. The path to the document to upload. document_type: `str`. DocumentType identified by the value of its name attribute. is_protocol: `bool`. description: `str`. ...
def upload(cls, path, document_type, is_protocol, description=""): """ Args: path: `str`. The path to the document to upload. document_type: `str`. DocumentType identified by the value of its name attribute. is_protocol: `bool`. description: `str`. ...
[ "Args", ":", "path", ":", "str", ".", "The", "path", "to", "the", "document", "to", "upload", ".", "document_type", ":", "str", ".", "DocumentType", "identified", "by", "the", "value", "of", "its", "name", "attribute", ".", "is_protocol", ":", "bool", "....
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L838-L858
[ "def", "upload", "(", "cls", ",", "path", ",", "document_type", ",", "is_protocol", ",", "description", "=", "\"\"", ")", ":", "file_name", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "mime_type", "=", "mimetypes", ".", "guess_type", "(", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
Library.post
A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus Model.post() won't be able to figure out ...
pulsarpy/models.py
def post(cls, payload): """ A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus ...
def post(cls, payload): """ A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus ...
[ "A", "wrapper", "over", "Model", ".", "post", "()", "that", "handles", "the", "case", "where", "a", "Library", "has", "a", "PairedBarcode", "and", "the", "user", "may", "have", "supplied", "the", "PairedBarcode", "in", "the", "form", "of", "index1", "-", ...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L969-L1005
[ "def", "post", "(", "cls", ",", "payload", ")", ":", "slpk_attr_name", "=", "\"sequencing_library_prep_kit_id\"", "paired_bc_id_attr_name", "=", "\"paired_barcode_id\"", "seq_reg", "=", "re", ".", "compile", "(", "\"^[ACGTN]+$\"", ")", "if", "paired_bc_id_attr_name", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
SequencingRequest.get_library_barcode_sequence_hash
Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inverse: `bool`. True means to inverse the key and value pairs such that the barcode ...
pulsarpy/models.py
def get_library_barcode_sequence_hash(self, inverse=False): """ Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inver...
def get_library_barcode_sequence_hash(self, inverse=False): """ Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inver...
[ "Calls", "the", "SequencingRequest", "s", "get_library_barcode_sequence_hash", "server", "-", "side", "endpoint", "to", "create", "a", "hash", "of", "the", "form", "{", "LibraryID", "-", ">", "barcode_sequence", "}", "for", "all", "Libraries", "on", "the", "Sequ...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1047-L1074
[ "def", "get_library_barcode_sequence_hash", "(", "self", ",", "inverse", "=", "False", ")", ":", "action", "=", "os", ".", "path", ".", "join", "(", "self", ".", "record_url", ",", "\"get_library_barcode_sequence_hash\"", ")", "res", "=", "requests", ".", "get...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
SequencingRun.library_sequencing_results
Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict.
pulsarpy/models.py
def library_sequencing_results(self): """ Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict. """ sres_ids = self.seque...
def library_sequencing_results(self): """ Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict. """ sres_ids = self.seque...
[ "Generates", "a", "dict", ".", "where", "each", "key", "is", "a", "Library", "ID", "on", "the", "SequencingRequest", "and", "each", "value", "is", "the", "associated", "SequencingResult", ".", "Libraries", "that", "aren", "t", "yet", "with", "a", "Sequencing...
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1098-L1109
[ "def", "library_sequencing_results", "(", "self", ")", ":", "sres_ids", "=", "self", ".", "sequencing_result_ids", "res", "=", "{", "}", "for", "i", "in", "sres_ids", ":", "sres", "=", "SequencingResult", "(", "i", ")", "res", "[", "sres", ".", "library_id...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
User.unarchive_user
Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None.
pulsarpy/models.py
def unarchive_user(self, user_id): """Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None. """ url = self.record_url + "/unarchive" res = requests.patch(url=url, json={"...
def unarchive_user(self, user_id): """Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None. """ url = self.record_url + "/unarchive" res = requests.patch(url=url, json={"...
[ "Unarchives", "the", "user", "with", "the", "specified", "user", "ID", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1179-L1191
[ "def", "unarchive_user", "(", "self", ",", "user_id", ")", ":", "url", "=", "self", ".", "record_url", "+", "\"/unarchive\"", "res", "=", "requests", ".", "patch", "(", "url", "=", "url", ",", "json", "=", "{", "\"user_id\"", ":", "user_id", "}", ",", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
train
User.remove_api_key
Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None.
pulsarpy/models.py
def remove_api_key(self): """ Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None. """ url = self.record_url + "/remove_api_key" res = requests.patch(url=u...
def remove_api_key(self): """ Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None. """ url = self.record_url + "/remove_api_key" res = requests.patch(url=u...
[ "Removes", "the", "user", "s", "existing", "API", "key", "if", "present", "and", "sets", "the", "current", "instance", "s", "api_key", "attribute", "to", "the", "empty", "string", "." ]
nathankw/pulsarpy
python
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1206-L1217
[ "def", "remove_api_key", "(", "self", ")", ":", "url", "=", "self", ".", "record_url", "+", "\"/remove_api_key\"", "res", "=", "requests", ".", "patch", "(", "url", "=", "url", ",", "headers", "=", "HEADERS", ",", "verify", "=", "False", ")", "res", "....
359b040c0f2383b88c0b5548715fefd35f5f634c
train
ssp_fitter.generate_synthObs
basesWave: Bases wavelength must be at rest
bin/lib/ssp_functions/ssp_synthesis_tools.py
def generate_synthObs(self, bases_wave, bases_flux, basesCoeff, Av_star, z_star, sigma_star, resample_range = None, resample_int = 1): '''basesWave: Bases wavelength must be at rest''' nbases = basesCoeff.shape[0] bases_wave_resam = arange(int(resample_range[0]),...
def generate_synthObs(self, bases_wave, bases_flux, basesCoeff, Av_star, z_star, sigma_star, resample_range = None, resample_int = 1): '''basesWave: Bases wavelength must be at rest''' nbases = basesCoeff.shape[0] bases_wave_resam = arange(int(resample_range[0]),...
[ "basesWave", ":", "Bases", "wavelength", "must", "be", "at", "rest" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/ssp_functions/ssp_synthesis_tools.py#L683-L728
[ "def", "generate_synthObs", "(", "self", ",", "bases_wave", ",", "bases_flux", ",", "basesCoeff", ",", "Av_star", ",", "z_star", ",", "sigma_star", ",", "resample_range", "=", "None", ",", "resample_int", "=", "1", ")", ":", "nbases", "=", "basesCoeff", ".",...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
Payment._process
Processes the current transaction Sends an HTTP request to the PAYDUNYA API server
paydunya/__init__.py
def _process(self, resource=None, data={}): """Processes the current transaction Sends an HTTP request to the PAYDUNYA API server """ # use object's data if no data is passed _data = data or self._data rsc_url = self.get_rsc_endpoint(resource) if _data: ...
def _process(self, resource=None, data={}): """Processes the current transaction Sends an HTTP request to the PAYDUNYA API server """ # use object's data if no data is passed _data = data or self._data rsc_url = self.get_rsc_endpoint(resource) if _data: ...
[ "Processes", "the", "current", "transaction" ]
paydunya/paydunya-python
python
https://github.com/paydunya/paydunya-python/blob/bb55791e2814788aec74162d9d78970815f37c30/paydunya/__init__.py#L86-L107
[ "def", "_process", "(", "self", ",", "resource", "=", "None", ",", "data", "=", "{", "}", ")", ":", "# use object's data if no data is passed", "_data", "=", "data", "or", "self", ".", "_data", "rsc_url", "=", "self", ".", "get_rsc_endpoint", "(", "resource"...
bb55791e2814788aec74162d9d78970815f37c30
train
Payment.add_header
Add a custom HTTP header to the client's request headers
paydunya/__init__.py
def add_header(self, header): """Add a custom HTTP header to the client's request headers""" if type(header) is dict: self._headers.update(header) else: raise ValueError( "Dictionary expected, got '%s' instead" % type(header) )
def add_header(self, header): """Add a custom HTTP header to the client's request headers""" if type(header) is dict: self._headers.update(header) else: raise ValueError( "Dictionary expected, got '%s' instead" % type(header) )
[ "Add", "a", "custom", "HTTP", "header", "to", "the", "client", "s", "request", "headers" ]
paydunya/paydunya-python
python
https://github.com/paydunya/paydunya-python/blob/bb55791e2814788aec74162d9d78970815f37c30/paydunya/__init__.py#L114-L121
[ "def", "add_header", "(", "self", ",", "header", ")", ":", "if", "type", "(", "header", ")", "is", "dict", ":", "self", ".", "_headers", ".", "update", "(", "header", ")", "else", ":", "raise", "ValueError", "(", "\"Dictionary expected, got '%s' instead\"", ...
bb55791e2814788aec74162d9d78970815f37c30
train
changelog_cli
Generate changelog from commit messages.
src/peltak/extra/changelog/commands.py
def changelog_cli(ctx): # type: () -> None """ Generate changelog from commit messages. """ if ctx.invoked_subcommand: return from peltak.core import shell from . import logic shell.cprint(logic.changelog())
def changelog_cli(ctx): # type: () -> None """ Generate changelog from commit messages. """ if ctx.invoked_subcommand: return from peltak.core import shell from . import logic shell.cprint(logic.changelog())
[ "Generate", "changelog", "from", "commit", "messages", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/changelog/commands.py#L24-L32
[ "def", "changelog_cli", "(", "ctx", ")", ":", "# type: () -> None", "if", "ctx", ".", "invoked_subcommand", ":", "return", "from", "peltak", ".", "core", "import", "shell", "from", ".", "import", "logic", "shell", ".", "cprint", "(", "logic", ".", "changelog...
b627acc019e3665875fe76cdca0a14773b69beaa
train
Argument.convert_to_argument
Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser
chuda/arguments.py
def convert_to_argument(self): ''' Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser ''' field_list = [ "action", "nargs", "const", "default", "type", "choices", "required", "help", "metavar", "des...
def convert_to_argument(self): ''' Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser ''' field_list = [ "action", "nargs", "const", "default", "type", "choices", "required", "help", "metavar", "des...
[ "Convert", "the", "Argument", "object", "to", "a", "tuple", "use", "in", ":", "meth", ":", "~argparse", ".", "ArgumentParser", ".", "add_argument", "calls", "on", "the", "parser" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/arguments.py#L52-L67
[ "def", "convert_to_argument", "(", "self", ")", ":", "field_list", "=", "[", "\"action\"", ",", "\"nargs\"", ",", "\"const\"", ",", "\"default\"", ",", "\"type\"", ",", "\"choices\"", ",", "\"required\"", ",", "\"help\"", ",", "\"metavar\"", ",", "\"dest\"", "...
0d93b716dede35231c21be97bcc19a656655983f
train
Option.get_default_name
Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option
chuda/arguments.py
def get_default_name(self): ''' Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option ''' long_names = [name for name ...
def get_default_name(self): ''' Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option ''' long_names = [name for name ...
[ "Return", "the", "default", "generated", "name", "to", "store", "value", "on", "the", "parser", "for", "this", "option", "." ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/arguments.py#L84-L99
[ "def", "get_default_name", "(", "self", ")", ":", "long_names", "=", "[", "name", "for", "name", "in", "self", ".", "name", "if", "name", ".", "startswith", "(", "\"--\"", ")", "]", "short_names", "=", "[", "name", "for", "name", "in", "self", ".", "...
0d93b716dede35231c21be97bcc19a656655983f
train
file_Core.get_filename
Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filename otherwise the return value is a string. m...
bidso/files.py
def get_filename(self, base_dir=None, modality=None): """Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filen...
def get_filename(self, base_dir=None, modality=None): """Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filen...
[ "Construct", "filename", "based", "on", "the", "attributes", "." ]
gpiantoni/bidso
python
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/files.py#L37-L87
[ "def", "get_filename", "(", "self", ",", "base_dir", "=", "None", ",", "modality", "=", "None", ")", ":", "filename", "=", "'sub-'", "+", "self", ".", "subject", "if", "self", ".", "session", "is", "not", "None", ":", "filename", "+=", "'_ses-'", "+", ...
af163b921ec4e3d70802de07f174de184491cfce
train
file_Tsv.get
Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function function to select the tsv columns Returns ---...
bidso/files.py
def get(self, filter_lambda=None, map_lambda=None): """Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function ...
def get(self, filter_lambda=None, map_lambda=None): """Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function ...
[ "Select", "elements", "of", "the", "TSV", "using", "python", "filter", "and", "map", "." ]
gpiantoni/bidso
python
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/files.py#L95-L125
[ "def", "get", "(", "self", ",", "filter_lambda", "=", "None", ",", "map_lambda", "=", "None", ")", ":", "if", "filter_lambda", "is", "None", ":", "filter_lambda", "=", "lambda", "x", ":", "True", "if", "map_lambda", "is", "None", ":", "map_lambda", "=", ...
af163b921ec4e3d70802de07f174de184491cfce
train
Isogeo.connect
Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id: application oAuth2 identifier :param str client_secret: application oAuth2 sec...
isogeo_pysdk/isogeo_sdk.py
def connect(self, client_id: str = None, client_secret: str = None) -> dict: """Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id...
def connect(self, client_id: str = None, client_secret: str = None) -> dict: """Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id...
[ "Authenticate", "application", "and", "get", "token", "bearer", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L177-L234
[ "def", "connect", "(", "self", ",", "client_id", ":", "str", "=", "None", ",", "client_secret", ":", "str", "=", "None", ")", "->", "dict", ":", "# instanciated or direct call", "if", "not", "client_id", "and", "not", "client_secret", ":", "client_id", "=", ...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo._check_bearer_validity
Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. See: http://tools.ietf.org/html/rfc6750#section-2 ...
isogeo_pysdk/isogeo_sdk.py
def _check_bearer_validity(decorated_func): """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. Se...
def _check_bearer_validity(decorated_func): """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. Se...
[ "Check", "API", "Bearer", "token", "validity", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L246-L270
[ "def", "_check_bearer_validity", "(", "decorated_func", ")", ":", "@", "wraps", "(", "decorated_func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# compare token expiration date and ask for a new one if it's expired", "...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.search
Search within the resources shared to the application. It's the main method to use. :param str token: API auth token - DEPRECATED: token is now automatically included :param str query: search terms and semantic filters. Equivalent of **q** parameter in Isogeo API. It could be a simple...
isogeo_pysdk/isogeo_sdk.py
def search( self, token: dict = None, query: str = "", bbox: list = None, poly: str = None, georel: str = None, order_by: str = "_created", order_dir: str = "desc", page_size: int = 100, offset: int = 0, share: str = None, s...
def search( self, token: dict = None, query: str = "", bbox: list = None, poly: str = None, georel: str = None, order_by: str = "_created", order_dir: str = "desc", page_size: int = 100, offset: int = 0, share: str = None, s...
[ "Search", "within", "the", "resources", "shared", "to", "the", "application", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L274-L450
[ "def", "search", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "query", ":", "str", "=", "\"\"", ",", "bbox", ":", "list", "=", "None", ",", "poly", ":", "str", "=", "None", ",", "georel", ":", "str", "=", "None", ",", "order_by", "...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.resource
Get complete or partial metadata about one specific resource. :param str token: API auth token :param str id_resource: metadata UUID to get :param list include: subresources that should be included. Must be a list of strings. Available values: 'isogeo.SUBRESOURCES' :param str p...
isogeo_pysdk/isogeo_sdk.py
def resource( self, token: dict = None, id_resource: str = None, subresource=None, include: list = [], prot: str = "https", ) -> dict: """Get complete or partial metadata about one specific resource. :param str token: API auth token :param str...
def resource( self, token: dict = None, id_resource: str = None, subresource=None, include: list = [], prot: str = "https", ) -> dict: """Get complete or partial metadata about one specific resource. :param str token: API auth token :param str...
[ "Get", "complete", "or", "partial", "metadata", "about", "one", "specific", "resource", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L453-L494
[ "def", "resource", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "id_resource", ":", "str", "=", "None", ",", "subresource", "=", "None", ",", "include", ":", "list", "=", "[", "]", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", ...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.shares
Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def shares(self, token: dict = None, prot: str = "https") -> dict: """Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth paramete...
def shares(self, token: dict = None, prot: str = "https") -> dict: """Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth paramete...
[ "Get", "information", "about", "shares", "which", "feed", "the", "application", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L498-L515
[ "def", "shares", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# passing auth parameter", "shares_url", "=", "\"{}://v1.{}.isogeo.com/shares/\"", ".", "format", "(", "prot", ",", "sel...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.share
Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param bool augment: option to improve API response by adding some tags on the fly. :param str prot: https [DEFAULT] or http (use it only for d...
isogeo_pysdk/isogeo_sdk.py
def share( self, share_id: str, token: dict = None, augment: bool = False, prot: str = "https", ) -> dict: """Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param ...
def share( self, share_id: str, token: dict = None, augment: bool = False, prot: str = "https", ) -> dict: """Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param ...
[ "Get", "information", "about", "a", "specific", "share", "and", "its", "applications", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L518-L555
[ "def", "share", "(", "self", ",", "share_id", ":", "str", ",", "token", ":", "dict", "=", "None", ",", "augment", ":", "bool", "=", "False", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", "->", "dict", ":", "# passing auth parameter", "share_url"...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.licenses
Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def licenses( self, token: dict = None, owner_id: str = None, prot: str = "https" ) -> dict: """Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http ...
def licenses( self, token: dict = None, owner_id: str = None, prot: str = "https" ) -> dict: """Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http ...
[ "Get", "information", "about", "licenses", "owned", "by", "a", "specific", "workgroup", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L559-L590
[ "def", "licenses", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "owner_id", ":", "str", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# handling request parameters", "payload", "=", "{", "\"gid\"", ":", "...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.license
Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def license(self, license_id: str, token: dict = None, prot: str = "https") -> dict: """Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). ...
def license(self, license_id: str, token: dict = None, prot: str = "https") -> dict: """Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). ...
[ "Get", "details", "about", "a", "specific", "license", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L593-L620
[ "def", "license", "(", "self", ",", "license_id", ":", "str", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# handling request parameters", "payload", "=", "{", "\"lid\"", ":", "license_id", "...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.thesauri
Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def thesauri(self, token: dict = None, prot: str = "https") -> dict: """Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth parameter thez_url = "{...
def thesauri(self, token: dict = None, prot: str = "https") -> dict: """Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth parameter thez_url = "{...
[ "Get", "list", "of", "available", "thesauri", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L625-L642
[ "def", "thesauri", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# passing auth parameter", "thez_url", "=", "\"{}://v1.{}.isogeo.com/thesauri\"", ".", "format", "(", "prot", ",", "se...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.thesaurus
Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def thesaurus( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", prot: str = "https", ) -> dict: """Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or htt...
def thesaurus( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", prot: str = "https", ) -> dict: """Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or htt...
[ "Get", "a", "thesaurus", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L645-L677
[ "def", "thesaurus", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "thez_id", ":", "str", "=", "\"1616597fbc4348c8b11ef9d59cf594c8\"", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", "->", "dict", ":", "# handling request parameters", "payload"...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.keywords
Search for keywords within a specific thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str query: search terms :param int offset: pagination start :param str order_by: sort criteria. Available values : - count.group, ...
isogeo_pysdk/isogeo_sdk.py
def keywords( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", query: str = "", offset: int = 0, order_by: str = "text", order_dir: str = "desc", page_size: int = 20, specific_md: list = [], specific_tag: list = ...
def keywords( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", query: str = "", offset: int = 0, order_by: str = "text", order_dir: str = "desc", page_size: int = 20, specific_md: list = [], specific_tag: list = ...
[ "Search", "for", "keywords", "within", "a", "specific", "thesaurus", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L680-L746
[ "def", "keywords", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "thez_id", ":", "str", "=", "\"1616597fbc4348c8b11ef9d59cf594c8\"", ",", "query", ":", "str", "=", "\"\"", ",", "offset", ":", "int", "=", "0", ",", "order_by", ":", "str", "=...
57a604be92c7767b26abd247012cc1a584b386a0