repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
eonpatapon/contrail-api-cli
contrail_api_cli/client.py
ContrailAPISession.remove_kv_store
def remove_kv_store(self, key): """Remove a key-value store entry. :param key: string """ data = { 'operation': 'DELETE', 'key': key } return self.post(self.make_url("/useragent-kv"), data=to_json(data), headers=self.defau...
python
def remove_kv_store(self, key): """Remove a key-value store entry. :param key: string """ data = { 'operation': 'DELETE', 'key': key } return self.post(self.make_url("/useragent-kv"), data=to_json(data), headers=self.defau...
[ "def", "remove_kv_store", "(", "self", ",", "key", ")", ":", "data", "=", "{", "'operation'", ":", "'DELETE'", ",", "'key'", ":", "key", "}", "return", "self", ".", "post", "(", "self", ".", "make_url", "(", "\"/useragent-kv\"", ")", ",", "data", "=", ...
Remove a key-value store entry. :param key: string
[ "Remove", "a", "key", "-", "value", "store", "entry", "." ]
1571bf523fa054f3d6bf83dba43a224fea173a73
https://github.com/eonpatapon/contrail-api-cli/blob/1571bf523fa054f3d6bf83dba43a224fea173a73/contrail_api_cli/client.py#L260-L270
train
Remove a key - value store entry.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_oven.py
canonical_ops
def canonical_ops(ops): ''' Returns the given operations array sorted with duplicates removed. @param ops checker.Ops @return: checker.Ops ''' new_ops = sorted(set(ops), key=lambda x: (x.entity, x.action)) return new_ops
python
def canonical_ops(ops): ''' Returns the given operations array sorted with duplicates removed. @param ops checker.Ops @return: checker.Ops ''' new_ops = sorted(set(ops), key=lambda x: (x.entity, x.action)) return new_ops
[ "def", "canonical_ops", "(", "ops", ")", ":", "new_ops", "=", "sorted", "(", "set", "(", "ops", ")", ",", "key", "=", "lambda", "x", ":", "(", "x", ".", "entity", ",", "x", ".", "action", ")", ")", "return", "new_ops" ]
Returns the given operations array sorted with duplicates removed. @param ops checker.Ops @return: checker.Ops
[ "Returns", "the", "given", "operations", "array", "sorted", "with", "duplicates", "removed", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_oven.py#L269-L276
train
Returns the given operations array sorted with duplicates removed.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_oven.py
_macaroon_id_ops
def _macaroon_id_ops(ops): '''Return operations suitable for serializing as part of a MacaroonId. It assumes that ops has been canonicalized and that there's at least one operation. ''' id_ops = [] for entity, entity_ops in itertools.groupby(ops, lambda x: x.entity): actions = map(lambd...
python
def _macaroon_id_ops(ops): '''Return operations suitable for serializing as part of a MacaroonId. It assumes that ops has been canonicalized and that there's at least one operation. ''' id_ops = [] for entity, entity_ops in itertools.groupby(ops, lambda x: x.entity): actions = map(lambd...
[ "def", "_macaroon_id_ops", "(", "ops", ")", ":", "id_ops", "=", "[", "]", "for", "entity", ",", "entity_ops", "in", "itertools", ".", "groupby", "(", "ops", ",", "lambda", "x", ":", "x", ".", "entity", ")", ":", "actions", "=", "map", "(", "lambda", ...
Return operations suitable for serializing as part of a MacaroonId. It assumes that ops has been canonicalized and that there's at least one operation.
[ "Return", "operations", "suitable", "for", "serializing", "as", "part", "of", "a", "MacaroonId", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_oven.py#L279-L289
train
Return operations suitable for serializing as part of a MacaroonId.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_oven.py
Oven.macaroon
def macaroon(self, version, expiry, caveats, ops): ''' Takes a macaroon with the given version from the oven, associates it with the given operations and attaches the given caveats. There must be at least one operation specified. The macaroon will expire at the given time - a time_before...
python
def macaroon(self, version, expiry, caveats, ops): ''' Takes a macaroon with the given version from the oven, associates it with the given operations and attaches the given caveats. There must be at least one operation specified. The macaroon will expire at the given time - a time_before...
[ "def", "macaroon", "(", "self", ",", "version", ",", "expiry", ",", "caveats", ",", "ops", ")", ":", "if", "len", "(", "ops", ")", "==", "0", ":", "raise", "ValueError", "(", "'cannot mint a macaroon associated '", "'with no operations'", ")", "ops", "=", ...
Takes a macaroon with the given version from the oven, associates it with the given operations and attaches the given caveats. There must be at least one operation specified. The macaroon will expire at the given time - a time_before first party caveat will be added with that time. ...
[ "Takes", "a", "macaroon", "with", "the", "given", "version", "from", "the", "oven", "associates", "it", "with", "the", "given", "operations", "and", "attaches", "the", "given", "caveats", ".", "There", "must", "be", "at", "least", "one", "operation", "specif...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_oven.py#L81-L117
train
Takes a macaroon with the given version from the oven and associates it with the given operations and attaches the given caveats.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_oven.py
Oven.ops_entity
def ops_entity(self, ops): ''' Returns a new multi-op entity name string that represents all the given operations and caveats. It returns the same value regardless of the ordering of the operations. It assumes that the operations have been canonicalized and that there's at least one ...
python
def ops_entity(self, ops): ''' Returns a new multi-op entity name string that represents all the given operations and caveats. It returns the same value regardless of the ordering of the operations. It assumes that the operations have been canonicalized and that there's at least one ...
[ "def", "ops_entity", "(", "self", ",", "ops", ")", ":", "# Hash the operations, removing duplicates as we go.", "hash_entity", "=", "hashlib", ".", "sha256", "(", ")", "for", "op", "in", "ops", ":", "hash_entity", ".", "update", "(", "'{}\\n{}\\n'", ".", "format...
Returns a new multi-op entity name string that represents all the given operations and caveats. It returns the same value regardless of the ordering of the operations. It assumes that the operations have been canonicalized and that there's at least one operation. :param ops: ...
[ "Returns", "a", "new", "multi", "-", "op", "entity", "name", "string", "that", "represents", "all", "the", "given", "operations", "and", "caveats", ".", "It", "returns", "the", "same", "value", "regardless", "of", "the", "ordering", "of", "the", "operations"...
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_oven.py#L135-L151
train
Returns a new multi - op entity name string that represents all the given operations and caveats.
go-macaroon-bakery/py-macaroon-bakery
macaroonbakery/bakery/_oven.py
Oven.macaroon_ops
def macaroon_ops(self, macaroons): ''' This method makes the oven satisfy the MacaroonOpStore protocol required by the Checker class. For macaroons minted with previous bakery versions, it always returns a single LoginOp operation. :param macaroons: :return: '''...
python
def macaroon_ops(self, macaroons): ''' This method makes the oven satisfy the MacaroonOpStore protocol required by the Checker class. For macaroons minted with previous bakery versions, it always returns a single LoginOp operation. :param macaroons: :return: '''...
[ "def", "macaroon_ops", "(", "self", ",", "macaroons", ")", ":", "if", "len", "(", "macaroons", ")", "==", "0", ":", "raise", "ValueError", "(", "'no macaroons provided'", ")", "storage_id", ",", "ops", "=", "_decode_macaroon_id", "(", "macaroons", "[", "0", ...
This method makes the oven satisfy the MacaroonOpStore protocol required by the Checker class. For macaroons minted with previous bakery versions, it always returns a single LoginOp operation. :param macaroons: :return:
[ "This", "method", "makes", "the", "oven", "satisfy", "the", "MacaroonOpStore", "protocol", "required", "by", "the", "Checker", "class", "." ]
63ce1ef1dabe816eb8aaec48fbb46761c34ddf77
https://github.com/go-macaroon-bakery/py-macaroon-bakery/blob/63ce1ef1dabe816eb8aaec48fbb46761c34ddf77/macaroonbakery/bakery/_oven.py#L153-L204
train
This method returns a list of LoginOp objects for the given macaroon.
ets-labs/python-domain-models
domain_models/collections.py
Collection.append
def append(self, value): """Add an item to the end of the list.""" return super(Collection, self).append( self._ensure_value_is_valid(value))
python
def append(self, value): """Add an item to the end of the list.""" return super(Collection, self).append( self._ensure_value_is_valid(value))
[ "def", "append", "(", "self", ",", "value", ")", ":", "return", "super", "(", "Collection", ",", "self", ")", ".", "append", "(", "self", ".", "_ensure_value_is_valid", "(", "value", ")", ")" ]
Add an item to the end of the list.
[ "Add", "an", "item", "to", "the", "end", "of", "the", "list", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/collections.py#L22-L25
train
Add an item to the end of the list.
ets-labs/python-domain-models
domain_models/collections.py
Collection.extend
def extend(self, iterable): """Extend the list by appending all the items in the given list.""" return super(Collection, self).extend( self._ensure_iterable_is_valid(iterable))
python
def extend(self, iterable): """Extend the list by appending all the items in the given list.""" return super(Collection, self).extend( self._ensure_iterable_is_valid(iterable))
[ "def", "extend", "(", "self", ",", "iterable", ")", ":", "return", "super", "(", "Collection", ",", "self", ")", ".", "extend", "(", "self", ".", "_ensure_iterable_is_valid", "(", "iterable", ")", ")" ]
Extend the list by appending all the items in the given list.
[ "Extend", "the", "list", "by", "appending", "all", "the", "items", "in", "the", "given", "list", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/collections.py#L27-L30
train
Extend the list by appending all the items in the given list.
ets-labs/python-domain-models
domain_models/collections.py
Collection.insert
def insert(self, index, value): """Insert an item at a given position.""" return super(Collection, self).insert( index, self._ensure_value_is_valid(value))
python
def insert(self, index, value): """Insert an item at a given position.""" return super(Collection, self).insert( index, self._ensure_value_is_valid(value))
[ "def", "insert", "(", "self", ",", "index", ",", "value", ")", ":", "return", "super", "(", "Collection", ",", "self", ")", ".", "insert", "(", "index", ",", "self", ".", "_ensure_value_is_valid", "(", "value", ")", ")" ]
Insert an item at a given position.
[ "Insert", "an", "item", "at", "a", "given", "position", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/collections.py#L32-L35
train
Insert an item at a given position.
ets-labs/python-domain-models
domain_models/collections.py
Collection._ensure_value_is_valid
def _ensure_value_is_valid(self, value): """Ensure that value is a valid collection's value.""" if not isinstance(value, self.__class__.value_type): raise TypeError('{0} is not valid collection value, instance ' 'of {1} required'.format( ...
python
def _ensure_value_is_valid(self, value): """Ensure that value is a valid collection's value.""" if not isinstance(value, self.__class__.value_type): raise TypeError('{0} is not valid collection value, instance ' 'of {1} required'.format( ...
[ "def", "_ensure_value_is_valid", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "self", ".", "__class__", ".", "value_type", ")", ":", "raise", "TypeError", "(", "'{0} is not valid collection value, instance '", "'of {1} required'...
Ensure that value is a valid collection's value.
[ "Ensure", "that", "value", "is", "a", "valid", "collection", "s", "value", "." ]
7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9
https://github.com/ets-labs/python-domain-models/blob/7de1816ba0338f20fdb3e0f57fad0ffd5bea13f9/domain_models/collections.py#L71-L77
train
Ensure that value is a valid collection s value.
ph4r05/monero-serialize
monero_serialize/core/message_types.py
container_elem_type
def container_elem_type(container_type, params): """ Returns container element type :param container_type: :param params: :return: """ elem_type = params[0] if params else None if elem_type is None: elem_type = container_type.ELEM_TYPE return elem_type
python
def container_elem_type(container_type, params): """ Returns container element type :param container_type: :param params: :return: """ elem_type = params[0] if params else None if elem_type is None: elem_type = container_type.ELEM_TYPE return elem_type
[ "def", "container_elem_type", "(", "container_type", ",", "params", ")", ":", "elem_type", "=", "params", "[", "0", "]", "if", "params", "else", "None", "if", "elem_type", "is", "None", ":", "elem_type", "=", "container_type", ".", "ELEM_TYPE", "return", "el...
Returns container element type :param container_type: :param params: :return:
[ "Returns", "container", "element", "type" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/message_types.py#L153-L164
train
Returns container element type based on container type and parameters.
ph4r05/monero-serialize
monero_serialize/core/message_types.py
gen_elem_array
def gen_elem_array(size, elem_type=None): """ Generates element array of given size and initializes with given type. Supports container type, used for pre-allocation before deserialization. :param size: :param elem_type: :return: """ if elem_type is None or not callable(elem_type): ...
python
def gen_elem_array(size, elem_type=None): """ Generates element array of given size and initializes with given type. Supports container type, used for pre-allocation before deserialization. :param size: :param elem_type: :return: """ if elem_type is None or not callable(elem_type): ...
[ "def", "gen_elem_array", "(", "size", ",", "elem_type", "=", "None", ")", ":", "if", "elem_type", "is", "None", "or", "not", "callable", "(", "elem_type", ")", ":", "return", "[", "elem_type", "]", "*", "size", "if", "is_type", "(", "elem_type", ",", "...
Generates element array of given size and initializes with given type. Supports container type, used for pre-allocation before deserialization. :param size: :param elem_type: :return:
[ "Generates", "element", "array", "of", "given", "size", "and", "initializes", "with", "given", "type", ".", "Supports", "container", "type", "used", "for", "pre", "-", "allocation", "before", "deserialization", ".", ":", "param", "size", ":", ":", "param", "...
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/core/message_types.py#L167-L185
train
Generates element array of given size and initializes with given type.
Phyks/libbmc
libbmc/doi.py
is_valid
def is_valid(doi): """ Check that a given DOI is a valid canonical DOI. :param doi: The DOI to be checked. :returns: Boolean indicating whether the DOI is valid or not. >>> is_valid('10.1209/0295-5075/111/40005') True >>> is_valid('10.1016.12.31/nature.S0735-1097(98)2000/12/31/34:7-7') ...
python
def is_valid(doi): """ Check that a given DOI is a valid canonical DOI. :param doi: The DOI to be checked. :returns: Boolean indicating whether the DOI is valid or not. >>> is_valid('10.1209/0295-5075/111/40005') True >>> is_valid('10.1016.12.31/nature.S0735-1097(98)2000/12/31/34:7-7') ...
[ "def", "is_valid", "(", "doi", ")", ":", "match", "=", "REGEX", ".", "match", "(", "doi", ")", "return", "(", "match", "is", "not", "None", ")", "and", "(", "match", ".", "group", "(", "0", ")", "==", "doi", ")" ]
Check that a given DOI is a valid canonical DOI. :param doi: The DOI to be checked. :returns: Boolean indicating whether the DOI is valid or not. >>> is_valid('10.1209/0295-5075/111/40005') True >>> is_valid('10.1016.12.31/nature.S0735-1097(98)2000/12/31/34:7-7') True >>> is_valid('10.10...
[ "Check", "that", "a", "given", "DOI", "is", "a", "valid", "canonical", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L26-L58
train
Checks that a given DOI is a valid canonical DOI.
Phyks/libbmc
libbmc/doi.py
to_url
def to_url(dois): """ Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. Can also be a single canonical DOI. :returns: A list of DOIs URLs (resp. a single value). >>> to_url(['10.1209/0295-5075/111/40005']) ['http://dx.doi.org/10.1209/0295-5075/111/40...
python
def to_url(dois): """ Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. Can also be a single canonical DOI. :returns: A list of DOIs URLs (resp. a single value). >>> to_url(['10.1209/0295-5075/111/40005']) ['http://dx.doi.org/10.1209/0295-5075/111/40...
[ "def", "to_url", "(", "dois", ")", ":", "if", "isinstance", "(", "dois", ",", "list", ")", ":", "return", "[", "DX_URL", ".", "format", "(", "doi", "=", "doi", ")", "for", "doi", "in", "dois", "]", "else", ":", "return", "DX_URL", ".", "format", ...
Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. Can also be a single canonical DOI. :returns: A list of DOIs URLs (resp. a single value). >>> to_url(['10.1209/0295-5075/111/40005']) ['http://dx.doi.org/10.1209/0295-5075/111/40005'] >>> to_url('10.1209...
[ "Convert", "a", "list", "of", "canonical", "DOIs", "to", "a", "list", "of", "DOIs", "URLs", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L74-L90
train
Converts a list of DOIs to a list of URLs.
Phyks/libbmc
libbmc/doi.py
get_oa_version
def get_oa_version(doi): """ Get an OA version for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The URL of the OA version of the given DOI, or ``None``. >>> get_oa_version('10.1209/0295-5075/111/40005') 'http://arxiv.org/abs/1506.06690' ...
python
def get_oa_version(doi): """ Get an OA version for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The URL of the OA version of the given DOI, or ``None``. >>> get_oa_version('10.1209/0295-5075/111/40005') 'http://arxiv.org/abs/1506.06690' ...
[ "def", "get_oa_version", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "\"%s%s\"", "%", "(", "DISSEMIN_API", ",", "doi", ")", ")", "request", ".", "raise_for_status", "(", ")", "result", "=", "request", ".", "json", "("...
Get an OA version for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The URL of the OA version of the given DOI, or ``None``. >>> get_oa_version('10.1209/0295-5075/111/40005') 'http://arxiv.org/abs/1506.06690'
[ "Get", "an", "OA", "version", "for", "a", "given", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L116-L137
train
Get an OA version for a given DOI.
Phyks/libbmc
libbmc/doi.py
get_oa_policy
def get_oa_policy(doi): """ Get OA policy for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The OpenAccess policy for the associated publications, or \ ``None`` if unknown. >>> tmp = get_oa_policy('10.1209/0295-5075/111/40005'); (t...
python
def get_oa_policy(doi): """ Get OA policy for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The OpenAccess policy for the associated publications, or \ ``None`` if unknown. >>> tmp = get_oa_policy('10.1209/0295-5075/111/40005'); (t...
[ "def", "get_oa_policy", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "\"%s%s\"", "%", "(", "DISSEMIN_API", ",", "doi", ")", ")", "request", ".", "raise_for_status", "(", ")", "result", "=", "request", ".", "json", "(",...
Get OA policy for a given DOI. .. note:: Uses beta.dissem.in API. :param doi: A canonical DOI. :returns: The OpenAccess policy for the associated publications, or \ ``None`` if unknown. >>> tmp = get_oa_policy('10.1209/0295-5075/111/40005'); (tmp["published"], tmp["preprint"], tm...
[ "Get", "OA", "policy", "for", "a", "given", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L140-L168
train
Get the OA policy for a given DOI.
Phyks/libbmc
libbmc/doi.py
get_linked_version
def get_linked_version(doi): """ Get the original link behind the DOI. :param doi: A canonical DOI. :returns: The canonical URL behind the DOI, or ``None``. >>> get_linked_version('10.1209/0295-5075/111/40005') 'http://stacks.iop.org/0295-5075/111/i=4/a=40005?key=crossref.9ad851948a976ecdf216d...
python
def get_linked_version(doi): """ Get the original link behind the DOI. :param doi: A canonical DOI. :returns: The canonical URL behind the DOI, or ``None``. >>> get_linked_version('10.1209/0295-5075/111/40005') 'http://stacks.iop.org/0295-5075/111/i=4/a=40005?key=crossref.9ad851948a976ecdf216d...
[ "def", "get_linked_version", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "head", "(", "to_url", "(", "doi", ")", ")", "return", "request", ".", "headers", ".", "get", "(", "\"location\"", ")", "except", "RequestException", ":", "re...
Get the original link behind the DOI. :param doi: A canonical DOI. :returns: The canonical URL behind the DOI, or ``None``. >>> get_linked_version('10.1209/0295-5075/111/40005') 'http://stacks.iop.org/0295-5075/111/i=4/a=40005?key=crossref.9ad851948a976ecdf216d4929b0b6f01'
[ "Get", "the", "original", "link", "behind", "the", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L171-L185
train
Get the original link behind the DOI.
Phyks/libbmc
libbmc/doi.py
get_bibtex
def get_bibtex(doi): """ Get a BibTeX entry for a given DOI. .. note:: Adapted from https://gist.github.com/jrsmith3/5513926. :param doi: The canonical DOI to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('10.1209/0295-5075/111/40005') '@article{Verney_20...
python
def get_bibtex(doi): """ Get a BibTeX entry for a given DOI. .. note:: Adapted from https://gist.github.com/jrsmith3/5513926. :param doi: The canonical DOI to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('10.1209/0295-5075/111/40005') '@article{Verney_20...
[ "def", "get_bibtex", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "to_url", "(", "doi", ")", ",", "headers", "=", "{", "\"accept\"", ":", "\"application/x-bibtex\"", "}", ")", "request", ".", "raise_for_status", "(", ")"...
Get a BibTeX entry for a given DOI. .. note:: Adapted from https://gist.github.com/jrsmith3/5513926. :param doi: The canonical DOI to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('10.1209/0295-5075/111/40005') '@article{Verney_2015,\\n\\tdoi = {10.1209/0295-5075...
[ "Get", "a", "BibTeX", "entry", "for", "a", "given", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/doi.py#L188-L209
train
Get a BibTeX entry for a given DOI.
useblocks/groundwork
groundwork/groundwork.py
App._configure_logging
def _configure_logging(self, logger_dict=None): """ Configures the logging module with a given dictionary, which in most cases was loaded from a configuration file. If no dictionary is provided, it falls back to a default configuration. See `Python docs <https://docs.py...
python
def _configure_logging(self, logger_dict=None): """ Configures the logging module with a given dictionary, which in most cases was loaded from a configuration file. If no dictionary is provided, it falls back to a default configuration. See `Python docs <https://docs.py...
[ "def", "_configure_logging", "(", "self", ",", "logger_dict", "=", "None", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Configure logging\"", ")", "# Let's be sure, that for our log no handlers are registered anymore", "for", "handler", "in", "self", ".", "log"...
Configures the logging module with a given dictionary, which in most cases was loaded from a configuration file. If no dictionary is provided, it falls back to a default configuration. See `Python docs <https://docs.python.org/3.5/library/logging.config.html#logging.config.dictConfig>`...
[ "Configures", "the", "logging", "module", "with", "a", "given", "dictionary", "which", "in", "most", "cases", "was", "loaded", "from", "a", "configuration", "file", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/groundwork.py#L92-L120
train
Configure the logging module with a given dictionary.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
dump_blob
async def dump_blob(writer, elem, elem_type, params=None): """ Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, BlobType) elem_params = elem if elem_i...
python
async def dump_blob(writer, elem, elem_type, params=None): """ Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return: """ elem_is_blob = isinstance(elem, BlobType) elem_params = elem if elem_i...
[ "async", "def", "dump_blob", "(", "writer", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "elem_is_blob", "=", "isinstance", "(", "elem", ",", "BlobType", ")", "elem_params", "=", "elem", "if", "elem_is_blob", "or", "elem_type", "is"...
Dumps blob message to the writer. Supports both blob and raw value. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "blob", "message", "to", "the", "writer", ".", "Supports", "both", "blob", "and", "raw", "value", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L743-L762
train
Dumps blob message to the writer.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
load_blob
async def load_blob(reader, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = elem_type.SIZE if elem_type.FIX_SIZE else await load_uvarint(reader)...
python
async def load_blob(reader, elem_type, params=None, elem=None): """ Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return: """ ivalue = elem_type.SIZE if elem_type.FIX_SIZE else await load_uvarint(reader)...
[ "async", "def", "load_blob", "(", "reader", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ")", ":", "ivalue", "=", "elem_type", ".", "SIZE", "if", "elem_type", ".", "FIX_SIZE", "else", "await", "load_uvarint", "(", "reader", ")"...
Loads blob from reader to the element. Returns the loaded blob. :param reader: :param elem_type: :param params: :param elem: :return:
[ "Loads", "blob", "from", "reader", "to", "the", "element", ".", "Returns", "the", "loaded", "blob", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L765-L789
train
Loads blob from reader to the element. Returns the loaded blob.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
dump_unicode
async def dump_unicode(writer, elem): """ Dumps string as UTF8 encoded string :param writer: :param elem: :return: """ await dump_uvarint(writer, len(elem)) await writer.awrite(bytes(elem, 'utf8'))
python
async def dump_unicode(writer, elem): """ Dumps string as UTF8 encoded string :param writer: :param elem: :return: """ await dump_uvarint(writer, len(elem)) await writer.awrite(bytes(elem, 'utf8'))
[ "async", "def", "dump_unicode", "(", "writer", ",", "elem", ")", ":", "await", "dump_uvarint", "(", "writer", ",", "len", "(", "elem", ")", ")", "await", "writer", ".", "awrite", "(", "bytes", "(", "elem", ",", "'utf8'", ")", ")" ]
Dumps string as UTF8 encoded string :param writer: :param elem: :return:
[ "Dumps", "string", "as", "UTF8", "encoded", "string", ":", "param", "writer", ":", ":", "param", "elem", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L792-L800
train
Dumps a string as UTF8 encoded string as a naked XML element.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
load_unicode
async def load_unicode(reader): """ Loads UTF8 string :param reader: :return: """ ivalue = await load_uvarint(reader) fvalue = bytearray(ivalue) await reader.areadinto(fvalue) return str(fvalue, 'utf8')
python
async def load_unicode(reader): """ Loads UTF8 string :param reader: :return: """ ivalue = await load_uvarint(reader) fvalue = bytearray(ivalue) await reader.areadinto(fvalue) return str(fvalue, 'utf8')
[ "async", "def", "load_unicode", "(", "reader", ")", ":", "ivalue", "=", "await", "load_uvarint", "(", "reader", ")", "fvalue", "=", "bytearray", "(", "ivalue", ")", "await", "reader", ".", "areadinto", "(", "fvalue", ")", "return", "str", "(", "fvalue", ...
Loads UTF8 string :param reader: :return:
[ "Loads", "UTF8", "string", ":", "param", "reader", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L803-L812
train
Loads UTF8 string from a reader.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.prepare_container
async def prepare_container(self, size, container, elem_type=None): """ Prepares container for serialization :param size: :param container: :return: """ if not self.writing: if container is None: return gen_elem_array(size, elem_type) ...
python
async def prepare_container(self, size, container, elem_type=None): """ Prepares container for serialization :param size: :param container: :return: """ if not self.writing: if container is None: return gen_elem_array(size, elem_type) ...
[ "async", "def", "prepare_container", "(", "self", ",", "size", ",", "container", ",", "elem_type", "=", "None", ")", ":", "if", "not", "self", ".", "writing", ":", "if", "container", "is", "None", ":", "return", "gen_elem_array", "(", "size", ",", "elem_...
Prepares container for serialization :param size: :param container: :return:
[ "Prepares", "container", "for", "serialization", ":", "param", "size", ":", ":", "param", "container", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L136-L152
train
Prepares the container for serialization.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.blob
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, "serialize_archive"): elem = elem_type() if elem is None else elem return a...
python
async def blob(self, elem=None, elem_type=None, params=None): """ Loads/dumps blob :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, "serialize_archive"): elem = elem_type() if elem is None else elem return a...
[ "async", "def", "blob", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if", "hasattr", "(", "elem_type", "...
Loads/dumps blob :return:
[ "Loads", "/", "dumps", "blob", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L201-L220
train
Load or dump a blob of the current object.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.container
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ if hasattr(container_type, "serialize_archive"): container = container_type() if container is None else container return await container.ser...
python
async def container(self, container=None, container_type=None, params=None): """ Loads/dumps container :return: """ if hasattr(container_type, "serialize_archive"): container = container_type() if container is None else container return await container.ser...
[ "async", "def", "container", "(", "self", ",", "container", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "\"serialize_archive\"", ")", ":", "container", "=", "container_ty...
Loads/dumps container :return:
[ "Loads", "/", "dumps", "container", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L222-L240
train
Load or dump a container.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.container_size
async def container_size( self, container_len=None, container_type=None, params=None ): """ Container size :param container_len: :param container_type: :param params: :return: """ if hasattr(container_type, "serialize_archive"): ...
python
async def container_size( self, container_len=None, container_type=None, params=None ): """ Container size :param container_len: :param container_type: :param params: :return: """ if hasattr(container_type, "serialize_archive"): ...
[ "async", "def", "container_size", "(", "self", ",", "container_len", "=", "None", ",", "container_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "\"serialize_archive\"", ")", ":", "raise", "ValueError", ...
Container size :param container_len: :param container_type: :param params: :return:
[ "Container", "size", ":", "param", "container_len", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L242-L260
train
Get the size of the container.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.container_val
async def container_val(self, elem, container_type, params=None): """ Single cont value :param elem: :param container_type: :param params: :return: """ if hasattr(container_type, "serialize_archive"): raise ValueError("not supported") i...
python
async def container_val(self, elem, container_type, params=None): """ Single cont value :param elem: :param container_type: :param params: :return: """ if hasattr(container_type, "serialize_archive"): raise ValueError("not supported") i...
[ "async", "def", "container_val", "(", "self", ",", "elem", ",", "container_type", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "container_type", ",", "\"serialize_archive\"", ")", ":", "raise", "ValueError", "(", "\"not supported\"", ")", "if", ...
Single cont value :param elem: :param container_type: :param params: :return:
[ "Single", "cont", "value", ":", "param", "elem", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L262-L277
train
Get the value of a single element in a container.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.tuple
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, "serialize_archive"): container = elem_type() if elem is None else elem return await container.serialize_archive( self, ...
python
async def tuple(self, elem=None, elem_type=None, params=None): """ Loads/dumps tuple :return: """ if hasattr(elem_type, "serialize_archive"): container = elem_type() if elem is None else elem return await container.serialize_archive( self, ...
[ "async", "def", "tuple", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "hasattr", "(", "elem_type", ",", "\"serialize_archive\"", ")", ":", "container", "=", "elem_type", "(", ")", "if...
Loads/dumps tuple :return:
[ "Loads", "/", "dumps", "tuple", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L279-L295
train
Load or dump a tuple.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.variant
async def variant(self, elem=None, elem_type=None, params=None, wrapped=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, "ser...
python
async def variant(self, elem=None, elem_type=None, params=None, wrapped=None): """ Loads/dumps variant type :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ if hasattr(elem_type, "ser...
[ "async", "def", "variant", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ",", "wrapped", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "if"...
Loads/dumps variant type :param elem: :param elem_type: :param params: :return:
[ "Loads", "/", "dumps", "variant", "type", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L297-L326
train
Load or dump a single variant from the cache.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.message
async def message(self, msg, msg_type=None, use_version=None): """ Loads/dumps message :param msg: :param msg_type: :param use_version: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ msg = elem_type() if msg is None el...
python
async def message(self, msg, msg_type=None, use_version=None): """ Loads/dumps message :param msg: :param msg_type: :param use_version: :return: """ elem_type = msg_type if msg_type is not None else msg.__class__ msg = elem_type() if msg is None el...
[ "async", "def", "message", "(", "self", ",", "msg", ",", "msg_type", "=", "None", ",", "use_version", "=", "None", ")", ":", "elem_type", "=", "msg_type", "if", "msg_type", "is", "not", "None", "else", "msg", ".", "__class__", "msg", "=", "elem_type", ...
Loads/dumps message :param msg: :param msg_type: :param use_version: :return:
[ "Loads", "/", "dumps", "message", ":", "param", "msg", ":", ":", "param", "msg_type", ":", ":", "param", "use_version", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L328-L348
train
Load and dumps a message.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.message_field
async def message_field(self, msg, field, fvalue=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :return: """ fname, ftype, params = field[0], field[1], field[2:] try: self.tracker.p...
python
async def message_field(self, msg, field, fvalue=None): """ Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :return: """ fname, ftype, params = field[0], field[1], field[2:] try: self.tracker.p...
[ "async", "def", "message_field", "(", "self", ",", "msg", ",", "field", ",", "fvalue", "=", "None", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", "[", "2", ":", "]", "try...
Dumps/Loads message field :param msg: :param field: :param fvalue: explicit value for dump :return:
[ "Dumps", "/", "Loads", "message", "field", ":", "param", "msg", ":", ":", "param", "field", ":", ":", "param", "fvalue", ":", "explicit", "value", "for", "dump", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L350-L368
train
Dumps or loads a message field.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive.field
async def field(self, elem=None, elem_type=None, params=None): """ Archive field :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ fvalue = None etype = self._get_type(elem_ty...
python
async def field(self, elem=None, elem_type=None, params=None): """ Archive field :param elem: :param elem_type: :param params: :return: """ elem_type = elem_type if elem_type else elem.__class__ fvalue = None etype = self._get_type(elem_ty...
[ "async", "def", "field", "(", "self", ",", "elem", "=", "None", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "elem_type", "=", "elem_type", "if", "elem_type", "else", "elem", ".", "__class__", "fvalue", "=", "None", "etype", "="...
Archive field :param elem: :param elem_type: :param params: :return:
[ "Archive", "field", ":", "param", "elem", ":", ":", "param", "elem_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L428-L479
train
Get the archive field.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_container_size
async def _dump_container_size( self, writer, container_len, container_type, params=None ): """ Dumps container size - per element streaming :param writer: :param container_len: :param container_type: :param params: :return: """ if ...
python
async def _dump_container_size( self, writer, container_len, container_type, params=None ): """ Dumps container size - per element streaming :param writer: :param container_len: :param container_type: :param params: :return: """ if ...
[ "async", "def", "_dump_container_size", "(", "self", ",", "writer", ",", "container_len", ",", "container_type", ",", "params", "=", "None", ")", ":", "if", "not", "container_type", "or", "not", "container_type", ".", "FIX_SIZE", ":", "await", "dump_uvarint", ...
Dumps container size - per element streaming :param writer: :param container_len: :param container_type: :param params: :return:
[ "Dumps", "container", "size", "-", "per", "element", "streaming", ":", "param", "writer", ":", ":", "param", "container_len", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L495-L511
train
Dumps the size of the container.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_container_val
async def _dump_container_val(self, writer, elem, container_type, params=None): """ Single elem dump :param writer: :param elem: :param container_type: :param params: :return: """ elem_type = container_elem_type(container_type, params) awai...
python
async def _dump_container_val(self, writer, elem, container_type, params=None): """ Single elem dump :param writer: :param elem: :param container_type: :param params: :return: """ elem_type = container_elem_type(container_type, params) awai...
[ "async", "def", "_dump_container_val", "(", "self", ",", "writer", ",", "elem", ",", "container_type", ",", "params", "=", "None", ")", ":", "elem_type", "=", "container_elem_type", "(", "container_type", ",", "params", ")", "await", "self", ".", "dump_field",...
Single elem dump :param writer: :param elem: :param container_type: :param params: :return:
[ "Single", "elem", "dump", ":", "param", "writer", ":", ":", "param", "elem", ":", ":", "param", "container_type", ":", ":", "param", "params", ":", ":", "return", ":" ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L513-L523
train
Dump a single container value.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_container
async def _dump_container(self, writer, container, container_type, params=None): """ Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :return: """ await self._dump_container_size(wri...
python
async def _dump_container(self, writer, container, container_type, params=None): """ Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :return: """ await self._dump_container_size(wri...
[ "async", "def", "_dump_container", "(", "self", ",", "writer", ",", "container", ",", "container_type", ",", "params", "=", "None", ")", ":", "await", "self", ".", "_dump_container_size", "(", "writer", ",", "len", "(", "container", ")", ",", "container_type...
Dumps container of elements to the writer. :param writer: :param container: :param container_type: :param params: :return:
[ "Dumps", "container", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L525-L547
train
Dumps the container of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._load_container
async def _load_container( self, reader, container_type, params=None, container=None ): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :pa...
python
async def _load_container( self, reader, container_type, params=None, container=None ): """ Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :pa...
[ "async", "def", "_load_container", "(", "self", ",", "reader", ",", "container_type", ",", "params", "=", "None", ",", "container", "=", "None", ")", ":", "c_len", "=", "(", "container_type", ".", "SIZE", "if", "container_type", ".", "FIX_SIZE", "else", "a...
Loads container of elements from the reader. Supports the container ref. Returns loaded container. :param reader: :param container_type: :param params: :param container: :return:
[ "Loads", "container", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "container", "ref", ".", "Returns", "loaded", "container", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L549-L588
train
Loads the container of elements from the reader. Supports the container ref. Returns loaded container.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_tuple
async def _dump_tuple(self, writer, elem, elem_type, params=None): """ Dumps tuple of elements to the writer. :param writer: :param elem: :param elem_type: :param params: :return: """ if len(elem) != len(elem_type.f_specs()): raise Val...
python
async def _dump_tuple(self, writer, elem, elem_type, params=None): """ Dumps tuple of elements to the writer. :param writer: :param elem: :param elem_type: :param params: :return: """ if len(elem) != len(elem_type.f_specs()): raise Val...
[ "async", "def", "_dump_tuple", "(", "self", ",", "writer", ",", "elem", ",", "elem_type", ",", "params", "=", "None", ")", ":", "if", "len", "(", "elem", ")", "!=", "len", "(", "elem_type", ".", "f_specs", "(", ")", ")", ":", "raise", "ValueError", ...
Dumps tuple of elements to the writer. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "tuple", "of", "elements", "to", "the", "writer", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L590-L617
train
Dumps a tuple of elements to the writer.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._load_tuple
async def _load_tuple(self, reader, elem_type, params=None, elem=None): """ Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param reader: :param elem_type: :param params: :param container: :return: """ ...
python
async def _load_tuple(self, reader, elem_type, params=None, elem=None): """ Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param reader: :param elem_type: :param params: :param container: :return: """ ...
[ "async", "def", "_load_tuple", "(", "self", ",", "reader", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ")", ":", "c_len", "=", "await", "load_uvarint", "(", "reader", ")", "if", "elem", "and", "c_len", "!=", "len", "(", "e...
Loads tuple of elements from the reader. Supports the tuple ref. Returns loaded tuple. :param reader: :param elem_type: :param params: :param container: :return:
[ "Loads", "tuple", "of", "elements", "from", "the", "reader", ".", "Supports", "the", "tuple", "ref", ".", "Returns", "loaded", "tuple", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L619-L657
train
Loads a tuple of elements from the reader. Supports the tuple ref.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_message_field
async def _dump_message_field(self, writer, msg, field, fvalue=None): """ Dumps a message field to the writer. Field is defined by the message field specification. :param writer: :param msg: :param field: :param fvalue: :return: """ fname, ftype, ...
python
async def _dump_message_field(self, writer, msg, field, fvalue=None): """ Dumps a message field to the writer. Field is defined by the message field specification. :param writer: :param msg: :param field: :param fvalue: :return: """ fname, ftype, ...
[ "async", "def", "_dump_message_field", "(", "self", ",", "writer", ",", "msg", ",", "field", ",", "fvalue", "=", "None", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", "[", ...
Dumps a message field to the writer. Field is defined by the message field specification. :param writer: :param msg: :param field: :param fvalue: :return:
[ "Dumps", "a", "message", "field", "to", "the", "writer", ".", "Field", "is", "defined", "by", "the", "message", "field", "specification", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L659-L671
train
Dumps a message field to the writer.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._load_message_field
async def _load_message_field(self, reader, msg, field): """ Loads message field from the reader. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :return: """ ...
python
async def _load_message_field(self, reader, msg, field): """ Loads message field from the reader. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :return: """ ...
[ "async", "def", "_load_message_field", "(", "self", ",", "reader", ",", "msg", ",", "field", ")", ":", "fname", ",", "ftype", ",", "params", "=", "field", "[", "0", "]", ",", "field", "[", "1", "]", ",", "field", "[", "2", ":", "]", "await", "sel...
Loads message field from the reader. Field is defined by the message field specification. Returns loaded value, supports field reference. :param reader: :param msg: :param field: :return:
[ "Loads", "message", "field", "from", "the", "reader", ".", "Field", "is", "defined", "by", "the", "message", "field", "specification", ".", "Returns", "loaded", "value", "supports", "field", "reference", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L673-L684
train
Loads a message field from the reader.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._dump_variant
async def _dump_variant(self, writer, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(...
python
async def _dump_variant(self, writer, elem, elem_type=None, params=None): """ Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return: """ if isinstance(...
[ "async", "def", "_dump_variant", "(", "self", ",", "writer", ",", "elem", ",", "elem_type", "=", "None", ",", "params", "=", "None", ")", ":", "if", "isinstance", "(", "elem", ",", "VariantType", ")", "or", "elem_type", ".", "WRAPS_VALUE", ":", "await", ...
Dumps variant type to the writer. Supports both wrapped and raw variant. :param writer: :param elem: :param elem_type: :param params: :return:
[ "Dumps", "variant", "type", "to", "the", "writer", ".", "Supports", "both", "wrapped", "and", "raw", "variant", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L686-L706
train
Dumps the contents of the specified variant to the writer.
ph4r05/monero-serialize
monero_serialize/xmrserialize.py
Archive._load_variant
async def _load_variant( self, reader, elem_type, params=None, elem=None, wrapped=None ): """ Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wr...
python
async def _load_variant( self, reader, elem_type, params=None, elem=None, wrapped=None ): """ Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wr...
[ "async", "def", "_load_variant", "(", "self", ",", "reader", ",", "elem_type", ",", "params", "=", "None", ",", "elem", "=", "None", ",", "wrapped", "=", "None", ")", ":", "is_wrapped", "=", "(", "(", "isinstance", "(", "elem", ",", "VariantType", ")",...
Loads variant type from the reader. Supports both wrapped and raw variant. :param reader: :param elem_type: :param params: :param elem: :param wrapped: :return:
[ "Loads", "variant", "type", "from", "the", "reader", ".", "Supports", "both", "wrapped", "and", "raw", "variant", "." ]
cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42
https://github.com/ph4r05/monero-serialize/blob/cebb3ba2aaf2e9211b1dcc6db2bab02946d06e42/monero_serialize/xmrserialize.py#L708-L740
train
Loads a single variant from the reader.
dbarsam/python-vsgen
vsgen/util/timer.py
VSGTimer.start
def start(self, message): """ Manually starts timer with the message. :param message: The display message. """ self._start = time.clock() VSGLogger.info("{0:<20} - Started".format(message))
python
def start(self, message): """ Manually starts timer with the message. :param message: The display message. """ self._start = time.clock() VSGLogger.info("{0:<20} - Started".format(message))
[ "def", "start", "(", "self", ",", "message", ")", ":", "self", ".", "_start", "=", "time", ".", "clock", "(", ")", "VSGLogger", ".", "info", "(", "\"{0:<20} - Started\"", ".", "format", "(", "message", ")", ")" ]
Manually starts timer with the message. :param message: The display message.
[ "Manually", "starts", "timer", "with", "the", "message", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/timer.py#L47-L54
train
Starts timer with the message.
dbarsam/python-vsgen
vsgen/util/timer.py
VSGTimer.stop
def stop(self, message): """ Manually stops timer with the message. :param message: The display message. """ self._stop = time.clock() VSGLogger.info("{0:<20} - Finished [{1}s]".format(message, self.pprint(self._stop - self._start)))
python
def stop(self, message): """ Manually stops timer with the message. :param message: The display message. """ self._stop = time.clock() VSGLogger.info("{0:<20} - Finished [{1}s]".format(message, self.pprint(self._stop - self._start)))
[ "def", "stop", "(", "self", ",", "message", ")", ":", "self", ".", "_stop", "=", "time", ".", "clock", "(", ")", "VSGLogger", ".", "info", "(", "\"{0:<20} - Finished [{1}s]\"", ".", "format", "(", "message", ",", "self", ".", "pprint", "(", "self", "."...
Manually stops timer with the message. :param message: The display message.
[ "Manually", "stops", "timer", "with", "the", "message", "." ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/timer.py#L56-L63
train
Stop timer with the message.
dbarsam/python-vsgen
vsgen/util/timer.py
VSGTimer.pprint
def pprint(self, seconds): """ Pretty Prints seconds as Hours:Minutes:Seconds.MilliSeconds :param seconds: The time in seconds. """ return ("%d:%02d:%02d.%03d", reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(seconds * 1000,), 1000, 60, 60]))
python
def pprint(self, seconds): """ Pretty Prints seconds as Hours:Minutes:Seconds.MilliSeconds :param seconds: The time in seconds. """ return ("%d:%02d:%02d.%03d", reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(seconds * 1000,), 1000, 60, 60]))
[ "def", "pprint", "(", "self", ",", "seconds", ")", ":", "return", "(", "\"%d:%02d:%02d.%03d\"", ",", "reduce", "(", "lambda", "ll", ",", "b", ":", "divmod", "(", "ll", "[", "0", "]", ",", "b", ")", "+", "ll", "[", "1", ":", "]", ",", "[", "(", ...
Pretty Prints seconds as Hours:Minutes:Seconds.MilliSeconds :param seconds: The time in seconds.
[ "Pretty", "Prints", "seconds", "as", "Hours", ":", "Minutes", ":", "Seconds", ".", "MilliSeconds" ]
640191bb018a1ff7d7b7a4982e0d3c1a423ba878
https://github.com/dbarsam/python-vsgen/blob/640191bb018a1ff7d7b7a4982e0d3c1a423ba878/vsgen/util/timer.py#L65-L71
train
Pretty Prints seconds as Hours : Minutes. MilliSeconds
Phyks/libbmc
libbmc/papers/identifiers.py
find_identifiers
def find_identifiers(src): """ Search for a valid identifier (DOI, ISBN, arXiv, HAL) in a given file. .. note:: This function returns the first matching identifier, that is the most likely to be relevant for this file. However, it may fail and return an identifier taken from the re...
python
def find_identifiers(src): """ Search for a valid identifier (DOI, ISBN, arXiv, HAL) in a given file. .. note:: This function returns the first matching identifier, that is the most likely to be relevant for this file. However, it may fail and return an identifier taken from the re...
[ "def", "find_identifiers", "(", "src", ")", ":", "if", "src", ".", "endswith", "(", "\".pdf\"", ")", ":", "totext", "=", "subprocess", ".", "Popen", "(", "[", "\"pdftotext\"", ",", "src", ",", "\"-\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE"...
Search for a valid identifier (DOI, ISBN, arXiv, HAL) in a given file. .. note:: This function returns the first matching identifier, that is the most likely to be relevant for this file. However, it may fail and return an identifier taken from the references or another paper. .. note...
[ "Search", "for", "a", "valid", "identifier", "(", "DOI", "ISBN", "arXiv", "HAL", ")", "in", "a", "given", "file", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/identifiers.py#L20-L69
train
Searches for a valid identifier in a given file.
Phyks/libbmc
libbmc/papers/identifiers.py
get_bibtex
def get_bibtex(identifier): """ Try to fetch BibTeX from a found identifier. .. note:: Calls the functions in the respective identifiers module. :param identifier: a tuple (type, identifier) with a valid type. :returns: A BibTeX string or ``None`` if an error occurred. # TODO: Should ...
python
def get_bibtex(identifier): """ Try to fetch BibTeX from a found identifier. .. note:: Calls the functions in the respective identifiers module. :param identifier: a tuple (type, identifier) with a valid type. :returns: A BibTeX string or ``None`` if an error occurred. # TODO: Should ...
[ "def", "get_bibtex", "(", "identifier", ")", ":", "identifier_type", ",", "identifier_id", "=", "identifier", "if", "identifier_type", "not", "in", "__valid_identifiers__", ":", "return", "None", "# Dynamically call the ``get_bibtex`` method from the associated module.", "mod...
Try to fetch BibTeX from a found identifier. .. note:: Calls the functions in the respective identifiers module. :param identifier: a tuple (type, identifier) with a valid type. :returns: A BibTeX string or ``None`` if an error occurred. # TODO: Should return a BiBTeX object?
[ "Try", "to", "fetch", "BibTeX", "from", "a", "found", "identifier", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/identifiers.py#L72-L92
train
Try to fetch a BiBTeX string from a found identifier.
SandstoneHPC/sandstone-ide
sandstone/lib/handlers/rest.py
JSONHandler.initialize
def initialize(self,*args,**kwargs): """ Only try to parse as JSON if the JSON content type header is set. """ super(JSONHandler,self).initialize(*args,**kwargs) content_type = self.request.headers.get('Content-Type', '') if 'application/json' in content_type.lowe...
python
def initialize(self,*args,**kwargs): """ Only try to parse as JSON if the JSON content type header is set. """ super(JSONHandler,self).initialize(*args,**kwargs) content_type = self.request.headers.get('Content-Type', '') if 'application/json' in content_type.lowe...
[ "def", "initialize", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "JSONHandler", ",", "self", ")", ".", "initialize", "(", "*", "args", ",", "*", "*", "kwargs", ")", "content_type", "=", "self", ".", "request", "....
Only try to parse as JSON if the JSON content type header is set.
[ "Only", "try", "to", "parse", "as", "JSON", "if", "the", "JSON", "content", "type", "header", "is", "set", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/handlers/rest.py#L17-L25
train
Initialize the JSON handler.
Phyks/libbmc
libbmc/citations/bibtex.py
get_plaintext_citations
def get_plaintext_citations(bibtex): """ Parse a BibTeX file to get a clean list of plaintext citations. :param bibtex: Either the path to the BibTeX file or the content of a \ BibTeX file. :returns: A list of cleaned plaintext citations. """ parser = BibTexParser() parser.cust...
python
def get_plaintext_citations(bibtex): """ Parse a BibTeX file to get a clean list of plaintext citations. :param bibtex: Either the path to the BibTeX file or the content of a \ BibTeX file. :returns: A list of cleaned plaintext citations. """ parser = BibTexParser() parser.cust...
[ "def", "get_plaintext_citations", "(", "bibtex", ")", ":", "parser", "=", "BibTexParser", "(", ")", "parser", ".", "customization", "=", "convert_to_unicode", "# Load the BibTeX", "if", "os", ".", "path", ".", "isfile", "(", "bibtex", ")", ":", "with", "open",...
Parse a BibTeX file to get a clean list of plaintext citations. :param bibtex: Either the path to the BibTeX file or the content of a \ BibTeX file. :returns: A list of cleaned plaintext citations.
[ "Parse", "a", "BibTeX", "file", "to", "get", "a", "clean", "list", "of", "plaintext", "citations", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/citations/bibtex.py#L36-L56
train
Parse a BibTeX file to get a list of plaintext citations.
suurjaak/InputScope
inputscope/conf.py
init
def init(filename=ConfigPath): """Loads INI configuration into this module's attributes.""" section, parts = "DEFAULT", filename.rsplit(":", 1) if len(parts) > 1 and os.path.isfile(parts[0]): filename, section = parts if not os.path.isfile(filename): return vardict, parser = globals(), config...
python
def init(filename=ConfigPath): """Loads INI configuration into this module's attributes.""" section, parts = "DEFAULT", filename.rsplit(":", 1) if len(parts) > 1 and os.path.isfile(parts[0]): filename, section = parts if not os.path.isfile(filename): return vardict, parser = globals(), config...
[ "def", "init", "(", "filename", "=", "ConfigPath", ")", ":", "section", ",", "parts", "=", "\"DEFAULT\"", ",", "filename", ".", "rsplit", "(", "\":\"", ",", "1", ")", "if", "len", "(", "parts", ")", ">", "1", "and", "os", ".", "path", ".", "isfile"...
Loads INI configuration into this module's attributes.
[ "Loads", "INI", "configuration", "into", "this", "module", "s", "attributes", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/conf.py#L253-L270
train
Loads INI configuration into this module s attributes.
suurjaak/InputScope
inputscope/conf.py
save
def save(filename=ConfigPath): """Saves this module's changed attributes to INI configuration.""" default_values = defaults() parser = configparser.RawConfigParser() parser.optionxform = str # Force case-sensitivity on names try: save_types = basestring, int, float, tuple, list, dict, ...
python
def save(filename=ConfigPath): """Saves this module's changed attributes to INI configuration.""" default_values = defaults() parser = configparser.RawConfigParser() parser.optionxform = str # Force case-sensitivity on names try: save_types = basestring, int, float, tuple, list, dict, ...
[ "def", "save", "(", "filename", "=", "ConfigPath", ")", ":", "default_values", "=", "defaults", "(", ")", "parser", "=", "configparser", ".", "RawConfigParser", "(", ")", "parser", ".", "optionxform", "=", "str", "# Force case-sensitivity on names\r", "try", ":"...
Saves this module's changed attributes to INI configuration.
[ "Saves", "this", "module", "s", "changed", "attributes", "to", "INI", "configuration", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/conf.py#L273-L294
train
Saves this module s changed attributes to INI configuration.
suurjaak/InputScope
inputscope/conf.py
defaults
def defaults(values={}): """Returns a once-assembled dict of this module's storable attributes.""" if values: return values save_types = basestring, int, float, tuple, list, dict, type(None) for k, v in globals().items(): if isinstance(v, save_types) and not k.startswith("_"): values[k] = v...
python
def defaults(values={}): """Returns a once-assembled dict of this module's storable attributes.""" if values: return values save_types = basestring, int, float, tuple, list, dict, type(None) for k, v in globals().items(): if isinstance(v, save_types) and not k.startswith("_"): values[k] = v...
[ "def", "defaults", "(", "values", "=", "{", "}", ")", ":", "if", "values", ":", "return", "values", "save_types", "=", "basestring", ",", "int", ",", "float", ",", "tuple", ",", "list", ",", "dict", ",", "type", "(", "None", ")", "for", "k", ",", ...
Returns a once-assembled dict of this module's storable attributes.
[ "Returns", "a", "once", "-", "assembled", "dict", "of", "this", "module", "s", "storable", "attributes", "." ]
245ff045163a1995e8cd5ac558d0a93024eb86eb
https://github.com/suurjaak/InputScope/blob/245ff045163a1995e8cd5ac558d0a93024eb86eb/inputscope/conf.py#L297-L303
train
Returns a once - assembled dict of this module s storable attributes.
Phyks/libbmc
libbmc/papers/tearpages.py
fix_pdf
def fix_pdf(pdf_file, destination): """ Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination """ tmp = tempfile.NamedTemporaryFile() wit...
python
def fix_pdf(pdf_file, destination): """ Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination """ tmp = tempfile.NamedTemporaryFile() wit...
[ "def", "fix_pdf", "(", "pdf_file", ",", "destination", ")", ":", "tmp", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "with", "open", "(", "tmp", ".", "name", ",", "'wb'", ")", "as", "output", ":", "with", "open", "(", "pdf_file", ",", "\"rb\""...
Fix malformed pdf files when data are present after '%%EOF' ..note :: Originally from sciunto, https://github.com/sciunto/tear-pages :param pdfFile: PDF filepath :param destination: destination
[ "Fix", "malformed", "pdf", "files", "when", "data", "are", "present", "after", "%%EOF" ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L24-L42
train
Fix malformed PDF files when data are present after '%%EOF'
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage_backend
def tearpage_backend(filename, teared_pages=None): """ Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. ...
python
def tearpage_backend(filename, teared_pages=None): """ Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. ...
[ "def", "tearpage_backend", "(", "filename", ",", "teared_pages", "=", "None", ")", ":", "# Handle default argument", "if", "teared_pages", "is", "None", ":", "teared_pages", "=", "[", "0", "]", "# Copy the pdf to a tmp file", "with", "tempfile", ".", "NamedTemporary...
Copy filename to a tempfile, write pages to filename except the teared one. ..note :: Adapted from sciunto's code, https://github.com/sciunto/tear-pages :param filename: PDF filepath :param teared_pages: Numbers of the pages to tear. Default to first page \ only.
[ "Copy", "filename", "to", "a", "tempfile", "write", "pages", "to", "filename", "except", "the", "teared", "one", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L45-L85
train
This function tears the pages of a PDF file into a temporary file and writes pages to filename except the first one.
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage_needed
def tearpage_needed(bibtex): """ Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear. """ for publisher in BAD_JOURNALS: if publish...
python
def tearpage_needed(bibtex): """ Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear. """ for publisher in BAD_JOURNALS: if publish...
[ "def", "tearpage_needed", "(", "bibtex", ")", ":", "for", "publisher", "in", "BAD_JOURNALS", ":", "if", "publisher", "in", "bibtex", ".", "get", "(", "\"journal\"", ",", "\"\"", ")", ".", "lower", "(", ")", ":", "# Bad journal is found, add pages to tear", "re...
Check whether a given paper needs some pages to be teared or not. :params bibtex: The bibtex entry associated to the paper, to guess \ whether tearing is needed. :returns: A list of pages to tear.
[ "Check", "whether", "a", "given", "paper", "needs", "some", "pages", "to", "be", "teared", "or", "not", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L88-L102
train
Check whether a given paper needs some pages to be teared or not.
Phyks/libbmc
libbmc/papers/tearpages.py
tearpage
def tearpage(filename, bibtex=None, force=None): """ Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If ...
python
def tearpage(filename, bibtex=None, force=None): """ Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If ...
[ "def", "tearpage", "(", "filename", ",", "bibtex", "=", "None", ",", "force", "=", "None", ")", ":", "# Fetch pages to tear", "pages_to_tear", "=", "[", "]", "if", "force", "is", "not", "None", ":", "pages_to_tear", "=", "force", "elif", "bibtex", "is", ...
Tear some pages of the file if needed. :params filename: Path to the file to handle. :params bibtex: BibTeX dict associated to this file, as the one given by \ ``bibtexparser``. (Mandatory if force is not specified) :params force: If a list of integers, force the tearing of the \ sp...
[ "Tear", "some", "pages", "of", "the", "file", "if", "needed", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/papers/tearpages.py#L105-L130
train
Tears pages of the file if needed.
theiviaxx/python-perforce
perforce/api.py
connect
def connect(*args, **kwargs): """Creates or returns a singleton :class:`.Connection` object""" global __CONNECTION if __CONNECTION is None: __CONNECTION = Connection(*args, **kwargs) return __CONNECTION
python
def connect(*args, **kwargs): """Creates or returns a singleton :class:`.Connection` object""" global __CONNECTION if __CONNECTION is None: __CONNECTION = Connection(*args, **kwargs) return __CONNECTION
[ "def", "connect", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "global", "__CONNECTION", "if", "__CONNECTION", "is", "None", ":", "__CONNECTION", "=", "Connection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "__CONNECTION" ]
Creates or returns a singleton :class:`.Connection` object
[ "Creates", "or", "returns", "a", "singleton", ":", "class", ":", ".", "Connection", "object" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L19-L25
train
Creates or returns a singleton : class :. Connection object
theiviaxx/python-perforce
perforce/api.py
edit
def edit(filename, connection=None): """Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if r...
python
def edit(filename, connection=None): """Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if r...
[ "def", "edit", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "rev", "=", "c", ".", "ls", "(", "filename", ")", "if", "rev", ":", "rev", "[", "0", "]", ".", "edit", "(", ")" ]
Checks out a file into the default changelist :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Checks", "out", "a", "file", "into", "the", "default", "changelist" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L28-L39
train
Checks out a file into the default changelist
theiviaxx/python-perforce
perforce/api.py
sync
def sync(filename, connection=None): """Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if rev: rev[0].sync()
python
def sync(filename, connection=None): """Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() rev = c.ls(filename) if rev: rev[0].sync()
[ "def", "sync", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "rev", "=", "c", ".", "ls", "(", "filename", ")", "if", "rev", ":", "rev", "[", "0", "]", ".", "sync", "(", ")" ]
Syncs a file :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Syncs", "a", "file" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L42-L53
train
Syncs a file containing a node s metadata.
theiviaxx/python-perforce
perforce/api.py
open
def open(filename, connection=None): """Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() res ...
python
def open(filename, connection=None): """Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection` """ c = connection or connect() res ...
[ "def", "open", "(", "filename", ",", "connection", "=", "None", ")", ":", "c", "=", "connection", "or", "connect", "(", ")", "res", "=", "c", ".", "ls", "(", "filename", ")", "if", "res", "and", "res", "[", "0", "]", ".", "revision", ":", "res", ...
Edits or Adds a filename ensuring the file is in perforce and editable :param filename: File to check out :type filename: str :param connection: Connection object to use :type connection: :py:class:`Connection`
[ "Edits", "or", "Adds", "a", "filename", "ensuring", "the", "file", "is", "in", "perforce", "and", "editable" ]
01a3b01fe5949126fa0097d9a8ad386887823b5a
https://github.com/theiviaxx/python-perforce/blob/01a3b01fe5949126fa0097d9a8ad386887823b5a/perforce/api.py#L81-L94
train
Edits or Adds a filename ensuring the file is in perforce and editable
swevm/scaleio-py
scaleiopy/api/scaleio/cluster/faultset.py
FaultSet.set_faultset_name
def set_faultset_name(self, name, fsObj): """ Set name for Faultset :param name: Name of Faultset :param fsObj: ScaleIO FS object :return: POST request response :rtype: Requests POST response object """ # Set name of FaultSet self.conn.connection._...
python
def set_faultset_name(self, name, fsObj): """ Set name for Faultset :param name: Name of Faultset :param fsObj: ScaleIO FS object :return: POST request response :rtype: Requests POST response object """ # Set name of FaultSet self.conn.connection._...
[ "def", "set_faultset_name", "(", "self", ",", "name", ",", "fsObj", ")", ":", "# Set name of FaultSet", "self", ".", "conn", ".", "connection", ".", "_check_login", "(", ")", "faultSetNameDict", "=", "{", "'Name'", ":", "name", "}", "# This one is the most logic...
Set name for Faultset :param name: Name of Faultset :param fsObj: ScaleIO FS object :return: POST request response :rtype: Requests POST response object
[ "Set", "name", "for", "Faultset", ":", "param", "name", ":", "Name", "of", "Faultset", ":", "param", "fsObj", ":", "ScaleIO", "FS", "object", ":", "return", ":", "POST", "request", "response", ":", "rtype", ":", "Requests", "POST", "response", "object" ]
d043a0137cb925987fd5c895a3210968ce1d9028
https://github.com/swevm/scaleio-py/blob/d043a0137cb925987fd5c895a3210968ce1d9028/scaleiopy/api/scaleio/cluster/faultset.py#L45-L61
train
Set the name of the FaultSet for this object
Phyks/libbmc
libbmc/repositories/arxiv.py
is_valid
def is_valid(arxiv_id): """ Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690...
python
def is_valid(arxiv_id): """ Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690...
[ "def", "is_valid", "(", "arxiv_id", ")", ":", "match", "=", "REGEX", ".", "match", "(", "arxiv_id", ")", "return", "(", "match", "is", "not", "None", ")", "and", "(", "match", ".", "group", "(", "0", ")", "==", "arxiv_id", ")" ]
Check that a given arXiv ID is a valid one. :param arxiv_id: The arXiv ID to be checked. :returns: Boolean indicating whether the arXiv ID is valid or not. >>> is_valid('1506.06690') True >>> is_valid('1506.06690v1') True >>> is_valid('arXiv:1506.06690') True >>> is_valid('arXiv...
[ "Check", "that", "a", "given", "arXiv", "ID", "is", "a", "valid", "one", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L235-L273
train
Checks that a given arXiv ID is a valid arXiv ID.
Phyks/libbmc
libbmc/repositories/arxiv.py
get_bibtex
def get_bibtex(arxiv_id): """ Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article...
python
def get_bibtex(arxiv_id): """ Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article...
[ "def", "get_bibtex", "(", "arxiv_id", ")", ":", "# Fetch bibtex using arxiv2bib module", "try", ":", "bibtex", "=", "arxiv2bib", ".", "arxiv2bib", "(", "[", "arxiv_id", "]", ")", "except", "HTTPError", ":", "bibtex", "=", "[", "]", "for", "bib", "in", "bibte...
Get a BibTeX entry for a given arXiv ID. .. note:: Using awesome https://pypi.python.org/pypi/arxiv2bib/ module. :param arxiv_id: The canonical arXiv id to get BibTeX from. :returns: A BibTeX string or ``None``. >>> get_bibtex('1506.06690') "@article{1506.06690v2,\\nAuthor = {Luca...
[ "Get", "a", "BibTeX", "entry", "for", "a", "given", "arXiv", "ID", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L276-L306
train
Return a BibTeX entry for a given arXiv ID.
Phyks/libbmc
libbmc/repositories/arxiv.py
extract_from_text
def extract_from_text(text): """ Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ...
python
def extract_from_text(text): """ Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ...
[ "def", "extract_from_text", "(", "text", ")", ":", "# Remove the leading \"arxiv:\".", "return", "tools", ".", "remove_duplicates", "(", "[", "re", ".", "sub", "(", "\"arxiv:\"", ",", "\"\"", ",", "i", "[", "0", "]", ",", "flags", "=", "re", ".", "IGNORECA...
Extract arXiv IDs from a text. :param text: The text to extract arXiv IDs from. :returns: A list of matching arXiv IDs, in canonical form. >>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 math.GT/0309136 abcdf bar1506.06690foo ma...
[ "Extract", "arXiv", "IDs", "from", "a", "text", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L309-L322
train
Extract arXiv IDs from a text.
Phyks/libbmc
libbmc/repositories/arxiv.py
to_url
def to_url(arxiv_ids): """ Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. :returns: A list of DOIs URLs. >>> to_url('1506.06690') 'http://arxiv.org/abs/1506.06690' >>> to_url('1506.06690v1') 'http://arxiv.org/abs/1506.06690v1' """ ...
python
def to_url(arxiv_ids): """ Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. :returns: A list of DOIs URLs. >>> to_url('1506.06690') 'http://arxiv.org/abs/1506.06690' >>> to_url('1506.06690v1') 'http://arxiv.org/abs/1506.06690v1' """ ...
[ "def", "to_url", "(", "arxiv_ids", ")", ":", "if", "isinstance", "(", "arxiv_ids", ",", "list", ")", ":", "return", "[", "ARXIV_URL", ".", "format", "(", "arxiv_id", "=", "arxiv_id", ")", "for", "arxiv_id", "in", "arxiv_ids", "]", "else", ":", "return", ...
Convert a list of canonical DOIs to a list of DOIs URLs. :param dois: List of canonical DOIs. :returns: A list of DOIs URLs. >>> to_url('1506.06690') 'http://arxiv.org/abs/1506.06690' >>> to_url('1506.06690v1') 'http://arxiv.org/abs/1506.06690v1'
[ "Convert", "a", "list", "of", "canonical", "DOIs", "to", "a", "list", "of", "DOIs", "URLs", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L325-L341
train
Converts a list of ARXIV IDs to a list of URLs.
Phyks/libbmc
libbmc/repositories/arxiv.py
from_doi
def from_doi(doi): """ Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_d...
python
def from_doi(doi): """ Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_d...
[ "def", "from_doi", "(", "doi", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "\"http://export.arxiv.org/api/query\"", ",", "params", "=", "{", "\"search_query\"", ":", "\"doi:%s\"", "%", "(", "doi", ",", ")", ",", "\"max_results\"", ":",...
Get the arXiv eprint id for a given DOI. .. note:: Uses arXiv API. Will not return anything if arXiv is not aware of the associated DOI. :param doi: The DOI of the resource to look for. :returns: The arXiv eprint id, or ``None`` if not found. >>> from_doi('10.1209/0295-5075/111/40005...
[ "Get", "the", "arXiv", "eprint", "id", "for", "a", "given", "DOI", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L366-L397
train
Get the arXiv eprint id for a given DOI.
Phyks/libbmc
libbmc/repositories/arxiv.py
get_sources
def get_sources(arxiv_id): """ Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401...
python
def get_sources(arxiv_id): """ Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401...
[ "def", "get_sources", "(", "arxiv_id", ")", ":", "try", ":", "request", "=", "requests", ".", "get", "(", "ARXIV_EPRINT_URL", ".", "format", "(", "arxiv_id", "=", "arxiv_id", ")", ")", "request", ".", "raise_for_status", "(", ")", "file_object", "=", "io",...
Download sources on arXiv for a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param eprint: The arXiv id (e.g. ``1401.2910`` or ``1401.2910v1``) in a \ canonical...
[ "Download", "sources", "on", "arXiv", "for", "a", "given", "preprint", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L435-L455
train
Downloads sources on arXiv for a given preprint.
Phyks/libbmc
libbmc/repositories/arxiv.py
get_bbl
def get_bbl(arxiv_id): """ Get the .bbl files (if any) of a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ``1401....
python
def get_bbl(arxiv_id): """ Get the .bbl files (if any) of a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ``1401....
[ "def", "get_bbl", "(", "arxiv_id", ")", ":", "tar_file", "=", "get_sources", "(", "arxiv_id", ")", "bbl_files", "=", "[", "i", "for", "i", "in", "tar_file", ".", "getmembers", "(", ")", "if", "i", ".", "name", ".", "endswith", "(", "\".bbl\"", ")", "...
Get the .bbl files (if any) of a given preprint. .. note:: Bulk download of sources from arXiv is not permitted by their API. \ You should have a look at http://arxiv.org/help/bulk_data_s3. :param arxiv_id: The arXiv id (e.g. ``1401.2910`` or ``1401.2910v1``) in \ a canoni...
[ "Get", "the", ".", "bbl", "files", "(", "if", "any", ")", "of", "a", "given", "preprint", "." ]
9ef1a29d2514157d1edd6c13ecbd61b07ae9315e
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/repositories/arxiv.py#L458-L476
train
Get the. bbl files of a given preprint.
crm416/semantic
semantic/dates.py
extractDates
def extractDates(inp, tz=None, now=None): """Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. ...
python
def extractDates(inp, tz=None, now=None): """Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. ...
[ "def", "extractDates", "(", "inp", ",", "tz", "=", "None", ",", "now", "=", "None", ")", ":", "service", "=", "DateService", "(", "tz", "=", "tz", ",", "now", "=", "now", ")", "return", "service", ".", "extractDates", "(", "inp", ")" ]
Extract semantic date information from an input string. This is a convenience method which would only be used if you'd rather not initialize a DateService object. Args: inp (str): The input string to be parsed. tz: An optional Pytz timezone. All datetime objects returned will be...
[ "Extract", "semantic", "date", "information", "from", "an", "input", "string", ".", "This", "is", "a", "convenience", "method", "which", "would", "only", "be", "used", "if", "you", "d", "rather", "not", "initialize", "a", "DateService", "object", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L476-L495
train
This method extracts semantic date information from an input string.
crm416/semantic
semantic/dates.py
DateService.extractDays
def extractDays(self, inp): """Extracts all day-related information from an input string. Ignores any information related to the specific time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects containing the extracted date f...
python
def extractDays(self, inp): """Extracts all day-related information from an input string. Ignores any information related to the specific time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects containing the extracted date f...
[ "def", "extractDays", "(", "self", ",", "inp", ")", ":", "inp", "=", "self", ".", "_preprocess", "(", "inp", ")", "def", "extractDayOfWeek", "(", "dayMatch", ")", ":", "if", "dayMatch", ".", "group", "(", "5", ")", "in", "self", ".", "__daysOfWeek__", ...
Extracts all day-related information from an input string. Ignores any information related to the specific time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects containing the extracted date from the input snippet, or a...
[ "Extracts", "all", "day", "-", "related", "information", "from", "an", "input", "string", ".", "Ignores", "any", "information", "related", "to", "the", "specific", "time", "-", "of", "-", "day", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L145-L253
train
Extracts all day - related information from an input string.
crm416/semantic
semantic/dates.py
DateService.extractTimes
def extractTimes(self, inp): """Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects con...
python
def extractTimes(self, inp): """Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects con...
[ "def", "extractTimes", "(", "self", ",", "inp", ")", ":", "def", "handleMatch", "(", "time", ")", ":", "relative", "=", "False", "if", "not", "time", ":", "return", "None", "# Default times: 8am, 12pm, 7pm", "elif", "time", ".", "group", "(", "1", ")", "...
Extracts time-related information from an input string. Ignores any information related to the specific date, focusing on the time-of-day. Args: inp (str): Input string to be parsed. Returns: A list of datetime objects containing the extracted times from the ...
[ "Extracts", "time", "-", "related", "information", "from", "an", "input", "string", ".", "Ignores", "any", "information", "related", "to", "the", "specific", "date", "focusing", "on", "the", "time", "-", "of", "-", "day", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L263-L339
train
Extracts time - related information from an input string.
crm416/semantic
semantic/dates.py
DateService.extractDates
def extractDates(self, inp): """Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. ...
python
def extractDates(self, inp): """Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. ...
[ "def", "extractDates", "(", "self", ",", "inp", ")", ":", "def", "merge", "(", "param", ")", ":", "day", ",", "time", "=", "param", "if", "not", "(", "day", "or", "time", ")", ":", "return", "None", "if", "not", "day", ":", "return", "time", "if"...
Extract semantic date information from an input string. In effect, runs both parseDay and parseTime on the input string and merges the results to produce a comprehensive datetime object. Args: inp (str): Input string to be parsed. Returns: A list of date...
[ "Extract", "semantic", "date", "information", "from", "an", "input", "string", ".", "In", "effect", "runs", "both", "parseDay", "and", "parseTime", "on", "the", "input", "string", "and", "merges", "the", "results", "to", "produce", "a", "comprehensive", "datet...
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L349-L378
train
Extract semantic date information from an input string.
crm416/semantic
semantic/dates.py
DateService.extractDate
def extractDate(self, inp): """Returns the first date found in the input string, or None if not found.""" dates = self.extractDates(inp) for date in dates: return date return None
python
def extractDate(self, inp): """Returns the first date found in the input string, or None if not found.""" dates = self.extractDates(inp) for date in dates: return date return None
[ "def", "extractDate", "(", "self", ",", "inp", ")", ":", "dates", "=", "self", ".", "extractDates", "(", "inp", ")", "for", "date", "in", "dates", ":", "return", "date", "return", "None" ]
Returns the first date found in the input string, or None if not found.
[ "Returns", "the", "first", "date", "found", "in", "the", "input", "string", "or", "None", "if", "not", "found", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L380-L386
train
Returns the first date found in the input string or None if not found.
crm416/semantic
semantic/dates.py
DateService.convertDay
def convertDay(self, day, prefix="", weekday=False): """Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument ...
python
def convertDay(self, day, prefix="", weekday=False): """Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument ...
[ "def", "convertDay", "(", "self", ",", "day", ",", "prefix", "=", "\"\"", ",", "weekday", "=", "False", ")", ":", "def", "sameDay", "(", "d1", ",", "d2", ")", ":", "d", "=", "d1", ".", "day", "==", "d2", ".", "day", "m", "=", "d1", ".", "mont...
Convert a datetime object representing a day into a human-ready string that can be read, spoken aloud, etc. Args: day (datetime.date): A datetime object to be converted into text. prefix (str): An optional argument that prefixes the converted string. For example,...
[ "Convert", "a", "datetime", "object", "representing", "a", "day", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L388-L427
train
Convert a datetime object representing a day into a human - ready string that can be read spoken aloud etc.
crm416/semantic
semantic/dates.py
DateService.convertTime
def convertTime(self, time): """Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input ti...
python
def convertTime(self, time): """Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input ti...
[ "def", "convertTime", "(", "self", ",", "time", ")", ":", "# if ':00', ignore reporting minutes", "m_format", "=", "\"\"", "if", "time", ".", "minute", ":", "m_format", "=", "\":%M\"", "timeString", "=", "time", ".", "strftime", "(", "\"%I\"", "+", "m_format",...
Convert a datetime object representing a time into a human-ready string that can be read, spoken aloud, etc. Args: time (datetime.date): A datetime object to be converted into text. Returns: A string representation of the input time, ignoring any day-related ...
[ "Convert", "a", "datetime", "object", "representing", "a", "time", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", "." ]
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L429-L451
train
Convert a datetime object representing a time into a human - ready string that can be read spoken aloud etc.
crm416/semantic
semantic/dates.py
DateService.convertDate
def convertDate(self, date, prefix="", weekday=False): """Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A da...
python
def convertDate(self, date, prefix="", weekday=False): """Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A da...
[ "def", "convertDate", "(", "self", ",", "date", ",", "prefix", "=", "\"\"", ",", "weekday", "=", "False", ")", ":", "dayString", "=", "self", ".", "convertDay", "(", "date", ",", "prefix", "=", "prefix", ",", "weekday", "=", "weekday", ")", "timeString...
Convert a datetime object representing into a human-ready string that can be read, spoken aloud, etc. In effect, runs both convertDay and convertTime on the input, merging the results. Args: date (datetime.date): A datetime object to be converted into text. prefix (str):...
[ "Convert", "a", "datetime", "object", "representing", "into", "a", "human", "-", "ready", "string", "that", "can", "be", "read", "spoken", "aloud", "etc", ".", "In", "effect", "runs", "both", "convertDay", "and", "convertTime", "on", "the", "input", "merging...
46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe
https://github.com/crm416/semantic/blob/46deb8fefb3ea58aad2fedc8d0d62f3ee254b8fe/semantic/dates.py#L453-L473
train
Converts a datetime object representing into a human - ready ISO - 8601 date string that can be read spoken aloud etc. In effect runs both convertDay and convertTime on the input and returns a human - ready ISO - 8601 date string.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._move
def _move(self): """ Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file. """ newpath = self.action['newpath'] try: self.fs.move(self.fp,newpath) except OSError: raise tornad...
python
def _move(self): """ Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file. """ newpath = self.action['newpath'] try: self.fs.move(self.fp,newpath) except OSError: raise tornad...
[ "def", "_move", "(", "self", ")", ":", "newpath", "=", "self", ".", "action", "[", "'newpath'", "]", "try", ":", "self", ".", "fs", ".", "move", "(", "self", ".", "fp", ",", "newpath", ")", "except", "OSError", ":", "raise", "tornado", ".", "web", ...
Called during a PUT request where the action specifies a move operation. Returns resource URI of the destination file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "move", "operation", ".", "Returns", "resource", "URI", "of", "the", "destination", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L32-L42
train
Called during a PUT request where the action specifies a move operation. Returns the new path of the new file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._copy
def _copy(self): """ Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file. """ copypath = self.action['copypath'] try: self.fs.copy(self.fp,copypath) except OSError: raise tornado.web...
python
def _copy(self): """ Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file. """ copypath = self.action['copypath'] try: self.fs.copy(self.fp,copypath) except OSError: raise tornado.web...
[ "def", "_copy", "(", "self", ")", ":", "copypath", "=", "self", ".", "action", "[", "'copypath'", "]", "try", ":", "self", ".", "fs", ".", "copy", "(", "self", ".", "fp", ",", "copypath", ")", "except", "OSError", ":", "raise", "tornado", ".", "web...
Called during a PUT request where the action specifies a copy operation. Returns resource URI of the new file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "copy", "operation", ".", "Returns", "resource", "URI", "of", "the", "new", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L44-L54
train
Called during a PUT request where the action specifies a copy operation. Returns the copy path of the new file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler._rename
def _rename(self): """ Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file. """ newname = self.action['newname'] try: newpath = self.fs.rename(self.fp,newname) except OSError: ...
python
def _rename(self): """ Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file. """ newname = self.action['newname'] try: newpath = self.fs.rename(self.fp,newname) except OSError: ...
[ "def", "_rename", "(", "self", ")", ":", "newname", "=", "self", ".", "action", "[", "'newname'", "]", "try", ":", "newpath", "=", "self", ".", "fs", ".", "rename", "(", "self", ".", "fp", ",", "newname", ")", "except", "OSError", ":", "raise", "to...
Called during a PUT request where the action specifies a rename operation. Returns resource URI of the renamed file.
[ "Called", "during", "a", "PUT", "request", "where", "the", "action", "specifies", "a", "rename", "operation", ".", "Returns", "resource", "URI", "of", "the", "renamed", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L56-L66
train
Called during a PUT request where the action specifies a rename operation. Returns the new file URI.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler.get
def get(self): """ Return details for the filesystem, including configured volumes. """ res = self.fs.get_filesystem_details() res = res.to_dict() self.write(res)
python
def get(self): """ Return details for the filesystem, including configured volumes. """ res = self.fs.get_filesystem_details() res = res.to_dict() self.write(res)
[ "def", "get", "(", "self", ")", ":", "res", "=", "self", ".", "fs", ".", "get_filesystem_details", "(", ")", "res", "=", "res", ".", "to_dict", "(", ")", "self", ".", "write", "(", "res", ")" ]
Return details for the filesystem, including configured volumes.
[ "Return", "details", "for", "the", "filesystem", "including", "configured", "volumes", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L69-L75
train
Get details for the filesystem including configured volumes.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilesystemHandler.put
def put(self): """ Provides move, copy, and rename functionality. An action must be specified when calling this method. """ self.fp = self.get_body_argument('filepath') self.action = self.get_body_argument('action') try: ptype = self.fs.get_type_from_...
python
def put(self): """ Provides move, copy, and rename functionality. An action must be specified when calling this method. """ self.fp = self.get_body_argument('filepath') self.action = self.get_body_argument('action') try: ptype = self.fs.get_type_from_...
[ "def", "put", "(", "self", ")", ":", "self", ".", "fp", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "self", ".", "action", "=", "self", ".", "get_body_argument", "(", "'action'", ")", "try", ":", "ptype", "=", "self", ".", "fs", "....
Provides move, copy, and rename functionality. An action must be specified when calling this method.
[ "Provides", "move", "copy", "and", "rename", "functionality", ".", "An", "action", "must", "be", "specified", "when", "calling", "this", "method", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L78-L105
train
Provides move copy and rename functionality.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilewatcherCreateHandler.post
def post(self, *args): """ Start a new filewatcher at the specified path. """ filepath = self.get_body_argument('filepath') if not self.fs.exists(filepath): raise tornado.web.HTTPError(404) Filewatcher.add_directory_to_watch(filepath) self.write({'msg...
python
def post(self, *args): """ Start a new filewatcher at the specified path. """ filepath = self.get_body_argument('filepath') if not self.fs.exists(filepath): raise tornado.web.HTTPError(404) Filewatcher.add_directory_to_watch(filepath) self.write({'msg...
[ "def", "post", "(", "self", ",", "*", "args", ")", ":", "filepath", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "if", "not", "self", ".", "fs", ".", "exists", "(", "filepath", ")", ":", "raise", "tornado", ".", "web", ".", "HTTPErr...
Start a new filewatcher at the specified path.
[ "Start", "a", "new", "filewatcher", "at", "the", "specified", "path", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L113-L122
train
Called when the client is listening and the HTTP request is made.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FilewatcherDeleteHandler.delete
def delete(self, filepath): """ Stop and delete the specified filewatcher. """ Filewatcher.remove_directory_to_watch(filepath) self.write({'msg':'Watcher deleted for {}'.format(filepath)})
python
def delete(self, filepath): """ Stop and delete the specified filewatcher. """ Filewatcher.remove_directory_to_watch(filepath) self.write({'msg':'Watcher deleted for {}'.format(filepath)})
[ "def", "delete", "(", "self", ",", "filepath", ")", ":", "Filewatcher", ".", "remove_directory_to_watch", "(", "filepath", ")", "self", ".", "write", "(", "{", "'msg'", ":", "'Watcher deleted for {}'", ".", "format", "(", "filepath", ")", "}", ")" ]
Stop and delete the specified filewatcher.
[ "Stop", "and", "delete", "the", "specified", "filewatcher", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L129-L134
train
Stop and delete the specified filewatcher.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.get
def get(self, filepath): """ Get file details for the specified file. """ try: res = self.fs.get_file_details(filepath) res = res.to_dict() self.write(res) except OSError: raise tornado.web.HTTPError(404)
python
def get(self, filepath): """ Get file details for the specified file. """ try: res = self.fs.get_file_details(filepath) res = res.to_dict() self.write(res) except OSError: raise tornado.web.HTTPError(404)
[ "def", "get", "(", "self", ",", "filepath", ")", ":", "try", ":", "res", "=", "self", ".", "fs", ".", "get_file_details", "(", "filepath", ")", "res", "=", "res", ".", "to_dict", "(", ")", "self", ".", "write", "(", "res", ")", "except", "OSError",...
Get file details for the specified file.
[ "Get", "file", "details", "for", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L144-L153
train
Get details for the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.put
def put(self, filepath): """ Change the group or permissions of the specified file. Action must be specified when calling this method. """ action = self.get_body_argument('action') if action['action'] == 'update_group': newgrp = action['group'] tr...
python
def put(self, filepath): """ Change the group or permissions of the specified file. Action must be specified when calling this method. """ action = self.get_body_argument('action') if action['action'] == 'update_group': newgrp = action['group'] tr...
[ "def", "put", "(", "self", ",", "filepath", ")", ":", "action", "=", "self", ".", "get_body_argument", "(", "'action'", ")", "if", "action", "[", "'action'", "]", "==", "'update_group'", ":", "newgrp", "=", "action", "[", "'group'", "]", "try", ":", "s...
Change the group or permissions of the specified file. Action must be specified when calling this method.
[ "Change", "the", "group", "or", "permissions", "of", "the", "specified", "file", ".", "Action", "must", "be", "specified", "when", "calling", "this", "method", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L156-L178
train
Change the group or permissions of the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileHandler.delete
def delete(self, filepath): """ Delete the specified file. """ try: self.fs.delete(filepath) self.write({'msg':'File deleted at {}'.format(filepath)}) except OSError: raise tornado.web.HTTPError(404)
python
def delete(self, filepath): """ Delete the specified file. """ try: self.fs.delete(filepath) self.write({'msg':'File deleted at {}'.format(filepath)}) except OSError: raise tornado.web.HTTPError(404)
[ "def", "delete", "(", "self", ",", "filepath", ")", ":", "try", ":", "self", ".", "fs", ".", "delete", "(", "filepath", ")", "self", ".", "write", "(", "{", "'msg'", ":", "'File deleted at {}'", ".", "format", "(", "filepath", ")", "}", ")", "except"...
Delete the specified file.
[ "Delete", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L181-L189
train
Delete the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
DirectoryHandler.get
def get(self, filepath): """ Get directory details for the specified file. If contents is set to True (default) then the directory contents will be sent along with the directory details. If dir_size is set to True (default=False) then du -hs will be run against subdirectories ...
python
def get(self, filepath): """ Get directory details for the specified file. If contents is set to True (default) then the directory contents will be sent along with the directory details. If dir_size is set to True (default=False) then du -hs will be run against subdirectories ...
[ "def", "get", "(", "self", ",", "filepath", ")", ":", "contents", "=", "self", ".", "get_argument", "(", "'contents'", ",", "False", ")", "if", "contents", "==", "u'true'", ":", "contents", "=", "True", "else", ":", "contents", "=", "False", "dir_sizes",...
Get directory details for the specified file. If contents is set to True (default) then the directory contents will be sent along with the directory details. If dir_size is set to True (default=False) then du -hs will be run against subdirectories for accurate content sizes.
[ "Get", "directory", "details", "for", "the", "specified", "file", ".", "If", "contents", "is", "set", "to", "True", "(", "default", ")", "then", "the", "directory", "contents", "will", "be", "sent", "along", "with", "the", "directory", "details", ".", "If"...
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L221-L245
train
Get directory details for the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
DirectoryCreateHandler.post
def post(self): """ Create a new directory at the specified path. """ filepath = self.get_body_argument('filepath') try: self.fs.create_directory(filepath) encoded_filepath = tornado.escape.url_escape(filepath,plus=True) resource_uri = self.re...
python
def post(self): """ Create a new directory at the specified path. """ filepath = self.get_body_argument('filepath') try: self.fs.create_directory(filepath) encoded_filepath = tornado.escape.url_escape(filepath,plus=True) resource_uri = self.re...
[ "def", "post", "(", "self", ")", ":", "filepath", "=", "self", ".", "get_body_argument", "(", "'filepath'", ")", "try", ":", "self", ".", "fs", ".", "create_directory", "(", "filepath", ")", "encoded_filepath", "=", "tornado", ".", "escape", ".", "url_esca...
Create a new directory at the specified path.
[ "Create", "a", "new", "directory", "at", "the", "specified", "path", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L255-L267
train
Create a new directory at the specified path.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileContentsHandler.get
def get(self, filepath): """ Get the contents of the specified file. """ exists = self.fs.exists(filepath) if exists: mime = magic.Magic(mime=True) mime_type = mime.from_file(filepath) if mime_type in self.unsupported_types: sel...
python
def get(self, filepath): """ Get the contents of the specified file. """ exists = self.fs.exists(filepath) if exists: mime = magic.Magic(mime=True) mime_type = mime.from_file(filepath) if mime_type in self.unsupported_types: sel...
[ "def", "get", "(", "self", ",", "filepath", ")", ":", "exists", "=", "self", ".", "fs", ".", "exists", "(", "filepath", ")", "if", "exists", ":", "mime", "=", "magic", ".", "Magic", "(", "mime", "=", "True", ")", "mime_type", "=", "mime", ".", "f...
Get the contents of the specified file.
[ "Get", "the", "contents", "of", "the", "specified", "file", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L277-L292
train
Get the contents of the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileContentsHandler.post
def post(self, filepath): """ Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given. """ try: content = self.get_body_argument('content') self.fs.write_file(filepath, content...
python
def post(self, filepath): """ Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given. """ try: content = self.get_body_argument('content') self.fs.write_file(filepath, content...
[ "def", "post", "(", "self", ",", "filepath", ")", ":", "try", ":", "content", "=", "self", ".", "get_body_argument", "(", "'content'", ")", "self", ".", "fs", ".", "write_file", "(", "filepath", ",", "content", ")", "self", ".", "write", "(", "{", "'...
Write the given contents to the specified file. This is not an append, all file contents will be replaced by the contents given.
[ "Write", "the", "given", "contents", "to", "the", "specified", "file", ".", "This", "is", "not", "an", "append", "all", "file", "contents", "will", "be", "replaced", "by", "the", "contents", "given", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L295-L306
train
Write the contents of the given file to the specified file.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileDownloadHandler.get_content
def get_content(self, start=None, end=None): """ Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps...
python
def get_content(self, start=None, end=None): """ Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps...
[ "def", "get_content", "(", "self", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "with", "open", "(", "self", ".", "filepath", ",", "\"rb\"", ")", "as", "file", ":", "if", "start", "is", "not", "None", ":", "file", ".", "seek", "(...
Retrieve the content of the requested resource which is located at the given absolute path. This method should either return a byte string or an iterator of byte strings. The latter is preferred for large files as it helps reduce memory fragmentation.
[ "Retrieve", "the", "content", "of", "the", "requested", "resource", "which", "is", "located", "at", "the", "given", "absolute", "path", ".", "This", "method", "should", "either", "return", "a", "byte", "string", "or", "an", "iterator", "of", "byte", "strings...
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L387-L414
train
Retrieves the content of the requested resource which is located at the given absolute path.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileDownloadHandler.set_headers
def set_headers(self): """ Sets the content headers on the response. """ self.set_header("Accept-Ranges", "bytes") content_type = self.get_content_type() if content_type: self.set_header("Content-Type", content_type)
python
def set_headers(self): """ Sets the content headers on the response. """ self.set_header("Accept-Ranges", "bytes") content_type = self.get_content_type() if content_type: self.set_header("Content-Type", content_type)
[ "def", "set_headers", "(", "self", ")", ":", "self", ".", "set_header", "(", "\"Accept-Ranges\"", ",", "\"bytes\"", ")", "content_type", "=", "self", ".", "get_content_type", "(", ")", "if", "content_type", ":", "self", ".", "set_header", "(", "\"Content-Type\...
Sets the content headers on the response.
[ "Sets", "the", "content", "headers", "on", "the", "response", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L416-L424
train
Sets the content headers on the response.
SandstoneHPC/sandstone-ide
sandstone/lib/filesystem/handlers.py
FileDownloadHandler.get_content_type
def get_content_type(self): """ Returns the ``Content-Type`` header to be used for this request. """ mime_type, encoding = mimetypes.guess_type(self.filepath) if encoding == "gzip": return "application/gzip" elif encoding is not None: return "appli...
python
def get_content_type(self): """ Returns the ``Content-Type`` header to be used for this request. """ mime_type, encoding = mimetypes.guess_type(self.filepath) if encoding == "gzip": return "application/gzip" elif encoding is not None: return "appli...
[ "def", "get_content_type", "(", "self", ")", ":", "mime_type", ",", "encoding", "=", "mimetypes", ".", "guess_type", "(", "self", ".", "filepath", ")", "if", "encoding", "==", "\"gzip\"", ":", "return", "\"application/gzip\"", "elif", "encoding", "is", "not", ...
Returns the ``Content-Type`` header to be used for this request.
[ "Returns", "the", "Content", "-", "Type", "header", "to", "be", "used", "for", "this", "request", "." ]
7a47947fb07281c3e3018042863dc67e7e56dc04
https://github.com/SandstoneHPC/sandstone-ide/blob/7a47947fb07281c3e3018042863dc67e7e56dc04/sandstone/lib/filesystem/handlers.py#L438-L451
train
Returns the content type of the file.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListPlugin.__deactivate_shared_objects
def __deactivate_shared_objects(self, plugin, *args, **kwargs): """ Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin. """ shared_objects = self.get() for shared_object in shared_objects.keys(): self.unregister(shared_object)
python
def __deactivate_shared_objects(self, plugin, *args, **kwargs): """ Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin. """ shared_objects = self.get() for shared_object in shared_objects.keys(): self.unregister(shared_object)
[ "def", "__deactivate_shared_objects", "(", "self", ",", "plugin", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "shared_objects", "=", "self", ".", "get", "(", ")", "for", "shared_object", "in", "shared_objects", ".", "keys", "(", ")", ":", "self"...
Callback, which gets executed, if the signal "plugin_deactivate_post" was send by the plugin.
[ "Callback", "which", "gets", "executed", "if", "the", "signal", "plugin_deactivate_post", "was", "send", "by", "the", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L59-L65
train
Callback which gets executed when the signal plugin_deactivate_post is received by the plugin.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListPlugin.register
def register(self, name, description, obj): """ Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared ...
python
def register(self, name, description, obj): """ Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared ...
[ "def", "register", "(", "self", ",", "name", ",", "description", ",", "obj", ")", ":", "return", "self", ".", "app", ".", "shared_objects", ".", "register", "(", "name", ",", "description", ",", "obj", ",", "self", ".", "plugin", ")" ]
Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared :type obj: any type
[ "Registers", "a", "new", "shared", "object", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L67-L78
train
Registers a new shared object.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListPlugin.get
def get(self, name=None): """ Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name o...
python
def get(self, name=None): """ Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name o...
[ "def", "get", "(", "self", ",", "name", "=", "None", ")", ":", "return", "self", ".", "app", ".", "shared_objects", ".", "get", "(", "name", ",", "self", ".", "plugin", ")" ]
Returns requested shared objects, which were registered by the current plugin. If access to objects of other plugins are needed, use :func:`access` or perform get on application level:: my_app.shared_objects.get(name="...") :param name: Name of a request shared object :type name: ...
[ "Returns", "requested", "shared", "objects", "which", "were", "registered", "by", "the", "current", "plugin", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L89-L100
train
Get a specific shared object from the application level.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListApplication.get
def get(self, name=None, plugin=None): """ Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None ...
python
def get(self, name=None, plugin=None): """ Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None ...
[ "def", "get", "(", "self", ",", "name", "=", "None", ",", "plugin", "=", "None", ")", ":", "if", "plugin", "is", "not", "None", ":", "if", "name", "is", "None", ":", "shared_objects_list", "=", "{", "}", "for", "key", "in", "self", ".", "_shared_ob...
Returns requested shared objects. :param name: Name of a request shared object :type name: str or None :param plugin: Plugin, which has registered the requested shared object :type plugin: GwBasePattern instance or None
[ "Returns", "requested", "shared", "objects", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L127-L158
train
Returns requested shared objects.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListApplication.register
def register(self, name, description, obj, plugin): """ Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared...
python
def register(self, name, description, obj, plugin): """ Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared...
[ "def", "register", "(", "self", ",", "name", ",", "description", ",", "obj", ",", "plugin", ")", ":", "if", "name", "in", "self", ".", "_shared_objects", ".", "keys", "(", ")", ":", "raise", "SharedObjectExistException", "(", "\"Shared Object %s already regist...
Registers a new shared object. :param name: Unique name for shared object :type name: str :param description: Description of shared object :type description: str :param obj: The object, which shall be shared :type obj: any type :param plugin: Plugin, which regist...
[ "Registers", "a", "new", "shared", "object", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L172-L191
train
Registers a new shared object.
useblocks/groundwork
groundwork/patterns/gw_shared_objects_pattern.py
SharedObjectsListApplication.unregister
def unregister(self, shared_object): """ Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object """ if shared_object not in self._...
python
def unregister(self, shared_object): """ Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object """ if shared_object not in self._...
[ "def", "unregister", "(", "self", ",", "shared_object", ")", ":", "if", "shared_object", "not", "in", "self", ".", "_shared_objects", ".", "keys", "(", ")", ":", "self", ".", "log", ".", "warning", "(", "\"Can not unregister shared object %s\"", "%", "shared_o...
Unregisters an existing shared object, so that this shared object is no longer available. This function is mainly used during plugin deactivation. :param shared_object: Name of the shared_object
[ "Unregisters", "an", "existing", "shared", "object", "so", "that", "this", "shared", "object", "is", "no", "longer", "available", "." ]
d34fce43f54246ca4db0f7b89e450dcdc847c68c
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/patterns/gw_shared_objects_pattern.py#L193-L205
train
Unregisters an existing shared object.