partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
pretty_dict_str
shows JSON indented representation of d
peyotl/utility/input_output.py
def pretty_dict_str(d, indent=2): """shows JSON indented representation of d""" b = StringIO() write_pretty_dict_str(b, d, indent=indent) return b.getvalue()
def pretty_dict_str(d, indent=2): """shows JSON indented representation of d""" b = StringIO() write_pretty_dict_str(b, d, indent=indent) return b.getvalue()
[ "shows", "JSON", "indented", "representation", "of", "d" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/utility/input_output.py#L80-L84
[ "def", "pretty_dict_str", "(", "d", ",", "indent", "=", "2", ")", ":", "b", "=", "StringIO", "(", ")", "write_pretty_dict_str", "(", "b", ",", "d", ",", "indent", "=", "indent", ")", "return", "b", ".", "getvalue", "(", ")" ]
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
write_pretty_dict_str
writes JSON indented representation of `obj` to `out`
peyotl/utility/input_output.py
def write_pretty_dict_str(out, obj, indent=2): """writes JSON indented representation of `obj` to `out`""" json.dump(obj, out, indent=indent, sort_keys=True, separators=(',', ': '), ensure_ascii=False, encoding="utf-8")
def write_pretty_dict_str(out, obj, indent=2): """writes JSON indented representation of `obj` to `out`""" json.dump(obj, out, indent=indent, sort_keys=True, separators=(',', ': '), ensure_ascii=False, encoding="utf-8")
[ "writes", "JSON", "indented", "representation", "of", "obj", "to", "out" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/utility/input_output.py#L87-L95
[ "def", "write_pretty_dict_str", "(", "out", ",", "obj", ",", "indent", "=", "2", ")", ":", "json", ".", "dump", "(", "obj", ",", "out", ",", "indent", "=", "indent", ",", "sort_keys", "=", "True", ",", "separators", "=", "(", "','", ",", "': '", ")...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
parse_study_tree_list
study trees should be in {'study_id', 'tree_id'} objects, but as legacy support we also need to support files that have the format: pg_315_4246243 # comment
peyotl/utility/input_output.py
def parse_study_tree_list(fp): """study trees should be in {'study_id', 'tree_id'} objects, but as legacy support we also need to support files that have the format: pg_315_4246243 # comment """ # noinspection PyBroadException try: sl = read_as_json(fp) except: sl = [] ...
def parse_study_tree_list(fp): """study trees should be in {'study_id', 'tree_id'} objects, but as legacy support we also need to support files that have the format: pg_315_4246243 # comment """ # noinspection PyBroadException try: sl = read_as_json(fp) except: sl = [] ...
[ "study", "trees", "should", "be", "in", "{", "study_id", "tree_id", "}", "objects", "but", "as", "legacy", "support", "we", "also", "need", "to", "support", "files", "that", "have", "the", "format", ":", "pg_315_4246243", "#", "comment" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/utility/input_output.py#L103-L134
[ "def", "parse_study_tree_list", "(", "fp", ")", ":", "# noinspection PyBroadException", "try", ":", "sl", "=", "read_as_json", "(", "fp", ")", "except", ":", "sl", "=", "[", "]", "with", "codecs", ".", "open", "(", "fp", ",", "'rU'", ",", "encoding", "="...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_format_args
Get JSON dump indentation and separates.
invenio_communities/serializers/response.py
def _format_args(): """Get JSON dump indentation and separates.""" # Ensure we can run outside a application/request context. try: pretty_format = \ current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and \ not request.is_xhr except RuntimeError: pretty_format = Fal...
def _format_args(): """Get JSON dump indentation and separates.""" # Ensure we can run outside a application/request context. try: pretty_format = \ current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] and \ not request.is_xhr except RuntimeError: pretty_format = Fal...
[ "Get", "JSON", "dump", "indentation", "and", "separates", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/serializers/response.py#L36-L55
[ "def", "_format_args", "(", ")", ":", "# Ensure we can run outside a application/request context.", "try", ":", "pretty_format", "=", "current_app", ".", "config", "[", "'JSONIFY_PRETTYPRINT_REGULAR'", "]", "and", "not", "request", ".", "is_xhr", "except", "RuntimeError",...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
community_responsify
Create a community response serializer. :param serializer: Serializer instance. :param mimetype: MIME type of response.
invenio_communities/serializers/response.py
def community_responsify(schema_class, mimetype): """Create a community response serializer. :param serializer: Serializer instance. :param mimetype: MIME type of response. """ def view(data, code=200, headers=None, links_item_factory=None, page=None, urlkwargs=None, links_pagination_f...
def community_responsify(schema_class, mimetype): """Create a community response serializer. :param serializer: Serializer instance. :param mimetype: MIME type of response. """ def view(data, code=200, headers=None, links_item_factory=None, page=None, urlkwargs=None, links_pagination_f...
[ "Create", "a", "community", "response", "serializer", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/serializers/response.py#L58-L94
[ "def", "community_responsify", "(", "schema_class", ",", "mimetype", ")", ":", "def", "view", "(", "data", ",", "code", "=", "200", ",", "headers", "=", "None", ",", "links_item_factory", "=", "None", ",", "page", "=", "None", ",", "urlkwargs", "=", "Non...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
get_unique_filepath
NOT thread-safe! return stems or stem# where # is the smallest positive integer for which the path does not exist. useful for temp dirs where the client code wants an obvious ordering.
peyotl/utility/__init__.py
def get_unique_filepath(stem): """NOT thread-safe! return stems or stem# where # is the smallest positive integer for which the path does not exist. useful for temp dirs where the client code wants an obvious ordering. """ fp = stem if os.path.exists(stem): n = 1 fp = ste...
def get_unique_filepath(stem): """NOT thread-safe! return stems or stem# where # is the smallest positive integer for which the path does not exist. useful for temp dirs where the client code wants an obvious ordering. """ fp = stem if os.path.exists(stem): n = 1 fp = ste...
[ "NOT", "thread", "-", "safe!", "return", "stems", "or", "stem#", "where", "#", "is", "the", "smallest", "positive", "integer", "for", "which", "the", "path", "does", "not", "exist", ".", "useful", "for", "temp", "dirs", "where", "the", "client", "code", ...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/utility/__init__.py#L49-L63
[ "def", "get_unique_filepath", "(", "stem", ")", ":", "fp", "=", "stem", "if", "os", ".", "path", ".", "exists", "(", "stem", ")", ":", "n", "=", "1", "fp", "=", "stem", "+", "str", "(", "n", ")", "while", "os", ".", "path", ".", "exists", "(", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
propinquity_fn_to_study_tree
This should only be called by propinquity - other code should be treating theses filenames (and the keys that are based on them) as opaque strings. Takes a filename (or key if strip_extension is False), returns (study_id, tree_id) propinquity provides a map to look up the study ID and tree ID (and git SHA...
peyotl/utility/__init__.py
def propinquity_fn_to_study_tree(inp_fn, strip_extension=True): """This should only be called by propinquity - other code should be treating theses filenames (and the keys that are based on them) as opaque strings. Takes a filename (or key if strip_extension is False), returns (study_id, tree_id) prop...
def propinquity_fn_to_study_tree(inp_fn, strip_extension=True): """This should only be called by propinquity - other code should be treating theses filenames (and the keys that are based on them) as opaque strings. Takes a filename (or key if strip_extension is False), returns (study_id, tree_id) prop...
[ "This", "should", "only", "be", "called", "by", "propinquity", "-", "other", "code", "should", "be", "treating", "theses", "filenames", "(", "and", "the", "keys", "that", "are", "based", "on", "them", ")", "as", "opaque", "strings", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/utility/__init__.py#L66-L84
[ "def", "propinquity_fn_to_study_tree", "(", "inp_fn", ",", "strip_extension", "=", "True", ")", ":", "if", "strip_extension", ":", "study_tree", "=", "'.'", ".", "join", "(", "inp_fn", ".", "split", "(", "'.'", ")", "[", ":", "-", "1", "]", ")", "# strip...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
InternalError.from_error
Wraps another Exception in an InternalError. :param exc_info: The exception info for the wrapped exception :type exc_info: (type, object, traceback) :type json_encoder: json.JSONEncoder :type debug_url: str | None :rtype: InternalError .. versionadded:: 0.1.0 .....
typedjsonrpc/errors.py
def from_error(exc_info, json_encoder, debug_url=None): """Wraps another Exception in an InternalError. :param exc_info: The exception info for the wrapped exception :type exc_info: (type, object, traceback) :type json_encoder: json.JSONEncoder :type debug_url: str | None ...
def from_error(exc_info, json_encoder, debug_url=None): """Wraps another Exception in an InternalError. :param exc_info: The exception info for the wrapped exception :type exc_info: (type, object, traceback) :type json_encoder: json.JSONEncoder :type debug_url: str | None ...
[ "Wraps", "another", "Exception", "in", "an", "InternalError", "." ]
palantir/typedjsonrpc
python
https://github.com/palantir/typedjsonrpc/blob/274218fcd236ff9643506caa629029c9ba25a0fb/typedjsonrpc/errors.py#L99-L122
[ "def", "from_error", "(", "exc_info", ",", "json_encoder", ",", "debug_url", "=", "None", ")", ":", "exc", "=", "exc_info", "[", "1", "]", "data", "=", "exc", ".", "__dict__", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "data", ".", "i...
274218fcd236ff9643506caa629029c9ba25a0fb
train
SchemaCache.contains
Return whether the cache contains a schema for the input key, sequence number, or schema identifier. :param index: schema key, sequence number, or sequence identifier :return: whether the cache contains a schema for the input index
von_agent/cache.py
def contains(self, index: Union[SchemaKey, int, str]) -> bool: """ Return whether the cache contains a schema for the input key, sequence number, or schema identifier. :param index: schema key, sequence number, or sequence identifier :return: whether the cache contains a schema for the ...
def contains(self, index: Union[SchemaKey, int, str]) -> bool: """ Return whether the cache contains a schema for the input key, sequence number, or schema identifier. :param index: schema key, sequence number, or sequence identifier :return: whether the cache contains a schema for the ...
[ "Return", "whether", "the", "cache", "contains", "a", "schema", "for", "the", "input", "key", "sequence", "number", "or", "schema", "identifier", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/cache.py#L115-L136
[ "def", "contains", "(", "self", ",", "index", ":", "Union", "[", "SchemaKey", ",", "int", ",", "str", "]", ")", "->", "bool", ":", "LOGGER", ".", "debug", "(", "'SchemaCache.contains >>> index: %s'", ",", "index", ")", "rv", "=", "None", "if", "isinstanc...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
SchemaCache.feed
Take schemata from incoming list representation as schemata() returns, unless cache already has schema for an incoming schema sequence number. :param schemata: list of schema objects
von_agent/cache.py
def feed(self, schemata: list) -> None: """ Take schemata from incoming list representation as schemata() returns, unless cache already has schema for an incoming schema sequence number. :param schemata: list of schema objects """ LOGGER.debug('SchemaCache.feed >>> sche...
def feed(self, schemata: list) -> None: """ Take schemata from incoming list representation as schemata() returns, unless cache already has schema for an incoming schema sequence number. :param schemata: list of schema objects """ LOGGER.debug('SchemaCache.feed >>> sche...
[ "Take", "schemata", "from", "incoming", "list", "representation", "as", "schemata", "()", "returns", "unless", "cache", "already", "has", "schema", "for", "an", "incoming", "schema", "sequence", "number", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/cache.py#L178-L196
[ "def", "feed", "(", "self", ",", "schemata", ":", "list", ")", "->", "None", ":", "LOGGER", ".", "debug", "(", "'SchemaCache.feed >>> schemata: %s'", ",", "schemata", ")", "for", "schema", "in", "schemata", ":", "seq_no", "=", "schema", "[", "'seqNo'", "]"...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
RevoCacheEntry.cull
Cull cache entry frame list to size, favouring most recent query time. :param delta: True to operate on rev reg deltas, False for rev reg states
von_agent/cache.py
def cull(self, delta: bool) -> None: """ Cull cache entry frame list to size, favouring most recent query time. :param delta: True to operate on rev reg deltas, False for rev reg states """ LOGGER.debug('RevoCacheEntry.cull >>> delta: %s', delta) rr_frames = self.rr_de...
def cull(self, delta: bool) -> None: """ Cull cache entry frame list to size, favouring most recent query time. :param delta: True to operate on rev reg deltas, False for rev reg states """ LOGGER.debug('RevoCacheEntry.cull >>> delta: %s', delta) rr_frames = self.rr_de...
[ "Cull", "cache", "entry", "frame", "list", "to", "size", "favouring", "most", "recent", "query", "time", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/cache.py#L413-L433
[ "def", "cull", "(", "self", ",", "delta", ":", "bool", ")", "->", "None", ":", "LOGGER", ".", "debug", "(", "'RevoCacheEntry.cull >>> delta: %s'", ",", "delta", ")", "rr_frames", "=", "self", ".", "rr_delta_frames", "if", "delta", "else", "self", ".", "rr_...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
RevocationCache.dflt_interval
Return default non-revocation interval from latest 'to' times on delta frames of revocation cache entries on indices stemming from input cred def id. Compute the 'from'/'to' values as the earliest/latest 'to' values of all cached delta frames on all rev reg ids stemming from the input cred def ...
von_agent/cache.py
def dflt_interval(self, cd_id: str) -> (int, int): """ Return default non-revocation interval from latest 'to' times on delta frames of revocation cache entries on indices stemming from input cred def id. Compute the 'from'/'to' values as the earliest/latest 'to' values of all c...
def dflt_interval(self, cd_id: str) -> (int, int): """ Return default non-revocation interval from latest 'to' times on delta frames of revocation cache entries on indices stemming from input cred def id. Compute the 'from'/'to' values as the earliest/latest 'to' values of all c...
[ "Return", "default", "non", "-", "revocation", "interval", "from", "latest", "to", "times", "on", "delta", "frames", "of", "revocation", "cache", "entries", "on", "indices", "stemming", "from", "input", "cred", "def", "id", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/cache.py#L662-L706
[ "def", "dflt_interval", "(", "self", ",", "cd_id", ":", "str", ")", "->", "(", "int", ",", "int", ")", ":", "LOGGER", ".", "debug", "(", "'RevocationCache.dflt_interval >>>'", ")", "fro", "=", "None", "to", "=", "None", "for", "rr_id", "in", "self", ":...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Caches.parse
Parse and update from archived cache files. Only accept new content; do not overwrite any existing cache content. :param base_dir: archive base directory :param timestamp: epoch time of cache serving as subdirectory, default most recent :return: epoch time of cache serving as subdirecto...
von_agent/cache.py
def parse(base_dir: str, timestamp: int = None) -> int: """ Parse and update from archived cache files. Only accept new content; do not overwrite any existing cache content. :param base_dir: archive base directory :param timestamp: epoch time of cache serving as subdirectory, de...
def parse(base_dir: str, timestamp: int = None) -> int: """ Parse and update from archived cache files. Only accept new content; do not overwrite any existing cache content. :param base_dir: archive base directory :param timestamp: epoch time of cache serving as subdirectory, de...
[ "Parse", "and", "update", "from", "archived", "cache", "files", ".", "Only", "accept", "new", "content", ";", "do", "not", "overwrite", "any", "existing", "cache", "content", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/cache.py#L774-L850
[ "def", "parse", "(", "base_dir", ":", "str", ",", "timestamp", ":", "int", "=", "None", ")", "->", "int", ":", "LOGGER", ".", "debug", "(", "'parse >>> base_dir: %s, timestamp: %s'", ",", "base_dir", ",", "timestamp", ")", "if", "not", "isdir", "(", "base_...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.associate
Create symbolic link to tails file named tails_hash for rev reg id rr_id. :param rr_id: rev reg id :param tails_hash: hash of tails file, serving as file name
von_agent/tails.py
def associate(base_dir: str, rr_id: str, tails_hash: str) -> None: """ Create symbolic link to tails file named tails_hash for rev reg id rr_id. :param rr_id: rev reg id :param tails_hash: hash of tails file, serving as file name """ cd_id = rev_reg_id2cred_def_id(rr_id...
def associate(base_dir: str, rr_id: str, tails_hash: str) -> None: """ Create symbolic link to tails file named tails_hash for rev reg id rr_id. :param rr_id: rev reg id :param tails_hash: hash of tails file, serving as file name """ cd_id = rev_reg_id2cred_def_id(rr_id...
[ "Create", "symbolic", "link", "to", "tails", "file", "named", "tails_hash", "for", "rev", "reg", "id", "rr_id", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L82-L96
[ "def", "associate", "(", "base_dir", ":", "str", ",", "rr_id", ":", "str", ",", "tails_hash", ":", "str", ")", "->", "None", ":", "cd_id", "=", "rev_reg_id2cred_def_id", "(", "rr_id", ")", "directory", "=", "join", "(", "base_dir", ",", "cd_id", ")", "...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.dir
Return correct subdirectory of input base dir for artifacts corresponding to input rev reg id. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id
von_agent/tails.py
def dir(base_dir: str, rr_id: str) -> str: """ Return correct subdirectory of input base dir for artifacts corresponding to input rev reg id. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id """ return join(base_d...
def dir(base_dir: str, rr_id: str) -> str: """ Return correct subdirectory of input base dir for artifacts corresponding to input rev reg id. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id """ return join(base_d...
[ "Return", "correct", "subdirectory", "of", "input", "base", "dir", "for", "artifacts", "corresponding", "to", "input", "rev", "reg", "id", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L99-L107
[ "def", "dir", "(", "base_dir", ":", "str", ",", "rr_id", ":", "str", ")", "->", "str", ":", "return", "join", "(", "base_dir", ",", "rev_reg_id2cred_def_id", "(", "rr_id", ")", ")" ]
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.linked
Get, from the specified directory, the path to the tails file associated with the input revocation registry identifier, or None for no such file. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id :return: (stringified) path to tail...
von_agent/tails.py
def linked(base_dir: str, rr_id: str) -> str: """ Get, from the specified directory, the path to the tails file associated with the input revocation registry identifier, or None for no such file. :param base_dir: base directory for tails files, thereafter split by cred def id :p...
def linked(base_dir: str, rr_id: str) -> str: """ Get, from the specified directory, the path to the tails file associated with the input revocation registry identifier, or None for no such file. :param base_dir: base directory for tails files, thereafter split by cred def id :p...
[ "Get", "from", "the", "specified", "directory", "the", "path", "to", "the", "tails", "file", "associated", "with", "the", "input", "revocation", "registry", "identifier", "or", "None", "for", "no", "such", "file", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L110-L122
[ "def", "linked", "(", "base_dir", ":", "str", ",", "rr_id", ":", "str", ")", "->", "str", ":", "cd_id", "=", "rev_reg_id2cred_def_id", "(", "rr_id", ")", "link", "=", "join", "(", "base_dir", ",", "cd_id", ",", "rr_id", ")", "return", "join", "(", "b...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.links
Return set of all paths to symbolic links (rev reg ids) associating their respective tails files, in specified base tails directory, on input issuer DID if specified. :param base_dir: base directory for tails files, thereafter split by cred def id :param issuer_did: issuer DID of intere...
von_agent/tails.py
def links(base_dir: str, issuer_did: str = None) -> set: """ Return set of all paths to symbolic links (rev reg ids) associating their respective tails files, in specified base tails directory, on input issuer DID if specified. :param base_dir: base directory for tails files, th...
def links(base_dir: str, issuer_did: str = None) -> set: """ Return set of all paths to symbolic links (rev reg ids) associating their respective tails files, in specified base tails directory, on input issuer DID if specified. :param base_dir: base directory for tails files, th...
[ "Return", "set", "of", "all", "paths", "to", "symbolic", "links", "(", "rev", "reg", "ids", ")", "associating", "their", "respective", "tails", "files", "in", "specified", "base", "tails", "directory", "on", "input", "issuer", "DID", "if", "specified", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L125-L137
[ "def", "links", "(", "base_dir", ":", "str", ",", "issuer_did", ":", "str", "=", "None", ")", "->", "set", ":", "return", "{", "join", "(", "dp", ",", "f", ")", "for", "dp", ",", "dn", ",", "fn", "in", "walk", "(", "base_dir", ")", "for", "f", ...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.unlinked
Return all paths to tails files, in specified tails base directory (recursively), without symbolic links associating revocation registry identifiers. At an Issuer, tails files should not persist long without revocation registry identifier association via symbolic link. At a HolderProver, a newl...
von_agent/tails.py
def unlinked(base_dir: str) -> set: """ Return all paths to tails files, in specified tails base directory (recursively), without symbolic links associating revocation registry identifiers. At an Issuer, tails files should not persist long without revocation registry identifier ...
def unlinked(base_dir: str) -> set: """ Return all paths to tails files, in specified tails base directory (recursively), without symbolic links associating revocation registry identifiers. At an Issuer, tails files should not persist long without revocation registry identifier ...
[ "Return", "all", "paths", "to", "tails", "files", "in", "specified", "tails", "base", "directory", "(", "recursively", ")", "without", "symbolic", "links", "associating", "revocation", "registry", "identifiers", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L140-L156
[ "def", "unlinked", "(", "base_dir", ":", "str", ")", "->", "set", ":", "return", "{", "join", "(", "dp", ",", "f", ")", "for", "dp", ",", "dn", ",", "fn", "in", "walk", "(", "base_dir", ")", "for", "f", "in", "fn", "if", "isfile", "(", "join", ...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.next_tag
Return the next tag name available for a new rev reg id on input cred def id in base directory, and suggested size of associated rev reg. :param base_dir: base directory for tails files, thereafter split by cred def id :param cd_id: credential definition identifier of interest :return: ...
von_agent/tails.py
def next_tag(base_dir: str, cd_id: str) -> (str, int): """ Return the next tag name available for a new rev reg id on input cred def id in base directory, and suggested size of associated rev reg. :param base_dir: base directory for tails files, thereafter split by cred def id :...
def next_tag(base_dir: str, cd_id: str) -> (str, int): """ Return the next tag name available for a new rev reg id on input cred def id in base directory, and suggested size of associated rev reg. :param base_dir: base directory for tails files, thereafter split by cred def id :...
[ "Return", "the", "next", "tag", "name", "available", "for", "a", "new", "rev", "reg", "id", "on", "input", "cred", "def", "id", "in", "base", "directory", "and", "suggested", "size", "of", "associated", "rev", "reg", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L159-L173
[ "def", "next_tag", "(", "base_dir", ":", "str", ",", "cd_id", ":", "str", ")", "->", "(", "str", ",", "int", ")", ":", "tag", "=", "1", "+", "max", "(", "[", "int", "(", "rev_reg_id2tag", "(", "basename", "(", "f", ")", ")", ")", "for", "f", ...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.current_rev_reg_id
Return the current revocation registry identifier for input credential definition identifier, in input directory. Raise AbsentTails if no corresponding tails file, signifying no such revocation registry defined. :param base_dir: base directory for tails files, thereafter split by cred def id ...
von_agent/tails.py
def current_rev_reg_id(base_dir: str, cd_id: str) -> str: """ Return the current revocation registry identifier for input credential definition identifier, in input directory. Raise AbsentTails if no corresponding tails file, signifying no such revocation registry defined. :par...
def current_rev_reg_id(base_dir: str, cd_id: str) -> str: """ Return the current revocation registry identifier for input credential definition identifier, in input directory. Raise AbsentTails if no corresponding tails file, signifying no such revocation registry defined. :par...
[ "Return", "the", "current", "revocation", "registry", "identifier", "for", "input", "credential", "definition", "identifier", "in", "input", "directory", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L176-L193
[ "def", "current_rev_reg_id", "(", "base_dir", ":", "str", ",", "cd_id", ":", "str", ")", "->", "str", ":", "tags", "=", "[", "int", "(", "rev_reg_id2tag", "(", "basename", "(", "f", ")", ")", ")", "for", "f", "in", "Tails", ".", "links", "(", "base...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Tails.path
Accessor for (stringified) path to current tails file. :return: (stringified) path to current tails file.
von_agent/tails.py
def path(self) -> str: """ Accessor for (stringified) path to current tails file. :return: (stringified) path to current tails file. """ cfg = json.loads(self._tails_cfg_json) return join(cfg['base_dir'], cfg['file'])
def path(self) -> str: """ Accessor for (stringified) path to current tails file. :return: (stringified) path to current tails file. """ cfg = json.loads(self._tails_cfg_json) return join(cfg['base_dir'], cfg['file'])
[ "Accessor", "for", "(", "stringified", ")", "path", "to", "current", "tails", "file", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/tails.py#L217-L225
[ "def", "path", "(", "self", ")", "->", "str", ":", "cfg", "=", "json", ".", "loads", "(", "self", ".", "_tails_cfg_json", ")", "return", "join", "(", "cfg", "[", "'base_dir'", "]", ",", "cfg", "[", "'file'", "]", ")" ]
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
parseNoise
Function returns indices that contain non-noisy genes as an integer array :param rawArray: numpy ndarray of data set :return nnGenes : numpy ndarray of non-noise gene indices
nvr/NVR.py
def parseNoise(rawArray): ''' Function returns indices that contain non-noisy genes as an integer array :param rawArray: numpy ndarray of data set :return nnGenes : numpy ndarray of non-noise gene indices ''' nnGenes=[] for i in range(0,(rawArray.shape[1])): #Checks all genes count...
def parseNoise(rawArray): ''' Function returns indices that contain non-noisy genes as an integer array :param rawArray: numpy ndarray of data set :return nnGenes : numpy ndarray of non-noise gene indices ''' nnGenes=[] for i in range(0,(rawArray.shape[1])): #Checks all genes count...
[ "Function", "returns", "indices", "that", "contain", "non", "-", "noisy", "genes", "as", "an", "integer", "array", ":", "param", "rawArray", ":", "numpy", "ndarray", "of", "data", "set", ":", "return", "nnGenes", ":", "numpy", "ndarray", "of", "non", "-", ...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L28-L40
[ "def", "parseNoise", "(", "rawArray", ")", ":", "nnGenes", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "(", "rawArray", ".", "shape", "[", "1", "]", ")", ")", ":", "#Checks all genes", "count0", "=", "np", ".", "asarray", "(", "np", ...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
mkIndexedArr
Function returns ndarray of gene expression values from ndarray of unmodified data set and ndarray of gene indices :param unparsedArr: numpy ndarray of unmodified data set :param nnGeneIndex: numpy ndarray of indices of genes of interest :return nnGeneExp: numpy ndarray of data set including all cells and ...
nvr/NVR.py
def mkIndexedArr(unparsedArr,nnGeneIndex): ''' Function returns ndarray of gene expression values from ndarray of unmodified data set and ndarray of gene indices :param unparsedArr: numpy ndarray of unmodified data set :param nnGeneIndex: numpy ndarray of indices of genes of interest :return nnGeneE...
def mkIndexedArr(unparsedArr,nnGeneIndex): ''' Function returns ndarray of gene expression values from ndarray of unmodified data set and ndarray of gene indices :param unparsedArr: numpy ndarray of unmodified data set :param nnGeneIndex: numpy ndarray of indices of genes of interest :return nnGeneE...
[ "Function", "returns", "ndarray", "of", "gene", "expression", "values", "from", "ndarray", "of", "unmodified", "data", "set", "and", "ndarray", "of", "gene", "indices", ":", "param", "unparsedArr", ":", "numpy", "ndarray", "of", "unmodified", "data", "set", ":...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L44-L54
[ "def", "mkIndexedArr", "(", "unparsedArr", ",", "nnGeneIndex", ")", ":", "nnGeneExp", "=", "np", ".", "zeros", "(", "[", "unparsedArr", ".", "shape", "[", "0", "]", ",", "nnGeneIndex", ".", "shape", "[", "0", "]", "]", ",", "dtype", "=", "float", ")"...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
pwArcsinh
Function returns an ndarray by performing a pointwise inverse hyperbolic sine transformation on the input ndarray :param inputArray: ndarray of gene expression data in raw count or RPKM format :param contstant: some constant to normalize for total read count number :return transformed: ndarray of transfor...
nvr/NVR.py
def pwArcsinh(inputArray,constant): ''' Function returns an ndarray by performing a pointwise inverse hyperbolic sine transformation on the input ndarray :param inputArray: ndarray of gene expression data in raw count or RPKM format :param contstant: some constant to normalize for total read count nu...
def pwArcsinh(inputArray,constant): ''' Function returns an ndarray by performing a pointwise inverse hyperbolic sine transformation on the input ndarray :param inputArray: ndarray of gene expression data in raw count or RPKM format :param contstant: some constant to normalize for total read count nu...
[ "Function", "returns", "an", "ndarray", "by", "performing", "a", "pointwise", "inverse", "hyperbolic", "sine", "transformation", "on", "the", "input", "ndarray", ":", "param", "inputArray", ":", "ndarray", "of", "gene", "expression", "data", "in", "raw", "count"...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L58-L74
[ "def", "pwArcsinh", "(", "inputArray", ",", "constant", ")", ":", "#this function assumes rows are cells and columns are genes in the input array", "countsum", "=", "np", ".", "sum", "(", "inputArray", ",", "axis", "=", "1", ")", "#calculate the total number of counts per c...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
adaptive_knn_graph
Function returns an adjacency matrix based on the euclidean distance of each gene's expression across all cells :param traj_dist: ndarray of euclidean distances :param k: int of the minimum number of connections needed for a minimally connected graph, calculated by min_conn_k() :return adj_mat: ndarray repr...
nvr/NVR.py
def adaptive_knn_graph(traj_dist,k): ''' Function returns an adjacency matrix based on the euclidean distance of each gene's expression across all cells :param traj_dist: ndarray of euclidean distances :param k: int of the minimum number of connections needed for a minimally connected graph, calculated...
def adaptive_knn_graph(traj_dist,k): ''' Function returns an adjacency matrix based on the euclidean distance of each gene's expression across all cells :param traj_dist: ndarray of euclidean distances :param k: int of the minimum number of connections needed for a minimally connected graph, calculated...
[ "Function", "returns", "an", "adjacency", "matrix", "based", "on", "the", "euclidean", "distance", "of", "each", "gene", "s", "expression", "across", "all", "cells", ":", "param", "traj_dist", ":", "ndarray", "of", "euclidean", "distances", ":", "param", "k", ...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L78-L89
[ "def", "adaptive_knn_graph", "(", "traj_dist", ",", "k", ")", ":", "adj_mat", "=", "np", ".", "zeros_like", "(", "traj_dist", ",", "dtype", "=", "float", ")", "#initialize output matrix", "knn", "=", "(", "np", ".", "transpose", "(", "np", ".", "argsort", ...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
min_conn_k
Function returns the minimum number of connections, k, that are required to form a fully connected graph based gene expression data :param traj_exp: ndarray representing gene expression :return k: int of the minimum number of connections needed for a minimally connected graph
nvr/NVR.py
def min_conn_k(traj_exp): ''' Function returns the minimum number of connections, k, that are required to form a fully connected graph based gene expression data :param traj_exp: ndarray representing gene expression :return k: int of the minimum number of connections needed for a minimally connected gra...
def min_conn_k(traj_exp): ''' Function returns the minimum number of connections, k, that are required to form a fully connected graph based gene expression data :param traj_exp: ndarray representing gene expression :return k: int of the minimum number of connections needed for a minimally connected gra...
[ "Function", "returns", "the", "minimum", "number", "of", "connections", "k", "that", "are", "required", "to", "form", "a", "fully", "connected", "graph", "based", "gene", "expression", "data", ":", "param", "traj_exp", ":", "ndarray", "representing", "gene", "...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L93-L107
[ "def", "min_conn_k", "(", "traj_exp", ")", ":", "traj_dist", "=", "sps", ".", "distance", ".", "squareform", "(", "sps", ".", "distance", ".", "pdist", "(", "traj_exp", ")", ")", "#this is the gene expression euclidean distance calculation", "conn_comp", "=", "2",...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
dev_ij
Function returns the sum of squared differences in the expression of a gene, per cell :param i: int representing the index of the cell being processed :param j: int representing the index of the gene being processed :param traj_exp: ndarray representing gene expression :param adj_mat: ndarray represent...
nvr/NVR.py
def dev_ij(i,j,traj_exp,adj_mat): #takes adjacency matrix and raw expression data ''' Function returns the sum of squared differences in the expression of a gene, per cell :param i: int representing the index of the cell being processed :param j: int representing the index of the gene being processed ...
def dev_ij(i,j,traj_exp,adj_mat): #takes adjacency matrix and raw expression data ''' Function returns the sum of squared differences in the expression of a gene, per cell :param i: int representing the index of the cell being processed :param j: int representing the index of the gene being processed ...
[ "Function", "returns", "the", "sum", "of", "squared", "differences", "in", "the", "expression", "of", "a", "gene", "per", "cell", ":", "param", "i", ":", "int", "representing", "the", "index", "of", "the", "cell", "being", "processed", ":", "param", "j", ...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L111-L122
[ "def", "dev_ij", "(", "i", ",", "j", ",", "traj_exp", ",", "adj_mat", ")", ":", "#takes adjacency matrix and raw expression data", "t", "=", "np", ".", "asmatrix", "(", "traj_exp", ")", "wh", "=", "np", ".", "where", "(", "adj_mat", "[", "i", "]", ">", ...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
selection_val
Function returns an ndarray of ratios calculated by dividing the summed neighborhood variances by the global variance :param traj_exp: ndarray representing gene expression :param adj_mat: ndarray representing the calculated adjacency matrix :return val: ndarray representing the ratio of summed neighborhood ...
nvr/NVR.py
def selection_val(traj_exp,adj_mat): ''' Function returns an ndarray of ratios calculated by dividing the summed neighborhood variances by the global variance :param traj_exp: ndarray representing gene expression :param adj_mat: ndarray representing the calculated adjacency matrix :return val: ndarr...
def selection_val(traj_exp,adj_mat): ''' Function returns an ndarray of ratios calculated by dividing the summed neighborhood variances by the global variance :param traj_exp: ndarray representing gene expression :param adj_mat: ndarray representing the calculated adjacency matrix :return val: ndarr...
[ "Function", "returns", "an", "ndarray", "of", "ratios", "calculated", "by", "dividing", "the", "summed", "neighborhood", "variances", "by", "the", "global", "variance", ":", "param", "traj_exp", ":", "ndarray", "representing", "gene", "expression", ":", "param", ...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L126-L154
[ "def", "selection_val", "(", "traj_exp", ",", "adj_mat", ")", ":", "r", "=", "traj_exp", ".", "shape", "[", "0", "]", "#keep track of the rows", "c", "=", "traj_exp", ".", "shape", "[", "1", "]", "#keep track of the columns", "k", "=", "np", ".", "sum", ...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
select_genes
Wrapper function to perform neighborhood variance based feature selection, will throw error if input is not ndarray :param embedding: ndarray representing gene expression, consists of cells as rows and genes as columns :return genes_mat: ndarray of selected genes
nvr/NVR.py
def select_genes(embedding): ''' Wrapper function to perform neighborhood variance based feature selection, will throw error if input is not ndarray :param embedding: ndarray representing gene expression, consists of cells as rows and genes as columns :return genes_mat: ndarray of selected genes '''...
def select_genes(embedding): ''' Wrapper function to perform neighborhood variance based feature selection, will throw error if input is not ndarray :param embedding: ndarray representing gene expression, consists of cells as rows and genes as columns :return genes_mat: ndarray of selected genes '''...
[ "Wrapper", "function", "to", "perform", "neighborhood", "variance", "based", "feature", "selection", "will", "throw", "error", "if", "input", "is", "not", "ndarray", ":", "param", "embedding", ":", "ndarray", "representing", "gene", "expression", "consists", "of",...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L158-L185
[ "def", "select_genes", "(", "embedding", ")", ":", "if", "not", "(", "isinstance", "(", "embedding", ",", "np", ".", "ndarray", ")", ")", ":", "raise", "TypeError", "(", "'data variable must be numpy ndarray'", ")", "print", "(", "\"Start min_conn_k\"", ")", "...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
subsample
Function to generate randomly sampled datasets with replacement. This is in the context of cells in the native dataset which are the rows of the matrix :param partitions: int designating the number of evenly spaced sample sizes to randomly select from the native dataset :param dataset: DataFrame of the nati...
nvr/NVR.py
def subsample(partitions,dataset,seed): ''' Function to generate randomly sampled datasets with replacement. This is in the context of cells in the native dataset which are the rows of the matrix :param partitions: int designating the number of evenly spaced sample sizes to randomly select from the nati...
def subsample(partitions,dataset,seed): ''' Function to generate randomly sampled datasets with replacement. This is in the context of cells in the native dataset which are the rows of the matrix :param partitions: int designating the number of evenly spaced sample sizes to randomly select from the nati...
[ "Function", "to", "generate", "randomly", "sampled", "datasets", "with", "replacement", ".", "This", "is", "in", "the", "context", "of", "cells", "in", "the", "native", "dataset", "which", "are", "the", "rows", "of", "the", "matrix", ":", "param", "partition...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L189-L202
[ "def", "subsample", "(", "partitions", ",", "dataset", ",", "seed", ")", ":", "parts", "=", "np", ".", "arange", "(", "dataset", ".", "shape", "[", "0", "]", "/", "partitions", ",", "dataset", ".", "shape", "[", "0", "]", ",", "dataset", ".", "shap...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
subsampleReplicates
Wrapper function that generates replicate datasets using the subsampling function. :param repNumber: int number of replicates to generate based on the parameters given :param partitions: int designating the number of evenly spaced sample sizes to randomly select from the native dataset :param dataset: DataF...
nvr/NVR.py
def subsampleReplicates(repNumber,partitions,dataset,seed): ''' Wrapper function that generates replicate datasets using the subsampling function. :param repNumber: int number of replicates to generate based on the parameters given :param partitions: int designating the number of evenly spaced sample si...
def subsampleReplicates(repNumber,partitions,dataset,seed): ''' Wrapper function that generates replicate datasets using the subsampling function. :param repNumber: int number of replicates to generate based on the parameters given :param partitions: int designating the number of evenly spaced sample si...
[ "Wrapper", "function", "that", "generates", "replicate", "datasets", "using", "the", "subsampling", "function", ".", ":", "param", "repNumber", ":", "int", "number", "of", "replicates", "to", "generate", "based", "on", "the", "parameters", "given", ":", "param",...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L206-L218
[ "def", "subsampleReplicates", "(", "repNumber", ",", "partitions", ",", "dataset", ",", "seed", ")", ":", "repOut", "=", "{", "}", "for", "i", "in", "range", "(", "repNumber", ")", ":", "repOut", "[", "\"replicate{0}\"", ".", "format", "(", "i", ")", "...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
dictToFile
Function to write dictionary data, from subsampleReplicates, to file an hdf5 file. :param dictionary: nested dictionary returned by subsampleReplicates :param replicateKey: string designating the replicate written to file :param outFileName: string defining the hdf5 filename
nvr/NVR.py
def dictToFile(dictionary,replicateKey,outFileName): ''' Function to write dictionary data, from subsampleReplicates, to file an hdf5 file. :param dictionary: nested dictionary returned by subsampleReplicates :param replicateKey: string designating the replicate written to file :param outFileName: ...
def dictToFile(dictionary,replicateKey,outFileName): ''' Function to write dictionary data, from subsampleReplicates, to file an hdf5 file. :param dictionary: nested dictionary returned by subsampleReplicates :param replicateKey: string designating the replicate written to file :param outFileName: ...
[ "Function", "to", "write", "dictionary", "data", "from", "subsampleReplicates", "to", "file", "an", "hdf5", "file", ".", ":", "param", "dictionary", ":", "nested", "dictionary", "returned", "by", "subsampleReplicates", ":", "param", "replicateKey", ":", "string", ...
KenLauLab/NVR
python
https://github.com/KenLauLab/NVR/blob/ca9b292d78a3ca6ad93ae327a203feed8ed47948/nvr/NVR.py#L222-L234
[ "def", "dictToFile", "(", "dictionary", ",", "replicateKey", ",", "outFileName", ")", ":", "replicateToFile", "=", "h5py", ".", "File", "(", "outFileName", ",", "\"w\"", ")", "for", "i", "in", "range", "(", "len", "(", "dictionary", "[", "replicateKey", "]...
ca9b292d78a3ca6ad93ae327a203feed8ed47948
train
iter_otus
generator over all otus in all otus group elements. yields a tuple of 3 items: otus group ID, otu ID, the otu obj
peyotl/manip.py
def iter_otus(nexson, nexson_version=None): """generator over all otus in all otus group elements. yields a tuple of 3 items: otus group ID, otu ID, the otu obj """ if nexson_version is None: nexson_version = detect_nexson_version(nexson) if not _is_by_id_hbf(nexson_v...
def iter_otus(nexson, nexson_version=None): """generator over all otus in all otus group elements. yields a tuple of 3 items: otus group ID, otu ID, the otu obj """ if nexson_version is None: nexson_version = detect_nexson_version(nexson) if not _is_by_id_hbf(nexson_v...
[ "generator", "over", "all", "otus", "in", "all", "otus", "group", "elements", ".", "yields", "a", "tuple", "of", "3", "items", ":", "otus", "group", "ID", "otu", "ID", "the", "otu", "obj" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/manip.py#L19-L42
[ "def", "iter_otus", "(", "nexson", ",", "nexson_version", "=", "None", ")", ":", "if", "nexson_version", "is", "None", ":", "nexson_version", "=", "detect_nexson_version", "(", "nexson", ")", "if", "not", "_is_by_id_hbf", "(", "nexson_version", ")", ":", "conv...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
iter_trees
generator over all trees in all trees elements. yields a tuple of 3 items: trees element ID, tree ID, the tree obj
peyotl/manip.py
def iter_trees(nexson, nexson_version=None): """generator over all trees in all trees elements. yields a tuple of 3 items: trees element ID, tree ID, the tree obj """ if nexson_version is None: nexson_version = detect_nexson_version(nexson) nex = get_nexml_el(nexson) ...
def iter_trees(nexson, nexson_version=None): """generator over all trees in all trees elements. yields a tuple of 3 items: trees element ID, tree ID, the tree obj """ if nexson_version is None: nexson_version = detect_nexson_version(nexson) nex = get_nexml_el(nexson) ...
[ "generator", "over", "all", "trees", "in", "all", "trees", "elements", ".", "yields", "a", "tuple", "of", "3", "items", ":", "trees", "element", "ID", "tree", "ID", "the", "tree", "obj" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/manip.py#L45-L76
[ "def", "iter_trees", "(", "nexson", ",", "nexson_version", "=", "None", ")", ":", "if", "nexson_version", "is", "None", ":", "nexson_version", "=", "detect_nexson_version", "(", "nexson", ")", "nex", "=", "get_nexml_el", "(", "nexson", ")", "if", "_is_by_id_hb...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
label_to_original_label_otu_by_id
Takes a v1.2 otuById dict and, for every otu, checks if ot:originalLabel exists. If it does not, but @label does, then ot:originalLabel is set to @label and @label is deleted.
peyotl/manip.py
def label_to_original_label_otu_by_id(otu_by_id): """Takes a v1.2 otuById dict and, for every otu, checks if ot:originalLabel exists. If it does not, but @label does, then ot:originalLabel is set to @label and @label is deleted. """ for val in otu_by_id.values(): orig = val.get('^ot:orig...
def label_to_original_label_otu_by_id(otu_by_id): """Takes a v1.2 otuById dict and, for every otu, checks if ot:originalLabel exists. If it does not, but @label does, then ot:originalLabel is set to @label and @label is deleted. """ for val in otu_by_id.values(): orig = val.get('^ot:orig...
[ "Takes", "a", "v1", ".", "2", "otuById", "dict", "and", "for", "every", "otu", "checks", "if", "ot", ":", "originalLabel", "exists", ".", "If", "it", "does", "not", "but" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/manip.py#L79-L91
[ "def", "label_to_original_label_otu_by_id", "(", "otu_by_id", ")", ":", "for", "val", "in", "otu_by_id", ".", "values", "(", ")", ":", "orig", "=", "val", ".", "get", "(", "'^ot:originalLabel'", ")", "if", "orig", "is", "None", ":", "label", "=", "val", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
merge_otus_and_trees
Takes a nexson object: 1. merges trees elements 2 - # trees into the first trees element., 2. merges otus elements 2 - # otus into the first otus element. 3. if there is no ot:originalLabel field for any otu, it sets that field based on @label and deletes @label 4. merges an ...
peyotl/manip.py
def merge_otus_and_trees(nexson_blob): """Takes a nexson object: 1. merges trees elements 2 - # trees into the first trees element., 2. merges otus elements 2 - # otus into the first otus element. 3. if there is no ot:originalLabel field for any otu, it sets that field based on @...
def merge_otus_and_trees(nexson_blob): """Takes a nexson object: 1. merges trees elements 2 - # trees into the first trees element., 2. merges otus elements 2 - # otus into the first otus element. 3. if there is no ot:originalLabel field for any otu, it sets that field based on @...
[ "Takes", "a", "nexson", "object", ":", "1", ".", "merges", "trees", "elements", "2", "-", "#", "trees", "into", "the", "first", "trees", "element", ".", "2", ".", "merges", "otus", "elements", "2", "-", "#", "otus", "into", "the", "first", "otus", "e...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/manip.py#L124-L263
[ "def", "merge_otus_and_trees", "(", "nexson_blob", ")", ":", "id_to_replace_id", "=", "{", "}", "orig_version", "=", "detect_nexson_version", "(", "nexson_blob", ")", "convert_nexson_format", "(", "nexson_blob", ",", "BY_ID_HONEY_BADGERFISH", ")", "nexson", "=", "get_...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
detect_nexson_version
Returns the nexml2json attribute or the default code for badgerfish
peyotl/nexson_syntax/helper.py
def detect_nexson_version(blob): """Returns the nexml2json attribute or the default code for badgerfish""" n = get_nexml_el(blob) assert isinstance(n, dict) return n.get('@nexml2json', BADGER_FISH_NEXSON_VERSION)
def detect_nexson_version(blob): """Returns the nexml2json attribute or the default code for badgerfish""" n = get_nexml_el(blob) assert isinstance(n, dict) return n.get('@nexml2json', BADGER_FISH_NEXSON_VERSION)
[ "Returns", "the", "nexml2json", "attribute", "or", "the", "default", "code", "for", "badgerfish" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L40-L44
[ "def", "detect_nexson_version", "(", "blob", ")", ":", "n", "=", "get_nexml_el", "(", "blob", ")", "assert", "isinstance", "(", "n", ",", "dict", ")", "return", "n", ".", "get", "(", "'@nexml2json'", ",", "BADGER_FISH_NEXSON_VERSION", ")" ]
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_index_list_of_values
Returns d[k] or [d[k]] if the value is not a list
peyotl/nexson_syntax/helper.py
def _index_list_of_values(d, k): """Returns d[k] or [d[k]] if the value is not a list""" v = d[k] if isinstance(v, list): return v return [v]
def _index_list_of_values(d, k): """Returns d[k] or [d[k]] if the value is not a list""" v = d[k] if isinstance(v, list): return v return [v]
[ "Returns", "d", "[", "k", "]", "or", "[", "d", "[", "k", "]]", "if", "the", "value", "is", "not", "a", "list" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L90-L95
[ "def", "_index_list_of_values", "(", "d", ",", "k", ")", ":", "v", "=", "d", "[", "k", "]", "if", "isinstance", "(", "v", ",", "list", ")", ":", "return", "v", "return", "[", "v", "]" ]
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_get_index_list_of_values
Like _index_list_of_values, but uses get to access and returns an empty list if the key is absent. Returns d[k] or [d[k]] if the value is not a list
peyotl/nexson_syntax/helper.py
def _get_index_list_of_values(d, k, def_value=None): """Like _index_list_of_values, but uses get to access and returns an empty list if the key is absent. Returns d[k] or [d[k]] if the value is not a list""" v = d.get(k, def_value) if v is None: return [] if isinstance(v, list): ...
def _get_index_list_of_values(d, k, def_value=None): """Like _index_list_of_values, but uses get to access and returns an empty list if the key is absent. Returns d[k] or [d[k]] if the value is not a list""" v = d.get(k, def_value) if v is None: return [] if isinstance(v, list): ...
[ "Like", "_index_list_of_values", "but", "uses", "get", "to", "access", "and", "returns", "an", "empty", "list", "if", "the", "key", "is", "absent", ".", "Returns", "d", "[", "k", "]", "or", "[", "d", "[", "k", "]]", "if", "the", "value", "is", "not",...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L98-L107
[ "def", "_get_index_list_of_values", "(", "d", ",", "k", ",", "def_value", "=", "None", ")", ":", "v", "=", "d", ".", "get", "(", "k", ",", "def_value", ")", "if", "v", "is", "None", ":", "return", "[", "]", "if", "isinstance", "(", "v", ",", "lis...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_add_value_to_dict_bf
Adds the `k`->`v` mapping to `d`, but if a previous element exists it changes the value of for the key to list. This is used in the BadgerFish mapping convention. This is a simple multi-dict that is only suitable when you know that you'll never store a list or `None` as a value in the dict.
peyotl/nexson_syntax/helper.py
def _add_value_to_dict_bf(d, k, v): """Adds the `k`->`v` mapping to `d`, but if a previous element exists it changes the value of for the key to list. This is used in the BadgerFish mapping convention. This is a simple multi-dict that is only suitable when you know that you'll never store a list o...
def _add_value_to_dict_bf(d, k, v): """Adds the `k`->`v` mapping to `d`, but if a previous element exists it changes the value of for the key to list. This is used in the BadgerFish mapping convention. This is a simple multi-dict that is only suitable when you know that you'll never store a list o...
[ "Adds", "the", "k", "-", ">", "v", "mapping", "to", "d", "but", "if", "a", "previous", "element", "exists", "it", "changes", "the", "value", "of", "for", "the", "key", "to", "list", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L110-L133
[ "def", "_add_value_to_dict_bf", "(", "d", ",", "k", ",", "v", ")", ":", "prev", "=", "d", ".", "get", "(", "k", ")", "if", "prev", "is", "None", ":", "d", "[", "k", "]", "=", "v", "elif", "isinstance", "(", "prev", ",", "list", ")", ":", "if"...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_add_uniq_value_to_dict_bf
Like _add_value_to_dict_bf but will not add v if another element in under key `k` has the same value.
peyotl/nexson_syntax/helper.py
def _add_uniq_value_to_dict_bf(d, k, v): """Like _add_value_to_dict_bf but will not add v if another element in under key `k` has the same value. """ prev = d.get(k) if prev is None: d[k] = v elif isinstance(prev, list): if not isinstance(v, list): v = [v] for...
def _add_uniq_value_to_dict_bf(d, k, v): """Like _add_value_to_dict_bf but will not add v if another element in under key `k` has the same value. """ prev = d.get(k) if prev is None: d[k] = v elif isinstance(prev, list): if not isinstance(v, list): v = [v] for...
[ "Like", "_add_value_to_dict_bf", "but", "will", "not", "add", "v", "if", "another", "element", "in", "under", "key", "k", "has", "the", "same", "value", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L136-L168
[ "def", "_add_uniq_value_to_dict_bf", "(", "d", ",", "k", ",", "v", ")", ":", "prev", "=", "d", ".", "get", "(", "k", ")", "if", "prev", "is", "None", ":", "d", "[", "k", "]", "=", "v", "elif", "isinstance", "(", "prev", ",", "list", ")", ":", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_debug_dump_dom
Debugging helper. Prints out `el` contents.
peyotl/nexson_syntax/helper.py
def _debug_dump_dom(el): """Debugging helper. Prints out `el` contents.""" import xml.dom.minidom s = [el.nodeName] att_container = el.attributes for i in range(att_container.length): attr = att_container.item(i) s.append(' @{a}="{v}"'.format(a=attr.name, v=attr.value)) for c in...
def _debug_dump_dom(el): """Debugging helper. Prints out `el` contents.""" import xml.dom.minidom s = [el.nodeName] att_container = el.attributes for i in range(att_container.length): attr = att_container.item(i) s.append(' @{a}="{v}"'.format(a=attr.name, v=attr.value)) for c in...
[ "Debugging", "helper", ".", "Prints", "out", "el", "contents", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L177-L190
[ "def", "_debug_dump_dom", "(", "el", ")", ":", "import", "xml", ".", "dom", ".", "minidom", "s", "=", "[", "el", ".", "nodeName", "]", "att_container", "=", "el", ".", "attributes", "for", "i", "in", "range", "(", "att_container", ".", "length", ")", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_cull_redundant_about
Removes the @about key from the `obj` dict if that value refers to the dict's '@id'
peyotl/nexson_syntax/helper.py
def _cull_redundant_about(obj): """Removes the @about key from the `obj` dict if that value refers to the dict's '@id' """ about_val = obj.get('@about') if about_val: id_val = obj.get('@id') if id_val and (('#' + id_val) == about_val): del obj['@about']
def _cull_redundant_about(obj): """Removes the @about key from the `obj` dict if that value refers to the dict's '@id' """ about_val = obj.get('@about') if about_val: id_val = obj.get('@id') if id_val and (('#' + id_val) == about_val): del obj['@about']
[ "Removes", "the" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L193-L201
[ "def", "_cull_redundant_about", "(", "obj", ")", ":", "about_val", "=", "obj", ".", "get", "(", "'@about'", ")", "if", "about_val", ":", "id_val", "=", "obj", ".", "get", "(", "'@id'", ")", "if", "id_val", "and", "(", "(", "'#'", "+", "id_val", ")", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_python_instance_to_nexml_meta_datatype
Returns 'xsd:string' or a more specific type for a <meta datatype="XYZ"... syntax using introspection.
peyotl/nexson_syntax/helper.py
def _python_instance_to_nexml_meta_datatype(v): """Returns 'xsd:string' or a more specific type for a <meta datatype="XYZ"... syntax using introspection. """ if isinstance(v, bool): return 'xsd:boolean' if is_int_type(v): return 'xsd:int' if isinstance(v, float): return '...
def _python_instance_to_nexml_meta_datatype(v): """Returns 'xsd:string' or a more specific type for a <meta datatype="XYZ"... syntax using introspection. """ if isinstance(v, bool): return 'xsd:boolean' if is_int_type(v): return 'xsd:int' if isinstance(v, float): return '...
[ "Returns", "xsd", ":", "string", "or", "a", "more", "specific", "type", "for", "a", "<meta", "datatype", "=", "XYZ", "...", "syntax", "using", "introspection", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L236-L246
[ "def", "_python_instance_to_nexml_meta_datatype", "(", "v", ")", ":", "if", "isinstance", "(", "v", ",", "bool", ")", ":", "return", "'xsd:boolean'", "if", "is_int_type", "(", "v", ")", ":", "return", "'xsd:int'", "if", "isinstance", "(", "v", ",", "float", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_convert_hbf_meta_val_for_xml
Convert to a BadgerFish-style dict for addition to a dict suitable for addition to XML tree or for v1.0 to v0.0 conversion.
peyotl/nexson_syntax/helper.py
def _convert_hbf_meta_val_for_xml(key, val): """Convert to a BadgerFish-style dict for addition to a dict suitable for addition to XML tree or for v1.0 to v0.0 conversion.""" if isinstance(val, list): return [_convert_hbf_meta_val_for_xml(key, i) for i in val] is_literal = True content = Non...
def _convert_hbf_meta_val_for_xml(key, val): """Convert to a BadgerFish-style dict for addition to a dict suitable for addition to XML tree or for v1.0 to v0.0 conversion.""" if isinstance(val, list): return [_convert_hbf_meta_val_for_xml(key, i) for i in val] is_literal = True content = Non...
[ "Convert", "to", "a", "BadgerFish", "-", "style", "dict", "for", "addition", "to", "a", "dict", "suitable", "for", "addition", "to", "XML", "tree", "or", "for", "v1", ".", "0", "to", "v0", ".", "0", "conversion", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L249-L277
[ "def", "_convert_hbf_meta_val_for_xml", "(", "key", ",", "val", ")", ":", "if", "isinstance", "(", "val", ",", "list", ")", ":", "return", "[", "_convert_hbf_meta_val_for_xml", "(", "key", ",", "i", ")", "for", "i", "in", "val", "]", "is_literal", "=", "...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
find_val_for_first_bf_l_meta
Returns the $ value of the first meta element with the @property that matches @prop_name (or None).
peyotl/nexson_syntax/helper.py
def find_val_for_first_bf_l_meta(d, prop_name): """Returns the $ value of the first meta element with the @property that matches @prop_name (or None). """ m_list = d.get('meta') if not m_list: return None if not isinstance(m_list, list): m_list = [m_list] for m_el in m_list: ...
def find_val_for_first_bf_l_meta(d, prop_name): """Returns the $ value of the first meta element with the @property that matches @prop_name (or None). """ m_list = d.get('meta') if not m_list: return None if not isinstance(m_list, list): m_list = [m_list] for m_el in m_list: ...
[ "Returns", "the", "$", "value", "of", "the", "first", "meta", "element", "with", "the" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L304-L316
[ "def", "find_val_for_first_bf_l_meta", "(", "d", ",", "prop_name", ")", ":", "m_list", "=", "d", ".", "get", "(", "'meta'", ")", "if", "not", "m_list", ":", "return", "None", "if", "not", "isinstance", "(", "m_list", ",", "list", ")", ":", "m_list", "=...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
find_nested_meta_first_bf
Returns the $ value of the first meta element with the @property that matches @prop_name (or None).
peyotl/nexson_syntax/helper.py
def find_nested_meta_first_bf(d, prop_name): """Returns the $ value of the first meta element with the @property that matches @prop_name (or None). """ m_list = d.get('meta') if not m_list: return None if not isinstance(m_list, list): m_list = [m_list] for m_el in m_list: ...
def find_nested_meta_first_bf(d, prop_name): """Returns the $ value of the first meta element with the @property that matches @prop_name (or None). """ m_list = d.get('meta') if not m_list: return None if not isinstance(m_list, list): m_list = [m_list] for m_el in m_list: ...
[ "Returns", "the", "$", "value", "of", "the", "first", "meta", "element", "with", "the" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L346-L358
[ "def", "find_nested_meta_first_bf", "(", "d", ",", "prop_name", ")", ":", "m_list", "=", "d", ".", "get", "(", "'meta'", ")", "if", "not", "m_list", ":", "return", "None", "if", "not", "isinstance", "(", "m_list", ",", "list", ")", ":", "m_list", "=", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
find_nested_meta_first
Returns obj. for badgerfish and val for hbf. Appropriate for nested literals
peyotl/nexson_syntax/helper.py
def find_nested_meta_first(d, prop_name, version): """Returns obj. for badgerfish and val for hbf. Appropriate for nested literals""" if _is_badgerfish_version(version): return find_nested_meta_first_bf(d, prop_name) p = '^' + prop_name return d.get(p)
def find_nested_meta_first(d, prop_name, version): """Returns obj. for badgerfish and val for hbf. Appropriate for nested literals""" if _is_badgerfish_version(version): return find_nested_meta_first_bf(d, prop_name) p = '^' + prop_name return d.get(p)
[ "Returns", "obj", ".", "for", "badgerfish", "and", "val", "for", "hbf", ".", "Appropriate", "for", "nested", "literals" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/helper.py#L361-L366
[ "def", "find_nested_meta_first", "(", "d", ",", "prop_name", ",", "version", ")", ":", "if", "_is_badgerfish_version", "(", "version", ")", ":", "return", "find_nested_meta_first_bf", "(", "d", ",", "prop_name", ")", "p", "=", "'^'", "+", "prop_name", "return"...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
asterank
Format Requests are of the form: http://asterank.com/api/asterank?query={query}&limit={limit} Response data formats are largely derived from NASA/JPL's Small Body Database query browser. Exceptions to this are the delta-v field (dv), the mass field (GM), and the normalized spectral type field (spec). Addit...
bowshock/asterank.py
def asterank(query=None, limit=None): ''' Format Requests are of the form: http://asterank.com/api/asterank?query={query}&limit={limit} Response data formats are largely derived from NASA/JPL's Small Body Database query browser. Exceptions to this are the delta-v field (dv), the mass field (GM), an...
def asterank(query=None, limit=None): ''' Format Requests are of the form: http://asterank.com/api/asterank?query={query}&limit={limit} Response data formats are largely derived from NASA/JPL's Small Body Database query browser. Exceptions to this are the delta-v field (dv), the mass field (GM), an...
[ "Format", "Requests", "are", "of", "the", "form", ":" ]
emirozer/bowshock
python
https://github.com/emirozer/bowshock/blob/9f5e053f1d54995b833b83616f37c67178c3e840/bowshock/asterank.py#L12-L48
[ "def", "asterank", "(", "query", "=", "None", ",", "limit", "=", "None", ")", ":", "base_url", "=", "\"http://asterank.com/api/asterank?\"", "if", "query", ":", "try", ":", "query", "=", "json", ".", "dumps", "(", "query", ")", "base_url", "+=", "\"query=\...
9f5e053f1d54995b833b83616f37c67178c3e840
train
encode
Encode credential attribute value, leaving any (stringified) int32 alone: indy-sdk predicates operate on int32 values properly only when their encoded values match their raw values. To disambiguate for decoding, the operation reserves a sentinel for the null value and otherwise adds 2**31 to any non-trivia...
von_agent/codec.py
def encode(raw: Any) -> str: """ Encode credential attribute value, leaving any (stringified) int32 alone: indy-sdk predicates operate on int32 values properly only when their encoded values match their raw values. To disambiguate for decoding, the operation reserves a sentinel for the null value and o...
def encode(raw: Any) -> str: """ Encode credential attribute value, leaving any (stringified) int32 alone: indy-sdk predicates operate on int32 values properly only when their encoded values match their raw values. To disambiguate for decoding, the operation reserves a sentinel for the null value and o...
[ "Encode", "credential", "attribute", "value", "leaving", "any", "(", "stringified", ")", "int32", "alone", ":", "indy", "-", "sdk", "predicates", "operate", "on", "int32", "values", "properly", "only", "when", "their", "encoded", "values", "match", "their", "r...
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/codec.py#L35-L67
[ "def", "encode", "(", "raw", ":", "Any", ")", "->", "str", ":", "if", "raw", "is", "None", ":", "return", "str", "(", "I32_BOUND", ")", "# sentinel", "stringified", "=", "str", "(", "raw", ")", "if", "isinstance", "(", "raw", ",", "bool", ")", ":",...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
decode
Decode encoded credential attribute value. :param value: numeric string to decode :return: decoded value, stringified if original was neither str, bool, int, nor float
von_agent/codec.py
def decode(value: str) -> Union[str, None, bool, int, float]: """ Decode encoded credential attribute value. :param value: numeric string to decode :return: decoded value, stringified if original was neither str, bool, int, nor float """ assert value.isdigit() or value[0] == '-' and value[1:]....
def decode(value: str) -> Union[str, None, bool, int, float]: """ Decode encoded credential attribute value. :param value: numeric string to decode :return: decoded value, stringified if original was neither str, bool, int, nor float """ assert value.isdigit() or value[0] == '-' and value[1:]....
[ "Decode", "encoded", "credential", "attribute", "value", "." ]
PSPC-SPAC-buyandsell/von_agent
python
https://github.com/PSPC-SPAC-buyandsell/von_agent/blob/0b1c17cca3bd178b6e6974af84dbac1dfce5cf45/von_agent/codec.py#L70-L96
[ "def", "decode", "(", "value", ":", "str", ")", "->", "Union", "[", "str", ",", "None", ",", "bool", ",", "int", ",", "float", "]", ":", "assert", "value", ".", "isdigit", "(", ")", "or", "value", "[", "0", "]", "==", "'-'", "and", "value", "["...
0b1c17cca3bd178b6e6974af84dbac1dfce5cf45
train
Logger.log
Log txt (if any) to the log file (if any). Return value indicates whether it is ok to terminate on the first error or whether we need to continue processing. :param txt: text to log. :return: True if we aren't logging, False if we are.
pyjsg/jsglib/logger.py
def log(self, txt: str) -> bool: """ Log txt (if any) to the log file (if any). Return value indicates whether it is ok to terminate on the first error or whether we need to continue processing. :param txt: text to log. :return: True if we aren't logging, False if we are. """ ...
def log(self, txt: str) -> bool: """ Log txt (if any) to the log file (if any). Return value indicates whether it is ok to terminate on the first error or whether we need to continue processing. :param txt: text to log. :return: True if we aren't logging, False if we are. """ ...
[ "Log", "txt", "(", "if", "any", ")", "to", "the", "log", "file", "(", "if", "any", ")", ".", "Return", "value", "indicates", "whether", "it", "is", "ok", "to", "terminate", "on", "the", "first", "error", "or", "whether", "we", "need", "to", "continue...
hsolbrig/pyjsg
python
https://github.com/hsolbrig/pyjsg/blob/9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7/pyjsg/jsglib/logger.py#L20-L30
[ "def", "log", "(", "self", ",", "txt", ":", "str", ")", "->", "bool", ":", "self", ".", "nerrors", "+=", "1", "if", "self", ".", "_logfile", "is", "not", "None", ":", "print", "(", "txt", ",", "file", "=", "self", ".", "_logfile", ")", "return", ...
9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7
train
JSGObject._strip_nones
An attribute with type None is equivalent to an absent attribute. :param d: Object with attributes :return: Object dictionary w/ Nones and underscores removed
pyjsg/jsglib/jsg_object.py
def _strip_nones(d: Dict[str, Any])-> Dict[str, Any]: """ An attribute with type None is equivalent to an absent attribute. :param d: Object with attributes :return: Object dictionary w/ Nones and underscores removed """ return OrderedDict({k: None if isinstance(v, JSGNul...
def _strip_nones(d: Dict[str, Any])-> Dict[str, Any]: """ An attribute with type None is equivalent to an absent attribute. :param d: Object with attributes :return: Object dictionary w/ Nones and underscores removed """ return OrderedDict({k: None if isinstance(v, JSGNul...
[ "An", "attribute", "with", "type", "None", "is", "equivalent", "to", "an", "absent", "attribute", ".", ":", "param", "d", ":", "Object", "with", "attributes", ":", "return", ":", "Object", "dictionary", "w", "/", "Nones", "and", "underscores", "removed" ]
hsolbrig/pyjsg
python
https://github.com/hsolbrig/pyjsg/blob/9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7/pyjsg/jsglib/jsg_object.py#L108-L118
[ "def", "_strip_nones", "(", "d", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "OrderedDict", "(", "{", "k", ":", "None", "if", "isinstance", "(", "v", ",", "JSGNull", ")", "else", "v", ...
9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7
train
JSGObject._default
Return a serializable version of obj. Overrides JsonObj _default method :param obj: Object to be serialized :return: Serialized version of obj
pyjsg/jsglib/jsg_object.py
def _default(self, obj: object): """ Return a serializable version of obj. Overrides JsonObj _default method :param obj: Object to be serialized :return: Serialized version of obj """ return None if obj is JSGNull else obj.val if type(obj) is AnyType else \ JSGObject....
def _default(self, obj: object): """ Return a serializable version of obj. Overrides JsonObj _default method :param obj: Object to be serialized :return: Serialized version of obj """ return None if obj is JSGNull else obj.val if type(obj) is AnyType else \ JSGObject....
[ "Return", "a", "serializable", "version", "of", "obj", ".", "Overrides", "JsonObj", "_default", "method", ":", "param", "obj", ":", "Object", "to", "be", "serialized", ":", "return", ":", "Serialized", "version", "of", "obj" ]
hsolbrig/pyjsg
python
https://github.com/hsolbrig/pyjsg/blob/9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7/pyjsg/jsglib/jsg_object.py#L133-L140
[ "def", "_default", "(", "self", ",", "obj", ":", "object", ")", ":", "return", "None", "if", "obj", "is", "JSGNull", "else", "obj", ".", "val", "if", "type", "(", "obj", ")", "is", "AnyType", "else", "JSGObject", ".", "_strip_nones", "(", "obj", ".",...
9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7
train
ShardedDocStore.get_repo_and_path_fragment
For `doc_id` returns a list of: [0] the repo name and, [1] the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path.
peyotl/git_storage/sharded_doc_store.py
def get_repo_and_path_fragment(self, doc_id): """For `doc_id` returns a list of: [0] the repo name and, [1] the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path. """ shard = self.get_s...
def get_repo_and_path_fragment(self, doc_id): """For `doc_id` returns a list of: [0] the repo name and, [1] the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path. """ shard = self.get_s...
[ "For", "doc_id", "returns", "a", "list", "of", ":", "[", "0", "]", "the", "repo", "name", "and", "[", "1", "]", "the", "path", "from", "the", "repo", "to", "the", "doc", "file", ".", "This", "is", "useful", "because", "(", "if", "you", "know", "t...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/sharded_doc_store.py#L28-L36
[ "def", "get_repo_and_path_fragment", "(", "self", ",", "doc_id", ")", ":", "shard", "=", "self", ".", "get_shard", "(", "doc_id", ")", "return", "shard", ".", "name", ",", "shard", ".", "get_rel_path_fragment", "(", "doc_id", ")" ]
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
ShardedDocStore.get_public_url
Returns a GitHub URL for the doc in question (study, collection, ...)
peyotl/git_storage/sharded_doc_store.py
def get_public_url(self, doc_id, branch='master'): """Returns a GitHub URL for the doc in question (study, collection, ...) """ name, path_frag = self.get_repo_and_path_fragment(doc_id) return 'https://raw.githubusercontent.com/OpenTreeOfLife/' + name + '/' + branch + '/' + path_frag
def get_public_url(self, doc_id, branch='master'): """Returns a GitHub URL for the doc in question (study, collection, ...) """ name, path_frag = self.get_repo_and_path_fragment(doc_id) return 'https://raw.githubusercontent.com/OpenTreeOfLife/' + name + '/' + branch + '/' + path_frag
[ "Returns", "a", "GitHub", "URL", "for", "the", "doc", "in", "question", "(", "study", "collection", "...", ")" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/sharded_doc_store.py#L38-L42
[ "def", "get_public_url", "(", "self", ",", "doc_id", ",", "branch", "=", "'master'", ")", ":", "name", ",", "path_frag", "=", "self", ".", "get_repo_and_path_fragment", "(", "doc_id", ")", "return", "'https://raw.githubusercontent.com/OpenTreeOfLife/'", "+", "name",...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
validate_params_match
Validates that the given parameters are exactly the method's declared parameters. :param method: The method to be called :type method: function :param parameters: The parameters to use in the call :type parameters: dict[str, object] | list[object]
typedjsonrpc/parameter_checker.py
def validate_params_match(method, parameters): """Validates that the given parameters are exactly the method's declared parameters. :param method: The method to be called :type method: function :param parameters: The parameters to use in the call :type parameters: dict[str, object] | list[object] ...
def validate_params_match(method, parameters): """Validates that the given parameters are exactly the method's declared parameters. :param method: The method to be called :type method: function :param parameters: The parameters to use in the call :type parameters: dict[str, object] | list[object] ...
[ "Validates", "that", "the", "given", "parameters", "are", "exactly", "the", "method", "s", "declared", "parameters", "." ]
palantir/typedjsonrpc
python
https://github.com/palantir/typedjsonrpc/blob/274218fcd236ff9643506caa629029c9ba25a0fb/typedjsonrpc/parameter_checker.py#L27-L55
[ "def", "validate_params_match", "(", "method", ",", "parameters", ")", ":", "argspec", "=", "inspect", ".", "getargspec", "(", "method", ")", "# pylint: disable=deprecated-method", "default_length", "=", "len", "(", "argspec", ".", "defaults", ")", "if", "argspec"...
274218fcd236ff9643506caa629029c9ba25a0fb
train
check_types
Checks that the given parameters have the correct types. :param parameters: List of (name, value) pairs of the given parameters :type parameters: dict[str, object] :param parameter_types: Parameter type by name. :type parameter_types: dict[str, type] :param strict_floats: If False, treat integers a...
typedjsonrpc/parameter_checker.py
def check_types(parameters, parameter_types, strict_floats): """Checks that the given parameters have the correct types. :param parameters: List of (name, value) pairs of the given parameters :type parameters: dict[str, object] :param parameter_types: Parameter type by name. :type parameter_types: ...
def check_types(parameters, parameter_types, strict_floats): """Checks that the given parameters have the correct types. :param parameters: List of (name, value) pairs of the given parameters :type parameters: dict[str, object] :param parameter_types: Parameter type by name. :type parameter_types: ...
[ "Checks", "that", "the", "given", "parameters", "have", "the", "correct", "types", "." ]
palantir/typedjsonrpc
python
https://github.com/palantir/typedjsonrpc/blob/274218fcd236ff9643506caa629029c9ba25a0fb/typedjsonrpc/parameter_checker.py#L58-L73
[ "def", "check_types", "(", "parameters", ",", "parameter_types", ",", "strict_floats", ")", ":", "for", "name", ",", "parameter_type", "in", "parameter_types", ".", "items", "(", ")", ":", "if", "name", "not", "in", "parameters", ":", "raise", "InvalidParamsEr...
274218fcd236ff9643506caa629029c9ba25a0fb
train
check_type_declaration
Checks that exactly the given parameter names have declared types. :param parameter_names: The names of the parameters in the method declaration :type parameter_names: list[str] :param parameter_types: Parameter type by name :type parameter_types: dict[str, type]
typedjsonrpc/parameter_checker.py
def check_type_declaration(parameter_names, parameter_types): """Checks that exactly the given parameter names have declared types. :param parameter_names: The names of the parameters in the method declaration :type parameter_names: list[str] :param parameter_types: Parameter type by name :type par...
def check_type_declaration(parameter_names, parameter_types): """Checks that exactly the given parameter names have declared types. :param parameter_names: The names of the parameters in the method declaration :type parameter_names: list[str] :param parameter_types: Parameter type by name :type par...
[ "Checks", "that", "exactly", "the", "given", "parameter", "names", "have", "declared", "types", "." ]
palantir/typedjsonrpc
python
https://github.com/palantir/typedjsonrpc/blob/274218fcd236ff9643506caa629029c9ba25a0fb/typedjsonrpc/parameter_checker.py#L76-L90
[ "def", "check_type_declaration", "(", "parameter_names", ",", "parameter_types", ")", ":", "if", "len", "(", "parameter_names", ")", "!=", "len", "(", "parameter_types", ")", ":", "raise", "Exception", "(", "\"Number of method parameters ({}) does not match number of \"",...
274218fcd236ff9643506caa629029c9ba25a0fb
train
check_return_type
Checks that the given return value has the correct type. :param value: Value returned by the method :type value: object :param expected_type: Expected return type :type expected_type: type :param strict_floats: If False, treat integers as floats :type strict_floats: bool
typedjsonrpc/parameter_checker.py
def check_return_type(value, expected_type, strict_floats): """Checks that the given return value has the correct type. :param value: Value returned by the method :type value: object :param expected_type: Expected return type :type expected_type: type :param strict_floats: If False, treat integ...
def check_return_type(value, expected_type, strict_floats): """Checks that the given return value has the correct type. :param value: Value returned by the method :type value: object :param expected_type: Expected return type :type expected_type: type :param strict_floats: If False, treat integ...
[ "Checks", "that", "the", "given", "return", "value", "has", "the", "correct", "type", "." ]
palantir/typedjsonrpc
python
https://github.com/palantir/typedjsonrpc/blob/274218fcd236ff9643506caa629029c9ba25a0fb/typedjsonrpc/parameter_checker.py#L93-L109
[ "def", "check_return_type", "(", "value", ",", "expected_type", ",", "strict_floats", ")", ":", "if", "expected_type", "is", "None", ":", "if", "value", "is", "not", "None", ":", "raise", "InvalidReturnTypeError", "(", "\"Returned value is '{}' but None was expected\"...
274218fcd236ff9643506caa629029c9ba25a0fb
train
get_repos
Returns a dictionary of name -> filepath `name` is the repo name based on the dir name (not the get repo). It is not terribly useful, but it is nice to have so that any mirrored repo directory can use the same naming convention. `filepath` will be the full path to the repo directory (it will end...
peyotl/phylesystem/helper.py
def get_repos(par_list=None, **kwargs): """Returns a dictionary of name -> filepath `name` is the repo name based on the dir name (not the get repo). It is not terribly useful, but it is nice to have so that any mirrored repo directory can use the same naming convention. `filepath` will be t...
def get_repos(par_list=None, **kwargs): """Returns a dictionary of name -> filepath `name` is the repo name based on the dir name (not the get repo). It is not terribly useful, but it is nice to have so that any mirrored repo directory can use the same naming convention. `filepath` will be t...
[ "Returns", "a", "dictionary", "of", "name", "-", ">", "filepath", "name", "is", "the", "repo", "name", "based", "on", "the", "dir", "name", "(", "not", "the", "get", "repo", ")", ".", "It", "is", "not", "terribly", "useful", "but", "it", "is", "nice"...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/phylesystem/helper.py#L37-L61
[ "def", "get_repos", "(", "par_list", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_repos", "=", "{", "}", "# key is repo name, value repo location", "if", "par_list", "is", "None", ":", "par_list", "=", "_get_phylesystem_parent", "(", "*", "*", "kwargs", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
create_id2study_info
Searchers for *.json files in this repo and returns a map of study id ==> (`tag`, dir, study filepath) where `tag` is typically the shard name
peyotl/phylesystem/helper.py
def create_id2study_info(path, tag): """Searchers for *.json files in this repo and returns a map of study id ==> (`tag`, dir, study filepath) where `tag` is typically the shard name """ d = {} for triple in os.walk(path): root, files = triple[0], triple[2] for filename in files:...
def create_id2study_info(path, tag): """Searchers for *.json files in this repo and returns a map of study id ==> (`tag`, dir, study filepath) where `tag` is typically the shard name """ d = {} for triple in os.walk(path): root, files = triple[0], triple[2] for filename in files:...
[ "Searchers", "for", "*", ".", "json", "files", "in", "this", "repo", "and", "returns", "a", "map", "of", "study", "id", "==", ">", "(", "tag", "dir", "study", "filepath", ")", "where", "tag", "is", "typically", "the", "shard", "name" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/phylesystem/helper.py#L64-L76
[ "def", "create_id2study_info", "(", "path", ",", "tag", ")", ":", "d", "=", "{", "}", "for", "triple", "in", "os", ".", "walk", "(", "path", ")", ":", "root", ",", "files", "=", "triple", "[", "0", "]", ",", "triple", "[", "2", "]", "for", "fil...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_make_phylesystem_cache_region
Only intended to be called by the Phylesystem singleton.
peyotl/phylesystem/helper.py
def _make_phylesystem_cache_region(**kwargs): """Only intended to be called by the Phylesystem singleton. """ global _CACHE_REGION_CONFIGURED, _REGION if _CACHE_REGION_CONFIGURED: return _REGION _CACHE_REGION_CONFIGURED = True try: # noinspection PyPackageRequirements fro...
def _make_phylesystem_cache_region(**kwargs): """Only intended to be called by the Phylesystem singleton. """ global _CACHE_REGION_CONFIGURED, _REGION if _CACHE_REGION_CONFIGURED: return _REGION _CACHE_REGION_CONFIGURED = True try: # noinspection PyPackageRequirements fro...
[ "Only", "intended", "to", "be", "called", "by", "the", "Phylesystem", "singleton", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/phylesystem/helper.py#L125-L187
[ "def", "_make_phylesystem_cache_region", "(", "*", "*", "kwargs", ")", ":", "global", "_CACHE_REGION_CONFIGURED", ",", "_REGION", "if", "_CACHE_REGION_CONFIGURED", ":", "return", "_REGION", "_CACHE_REGION_CONFIGURED", "=", "True", "try", ":", "# noinspection PyPackageRequ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
main
This function sets up a command-line option parser and then calls match_and_print to do all of the real work.
tutorials/ot-taxon-subtree.py
def main(argv): """This function sets up a command-line option parser and then calls match_and_print to do all of the real work. """ import argparse description = 'Uses Open Tree of Life web services to find information for each OTT ID.' parser = argparse.ArgumentParser(prog='ot-taxon-info', des...
def main(argv): """This function sets up a command-line option parser and then calls match_and_print to do all of the real work. """ import argparse description = 'Uses Open Tree of Life web services to find information for each OTT ID.' parser = argparse.ArgumentParser(prog='ot-taxon-info', des...
[ "This", "function", "sets", "up", "a", "command", "-", "line", "option", "parser", "and", "then", "calls", "match_and_print", "to", "do", "all", "of", "the", "real", "work", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/tutorials/ot-taxon-subtree.py#L15-L26
[ "def", "main", "(", "argv", ")", ":", "import", "argparse", "description", "=", "'Uses Open Tree of Life web services to find information for each OTT ID.'", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'ot-taxon-info'", ",", "description", "=", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
validate_nexson
Takes an `obj` that is a NexSON object. `warning_codes_to_skip` is None or an iterable collection of integers that correspond to facets of NexsonWarningCodes. Warnings associated with any code in the list will be suppressed. `retain_deprecated` if False, then `obj` may be modified to replace ...
peyotl/nexson_validation/__init__.py
def validate_nexson(obj, warning_codes_to_skip=None, retain_deprecated=True, **kwargs): """Takes an `obj` that is a NexSON object. `warning_codes_to_skip` is None or an iterable collection of integers that correspond to facets of NexsonWarningCodes. Warnings associated with any code in the list ...
def validate_nexson(obj, warning_codes_to_skip=None, retain_deprecated=True, **kwargs): """Takes an `obj` that is a NexSON object. `warning_codes_to_skip` is None or an iterable collection of integers that correspond to facets of NexsonWarningCodes. Warnings associated with any code in the list ...
[ "Takes", "an", "obj", "that", "is", "a", "NexSON", "object", ".", "warning_codes_to_skip", "is", "None", "or", "an", "iterable", "collection", "of", "integers", "that", "correspond", "to", "facets", "of", "NexsonWarningCodes", ".", "Warnings", "associated", "wit...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_validation/__init__.py#L10-L32
[ "def", "validate_nexson", "(", "obj", ",", "warning_codes_to_skip", "=", "None", ",", "retain_deprecated", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "warning_codes_to_skip", ":", "v", "=", "FilteringLogger", "(", "codes_to_skip", "=", "list", "(", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
ot_validate
Returns three objects: an annotation dict (NexSON formmatted), the validation_log object created when NexSON validation was performed, and the object of class NexSON which was created from nexson. This object may alias parts of the nexson dict that is passed in as an argument. C...
peyotl/nexson_validation/__init__.py
def ot_validate(nexson, **kwargs): """Returns three objects: an annotation dict (NexSON formmatted), the validation_log object created when NexSON validation was performed, and the object of class NexSON which was created from nexson. This object may alias parts of the nexson dic...
def ot_validate(nexson, **kwargs): """Returns three objects: an annotation dict (NexSON formmatted), the validation_log object created when NexSON validation was performed, and the object of class NexSON which was created from nexson. This object may alias parts of the nexson dic...
[ "Returns", "three", "objects", ":", "an", "annotation", "dict", "(", "NexSON", "formmatted", ")", "the", "validation_log", "object", "created", "when", "NexSON", "validation", "was", "performed", "and", "the", "object", "of", "class", "NexSON", "which", "was", ...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_validation/__init__.py#L35-L49
[ "def", "ot_validate", "(", "nexson", ",", "*", "*", "kwargs", ")", ":", "# stub function for hooking into NexSON validation", "codes_to_skip", "=", "[", "NexsonWarningCodes", ".", "UNVALIDATED_ANNOTATION", "]", "# pylint: disable=E1101", "v_log", ",", "adaptor", "=", "v...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
techport
In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values range from 0-20000. Not all...
bowshock/techport.py
def techport(Id): ''' In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values r...
def techport(Id): ''' In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values r...
[ "In", "order", "to", "use", "this", "capability", "queries", "can", "be", "issued", "to", "the", "system", "with", "the", "following", "URI", "format", ":", "GET", "/", "xml", "-", "api", "/", "id_parameter", "Parameter", "Required?", "Value", "Description",...
emirozer/bowshock
python
https://github.com/emirozer/bowshock/blob/9f5e053f1d54995b833b83616f37c67178c3e840/bowshock/techport.py#L19-L47
[ "def", "techport", "(", "Id", ")", ":", "base_url", "=", "'http://techport.nasa.gov/xml-api/'", "if", "not", "isinstance", "(", "Id", ",", "str", ")", ":", "raise", "ValueError", "(", "\"The Id arg you provided is not the type of str\"", ")", "else", ":", "base_url"...
9f5e053f1d54995b833b83616f37c67178c3e840
train
get_HEAD_SHA1
Not locked!
peyotl/git_storage/git_action.py
def get_HEAD_SHA1(git_dir): """Not locked! """ head_file = os.path.join(git_dir, 'HEAD') with open(head_file, 'r') as hf: head_contents = hf.read().strip() assert head_contents.startswith('ref: ') ref_filename = head_contents[5:] # strip off "ref: " real_ref = os.path.join(git_dir, ...
def get_HEAD_SHA1(git_dir): """Not locked! """ head_file = os.path.join(git_dir, 'HEAD') with open(head_file, 'r') as hf: head_contents = hf.read().strip() assert head_contents.startswith('ref: ') ref_filename = head_contents[5:] # strip off "ref: " real_ref = os.path.join(git_dir, ...
[ "Not", "locked!" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L17-L27
[ "def", "get_HEAD_SHA1", "(", "git_dir", ")", ":", "head_file", "=", "os", ".", "path", ".", "join", "(", "git_dir", ",", "'HEAD'", ")", "with", "open", "(", "head_file", ",", "'r'", ")", "as", "hf", ":", "head_contents", "=", "hf", ".", "read", "(", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.path_for_doc
Returns doc_dir and doc_filepath for doc_id.
peyotl/git_storage/git_action.py
def path_for_doc(self, doc_id): """Returns doc_dir and doc_filepath for doc_id. """ full_path = self.path_for_doc_fn(self.repo, doc_id) # _LOG.debug('>>>>>>>>>> GitActionBase.path_for_doc_fn: {}'.format(self.path_for_doc_fn)) # _LOG.debug('>>>>>>>>>> GitActionBase.path_for_doc re...
def path_for_doc(self, doc_id): """Returns doc_dir and doc_filepath for doc_id. """ full_path = self.path_for_doc_fn(self.repo, doc_id) # _LOG.debug('>>>>>>>>>> GitActionBase.path_for_doc_fn: {}'.format(self.path_for_doc_fn)) # _LOG.debug('>>>>>>>>>> GitActionBase.path_for_doc re...
[ "Returns", "doc_dir", "and", "doc_filepath", "for", "doc_id", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L143-L149
[ "def", "path_for_doc", "(", "self", ",", "doc_id", ")", ":", "full_path", "=", "self", ".", "path_for_doc_fn", "(", "self", ".", "repo", ",", "doc_id", ")", "# _LOG.debug('>>>>>>>>>> GitActionBase.path_for_doc_fn: {}'.format(self.path_for_doc_fn))", "# _LOG.debug('>>>>>>>>>...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.current_branch
Return the current branch name
peyotl/git_storage/git_action.py
def current_branch(self): """Return the current branch name""" branch_name = git(self.gitdir, self.gitwd, "symbolic-ref", "HEAD") return branch_name.replace('refs/heads/', '').strip()
def current_branch(self): """Return the current branch name""" branch_name = git(self.gitdir, self.gitwd, "symbolic-ref", "HEAD") return branch_name.replace('refs/heads/', '').strip()
[ "Return", "the", "current", "branch", "name" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L169-L172
[ "def", "current_branch", "(", "self", ")", ":", "branch_name", "=", "git", "(", "self", ".", "gitdir", ",", "self", ".", "gitwd", ",", "\"symbolic-ref\"", ",", "\"HEAD\"", ")", "return", "branch_name", ".", "replace", "(", "'refs/heads/'", ",", "''", ")", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.branch_exists
Returns true or false depending on if a branch exists
peyotl/git_storage/git_action.py
def branch_exists(self, branch): """Returns true or false depending on if a branch exists""" try: git(self.gitdir, self.gitwd, "rev-parse", branch) except sh.ErrorReturnCode: return False return True
def branch_exists(self, branch): """Returns true or false depending on if a branch exists""" try: git(self.gitdir, self.gitwd, "rev-parse", branch) except sh.ErrorReturnCode: return False return True
[ "Returns", "true", "or", "false", "depending", "on", "if", "a", "branch", "exists" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L174-L180
[ "def", "branch_exists", "(", "self", ",", "branch", ")", ":", "try", ":", "git", "(", "self", ".", "gitdir", ",", "self", ".", "gitwd", ",", "\"rev-parse\"", ",", "branch", ")", "except", "sh", ".", "ErrorReturnCode", ":", "return", "False", "return", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.fetch
fetch from a remote
peyotl/git_storage/git_action.py
def fetch(self, remote='origin'): """fetch from a remote""" git(self.gitdir, "fetch", remote, _env=self.env())
def fetch(self, remote='origin'): """fetch from a remote""" git(self.gitdir, "fetch", remote, _env=self.env())
[ "fetch", "from", "a", "remote" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L204-L206
[ "def", "fetch", "(", "self", ",", "remote", "=", "'origin'", ")", ":", "git", "(", "self", ".", "gitdir", ",", "\"fetch\"", ",", "remote", ",", "_env", "=", "self", ".", "env", "(", ")", ")" ]
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.get_version_history_for_file
Return a dict representation of this file's commit history This uses specially formatted git-log output for easy parsing, as described here: http://blog.lost-theory.org/post/how-to-parse-git-log-output/ For a full list of available fields, see: http://linux.die.net/man/1/git-log
peyotl/git_storage/git_action.py
def get_version_history_for_file(self, filepath): """ Return a dict representation of this file's commit history This uses specially formatted git-log output for easy parsing, as described here: http://blog.lost-theory.org/post/how-to-parse-git-log-output/ For a full list of availab...
def get_version_history_for_file(self, filepath): """ Return a dict representation of this file's commit history This uses specially formatted git-log output for easy parsing, as described here: http://blog.lost-theory.org/post/how-to-parse-git-log-output/ For a full list of availab...
[ "Return", "a", "dict", "representation", "of", "this", "file", "s", "commit", "history" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L235-L273
[ "def", "get_version_history_for_file", "(", "self", ",", "filepath", ")", ":", "# define the desired fields for logout output, matching the order in these lists!", "GIT_COMMIT_FIELDS", "=", "[", "'id'", ",", "'author_name'", ",", "'author_email'", ",", "'date'", ",", "'date_I...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase._add_and_commit
Low level function used internally when you have an absolute filepath to add and commit
peyotl/git_storage/git_action.py
def _add_and_commit(self, doc_filepath, author, commit_msg): """Low level function used internally when you have an absolute filepath to add and commit""" try: git(self.gitdir, self.gitwd, "add", doc_filepath) git(self.gitdir, self.gitwd, "commit", author=author, message=commit_m...
def _add_and_commit(self, doc_filepath, author, commit_msg): """Low level function used internally when you have an absolute filepath to add and commit""" try: git(self.gitdir, self.gitwd, "add", doc_filepath) git(self.gitdir, self.gitwd, "commit", author=author, message=commit_m...
[ "Low", "level", "function", "used", "internally", "when", "you", "have", "an", "absolute", "filepath", "to", "add", "and", "commit" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L275-L288
[ "def", "_add_and_commit", "(", "self", ",", "doc_filepath", ",", "author", ",", "commit_msg", ")", ":", "try", ":", "git", "(", "self", ".", "gitdir", ",", "self", ".", "gitwd", ",", "\"add\"", ",", "doc_filepath", ")", "git", "(", "self", ".", "gitdir...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.merge
Merge the the given WIP branch to master (or destination, if specified) If the merge fails, the merge will be aborted and then a MergeException will be thrown. The message of the MergeException will be the "git status" output, so details about merge conflicts can be determined.
peyotl/git_storage/git_action.py
def merge(self, branch, destination="master"): """ Merge the the given WIP branch to master (or destination, if specified) If the merge fails, the merge will be aborted and then a MergeException will be thrown. The message of the MergeException will be the "git status" o...
def merge(self, branch, destination="master"): """ Merge the the given WIP branch to master (or destination, if specified) If the merge fails, the merge will be aborted and then a MergeException will be thrown. The message of the MergeException will be the "git status" o...
[ "Merge", "the", "the", "given", "WIP", "branch", "to", "master", "(", "or", "destination", "if", "specified", ")" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L290-L314
[ "def", "merge", "(", "self", ",", "branch", ",", "destination", "=", "\"master\"", ")", ":", "current_branch", "=", "self", ".", "current_branch", "(", ")", "if", "current_branch", "!=", "destination", ":", "_LOG", ".", "debug", "(", "'checking out '", "+", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.return_document
Return the blob[0] contents of the given doc_id, blob[1] the SHA1 of the HEAD of branch (or `commit_sha`) blob[2] dictionary of WIPs for this doc. If the doc_id does not exist, it returns the empty string. If `commit_sha` is provided, that will be checked out and retu...
peyotl/git_storage/git_action.py
def return_document(self, doc_id, branch='master', commit_sha=None, return_WIP_map=False): """Return the blob[0] contents of the given doc_id, blob[1] the SHA1 of the HEAD of branch (or `commit_sha`) blob[2] dictionary of WIPs for this doc. If the doc_id does not exis...
def return_document(self, doc_id, branch='master', commit_sha=None, return_WIP_map=False): """Return the blob[0] contents of the given doc_id, blob[1] the SHA1 of the HEAD of branch (or `commit_sha`) blob[2] dictionary of WIPs for this doc. If the doc_id does not exis...
[ "Return", "the", "blob", "[", "0", "]", "contents", "of", "the", "given", "doc_id", "blob", "[", "1", "]", "the", "SHA1", "of", "the", "HEAD", "of", "branch", "(", "or", "commit_sha", ")", "blob", "[", "2", "]", "dictionary", "of", "WIPs", "for", "...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L316-L341
[ "def", "return_document", "(", "self", ",", "doc_id", ",", "branch", "=", "'master'", ",", "commit_sha", "=", "None", ",", "return_WIP_map", "=", "False", ")", ":", "# _LOG.debug('return_document({s}, {b}, {c}...)'.format(s=doc_id, b=branch, c=commit_sha))", "if", "commit...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase._get_changed_docs
Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) 'doc_id_from_repo_path' is a required function if `doc_ids_to_check` is passed in, it should be an iterable list of IDs. Only IDs in this list will be returned.
peyotl/git_storage/git_action.py
def _get_changed_docs(self, ancestral_commit_sha, doc_id_from_repo_path, doc_ids_to_check=None): """Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) ...
def _get_changed_docs(self, ancestral_commit_sha, doc_id_from_repo_path, doc_ids_to_check=None): """Returns the set of documents that have changed on the master since commit `ancestral_commit_sha` or `False` (on an error) ...
[ "Returns", "the", "set", "of", "documents", "that", "have", "changed", "on", "the", "master", "since", "commit", "ancestral_commit_sha", "or", "False", "(", "on", "an", "error", ")" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L343-L375
[ "def", "_get_changed_docs", "(", "self", ",", "ancestral_commit_sha", ",", "doc_id_from_repo_path", ",", "doc_ids_to_check", "=", "None", ")", ":", "try", ":", "x", "=", "git", "(", "self", ".", "gitdir", ",", "self", ".", "gitwd", ",", "\"diff-tree\"", ",",...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase._remove_document
Remove a document Remove a document on the given branch and attribute the commit to author. Returns the SHA of the commit on branch.
peyotl/git_storage/git_action.py
def _remove_document(self, gh_user, doc_id, parent_sha, author, commit_msg=None): """Remove a document Remove a document on the given branch and attribute the commit to author. Returns the SHA of the commit on branch. """ # _LOG.debug("@@@@@@@@ GitActionBase._remove_document, doc...
def _remove_document(self, gh_user, doc_id, parent_sha, author, commit_msg=None): """Remove a document Remove a document on the given branch and attribute the commit to author. Returns the SHA of the commit on branch. """ # _LOG.debug("@@@@@@@@ GitActionBase._remove_document, doc...
[ "Remove", "a", "document", "Remove", "a", "document", "on", "the", "given", "branch", "and", "attribute", "the", "commit", "to", "author", ".", "Returns", "the", "SHA", "of", "the", "commit", "on", "branch", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L429-L465
[ "def", "_remove_document", "(", "self", ",", "gh_user", ",", "doc_id", ",", "parent_sha", ",", "author", ",", "commit_msg", "=", "None", ")", ":", "# _LOG.debug(\"@@@@@@@@ GitActionBase._remove_document, doc_id={}\".format(doc_id))", "doc_filepath", "=", "self", ".", "p...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.write_document
Given a document id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master...
peyotl/git_storage/git_action.py
def write_document(self, gh_user, doc_id, file_content, branch, author, commit_msg=None): """Given a document id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master... """ parent_sha = None fc = tempfile.NamedTempora...
def write_document(self, gh_user, doc_id, file_content, branch, author, commit_msg=None): """Given a document id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master... """ parent_sha = None fc = tempfile.NamedTempora...
[ "Given", "a", "document", "id", "temporary", "filename", "of", "content", "branch", "and", "auth_info" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L467-L516
[ "def", "write_document", "(", "self", ",", "gh_user", ",", "doc_id", ",", "file_content", ",", "branch", ",", "author", ",", "commit_msg", "=", "None", ")", ":", "parent_sha", "=", "None", "fc", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "# N.B....
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
GitActionBase.write_doc_from_tmpfile
Given a doc_id, temporary filename of content, branch and auth_info
peyotl/git_storage/git_action.py
def write_doc_from_tmpfile(self, doc_id, tmpfi, parent_sha, auth_info, commit_msg='', doctype_display_name="document"): """Giv...
def write_doc_from_tmpfile(self, doc_id, tmpfi, parent_sha, auth_info, commit_msg='', doctype_display_name="document"): """Giv...
[ "Given", "a", "doc_id", "temporary", "filename", "of", "content", "branch", "and", "auth_info" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_action.py#L518-L559
[ "def", "write_doc_from_tmpfile", "(", "self", ",", "doc_id", ",", "tmpfi", ",", "parent_sha", ",", "auth_info", ",", "commit_msg", "=", "''", ",", "doctype_display_name", "=", "\"document\"", ")", ":", "gh_user", ",", "author", "=", "get_user_author", "(", "au...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
DictDiff.create
Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns None if there is no difference and a DictDiffObject of there are differences **kwargs can contain: wrap_dict_in_list default False. If True and one value is present as a lis...
peyotl/struct_diff.py
def create(src, dest, **kwargs): """Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns None if there is no difference and a DictDiffObject of there are differences **kwargs can contain: wrap_dict_in_list default False. If True and o...
def create(src, dest, **kwargs): """Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns None if there is no difference and a DictDiffObject of there are differences **kwargs can contain: wrap_dict_in_list default False. If True and o...
[ "Inefficient", "comparison", "of", "src", "and", "dest", "dicts", ".", "Recurses", "through", "dict", "and", "lists", ".", "returns", "None", "if", "there", "is", "no", "difference", "and", "a", "DictDiffObject", "of", "there", "are", "differences", "**", "k...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/struct_diff.py#L70-L114
[ "def", "create", "(", "src", ",", "dest", ",", "*", "*", "kwargs", ")", ":", "if", "src", "==", "dest", ":", "return", "None", "ddo", "=", "DictDiff", "(", ")", "sk", "=", "set", "(", "src", ".", "keys", "(", ")", ")", "dk", "=", "set", "(", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
ListDiff.create
Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns (is_identical, modifications, additions, deletions) where each is_identical is a boolean True if the dicts have contents that compare equal. and the other three are dicts: ...
peyotl/struct_diff.py
def create(src, dest, **kwargs): """Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns (is_identical, modifications, additions, deletions) where each is_identical is a boolean True if the dicts have contents that compare equ...
def create(src, dest, **kwargs): """Inefficient comparison of src and dest dicts. Recurses through dict and lists. returns (is_identical, modifications, additions, deletions) where each is_identical is a boolean True if the dicts have contents that compare equ...
[ "Inefficient", "comparison", "of", "src", "and", "dest", "dicts", ".", "Recurses", "through", "dict", "and", "lists", ".", "returns", "(", "is_identical", "modifications", "additions", "deletions", ")", "where", "each", "is_identical", "is", "a", "boolean", "Tru...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/struct_diff.py#L124-L183
[ "def", "create", "(", "src", ",", "dest", ",", "*", "*", "kwargs", ")", ":", "if", "src", "==", "dest", ":", "return", "None", "trivial_order", "=", "[", "(", "i", ",", "i", ")", "for", "i", "in", "range", "(", "min", "(", "len", "(", "src", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
_TNRSServicesWrapper.match_names
performs taxonomic name resolution. See https://github.com/OpenTreeOfLife/opentree/wiki/Open-Tree-of-Life-APIs#match_names with the exception that "ids" in the API call is referred has the name "id_list" in this function. The most commonly used kwargs are: - context_name=<name> (see ...
peyotl/api/wrapper.py
def match_names(self, *valist, **kwargs): """performs taxonomic name resolution. See https://github.com/OpenTreeOfLife/opentree/wiki/Open-Tree-of-Life-APIs#match_names with the exception that "ids" in the API call is referred has the name "id_list" in this function. The most commonly use...
def match_names(self, *valist, **kwargs): """performs taxonomic name resolution. See https://github.com/OpenTreeOfLife/opentree/wiki/Open-Tree-of-Life-APIs#match_names with the exception that "ids" in the API call is referred has the name "id_list" in this function. The most commonly use...
[ "performs", "taxonomic", "name", "resolution", ".", "See", "https", ":", "//", "github", ".", "com", "/", "OpenTreeOfLife", "/", "opentree", "/", "wiki", "/", "Open", "-", "Tree", "-", "of", "-", "Life", "-", "APIs#match_names", "with", "the", "exception",...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/api/wrapper.py#L352-L366
[ "def", "match_names", "(", "self", ",", "*", "valist", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "valist", ")", "==", "1", ":", "if", "not", "is_str_type", "(", "valist", "[", "0", "]", ")", ":", "return", "self", ".", "taxomachine", "...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TaxonomicAmendmentsGitAction.remove_amendment
Remove an amendment Given a amendment_id, branch and optionally an author, remove an amendment on the given branch and attribute the commit to author. Returns the SHA of the commit on branch.
peyotl/amendments/git_actions.py
def remove_amendment(self, first_arg, sec_arg, third_arg, fourth_arg=None, commit_msg=None): """Remove an amendment Given a amendment_id, branch and optionally an author, remove an amendment on the given branch and attribute the commit to author. Returns the SHA of the commit on ...
def remove_amendment(self, first_arg, sec_arg, third_arg, fourth_arg=None, commit_msg=None): """Remove an amendment Given a amendment_id, branch and optionally an author, remove an amendment on the given branch and attribute the commit to author. Returns the SHA of the commit on ...
[ "Remove", "an", "amendment", "Given", "a", "amendment_id", "branch", "and", "optionally", "an", "author", "remove", "an", "amendment", "on", "the", "given", "branch", "and", "attribute", "the", "commit", "to", "author", ".", "Returns", "the", "SHA", "of", "t...
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/amendments/git_actions.py#L92-L107
[ "def", "remove_amendment", "(", "self", ",", "first_arg", ",", "sec_arg", ",", "third_arg", ",", "fourth_arg", "=", "None", ",", "commit_msg", "=", "None", ")", ":", "if", "fourth_arg", "is", "None", ":", "amendment_id", ",", "branch_name", ",", "author", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TaxonomicAmendmentsGitAction.write_amendment
Given an amendment_id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master...
peyotl/amendments/git_actions.py
def write_amendment(self, amendment_id, file_content, branch, author): """Given an amendment_id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master... """ gh_user = branch.split('_amendment_')[0] msg = "Update Amendm...
def write_amendment(self, amendment_id, file_content, branch, author): """Given an amendment_id, temporary filename of content, branch and auth_info Deprecated but needed until we merge api local-dep to master... """ gh_user = branch.split('_amendment_')[0] msg = "Update Amendm...
[ "Given", "an", "amendment_id", "temporary", "filename", "of", "content", "branch", "and", "auth_info" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/amendments/git_actions.py#L109-L121
[ "def", "write_amendment", "(", "self", ",", "amendment_id", ",", "file_content", ",", "branch", ",", "author", ")", ":", "gh_user", "=", "branch", ".", "split", "(", "'_amendment_'", ")", "[", "0", "]", "msg", "=", "\"Update Amendment '%s' via OpenTree API\"", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TaxonomicAmendmentsGitAction.write_amendment_from_tmpfile
Given an amendment_id, temporary filename of content, branch and auth_info
peyotl/amendments/git_actions.py
def write_amendment_from_tmpfile(self, amendment_id, tmpfi, parent_sha, auth_info, commit_msg=''): """Given an amendment_id, temporary filename of content, branch and auth_info """ return self.write_doc_from_tmpfile(amendment_id, tmpfi, ...
def write_amendment_from_tmpfile(self, amendment_id, tmpfi, parent_sha, auth_info, commit_msg=''): """Given an amendment_id, temporary filename of content, branch and auth_info """ return self.write_doc_from_tmpfile(amendment_id, tmpfi, ...
[ "Given", "an", "amendment_id", "temporary", "filename", "of", "content", "branch", "and", "auth_info" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/amendments/git_actions.py#L123-L131
[ "def", "write_amendment_from_tmpfile", "(", "self", ",", "amendment_id", ",", "tmpfi", ",", "parent_sha", ",", "auth_info", ",", "commit_msg", "=", "''", ")", ":", "return", "self", ".", "write_doc_from_tmpfile", "(", "amendment_id", ",", "tmpfi", ",", "parent_s...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
JSGArrayExpr.visitArrayExpr
arrayExpr: OBRACKET valueType (BAR valueType)* ebnfSuffix? CBRACKET;
pyjsg/parser_impl/jsg_arrayexpr_parser.py
def visitArrayExpr(self, ctx: jsgParser.ArrayExprContext): """ arrayExpr: OBRACKET valueType (BAR valueType)* ebnfSuffix? CBRACKET; """ from pyjsg.parser_impl.jsg_ebnf_parser import JSGEbnf from pyjsg.parser_impl.jsg_valuetype_parser import JSGValueType self._types = [JSGValueType(self....
def visitArrayExpr(self, ctx: jsgParser.ArrayExprContext): """ arrayExpr: OBRACKET valueType (BAR valueType)* ebnfSuffix? CBRACKET; """ from pyjsg.parser_impl.jsg_ebnf_parser import JSGEbnf from pyjsg.parser_impl.jsg_valuetype_parser import JSGValueType self._types = [JSGValueType(self....
[ "arrayExpr", ":", "OBRACKET", "valueType", "(", "BAR", "valueType", ")", "*", "ebnfSuffix?", "CBRACKET", ";" ]
hsolbrig/pyjsg
python
https://github.com/hsolbrig/pyjsg/blob/9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7/pyjsg/parser_impl/jsg_arrayexpr_parser.py#L61-L68
[ "def", "visitArrayExpr", "(", "self", ",", "ctx", ":", "jsgParser", ".", "ArrayExprContext", ")", ":", "from", "pyjsg", ".", "parser_impl", ".", "jsg_ebnf_parser", "import", "JSGEbnf", "from", "pyjsg", ".", "parser_impl", ".", "jsg_valuetype_parser", "import", "...
9b2b8fa8e3b8448abe70b09f804a79f0f31b32b7
train
GitShard.get_rel_path_fragment
For `doc_id` returns the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path.
peyotl/git_storage/git_shard.py
def get_rel_path_fragment(self, doc_id): """For `doc_id` returns the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path. """ with self._index_lock: r = self._doc_index[doc_id] fp = r[-1] ...
def get_rel_path_fragment(self, doc_id): """For `doc_id` returns the path from the repo to the doc file. This is useful because (if you know the remote), it lets you construct the full path. """ with self._index_lock: r = self._doc_index[doc_id] fp = r[-1] ...
[ "For", "doc_id", "returns", "the", "path", "from", "the", "repo", "to", "the", "doc", "file", ".", "This", "is", "useful", "because", "(", "if", "you", "know", "the", "remote", ")", "it", "lets", "you", "construct", "the", "full", "path", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L28-L36
[ "def", "get_rel_path_fragment", "(", "self", ",", "doc_id", ")", ":", "with", "self", ".", "_index_lock", ":", "r", "=", "self", ".", "_doc_index", "[", "doc_id", "]", "fp", "=", "r", "[", "-", "1", "]", "return", "fp", "[", "(", "len", "(", "self"...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TypeAwareGitShard.iter_doc_filepaths
Returns a pair: (doc_id, absolute filepath of document file) for each document in this repository. Order is arbitrary.
peyotl/git_storage/git_shard.py
def iter_doc_filepaths(self, **kwargs): # pylint: disable=W0613 """Returns a pair: (doc_id, absolute filepath of document file) for each document in this repository. Order is arbitrary. """ with self._index_lock: for doc_id, info in self._doc_index.items(): ...
def iter_doc_filepaths(self, **kwargs): # pylint: disable=W0613 """Returns a pair: (doc_id, absolute filepath of document file) for each document in this repository. Order is arbitrary. """ with self._index_lock: for doc_id, info in self._doc_index.items(): ...
[ "Returns", "a", "pair", ":", "(", "doc_id", "absolute", "filepath", "of", "document", "file", ")", "for", "each", "document", "in", "this", "repository", ".", "Order", "is", "arbitrary", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L191-L199
[ "def", "iter_doc_filepaths", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=W0613", "with", "self", ".", "_index_lock", ":", "for", "doc_id", ",", "info", "in", "self", ".", "_doc_index", ".", "items", "(", ")", ":", "if", "not", "sel...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TypeAwareGitShard.iter_doc_objs
Returns a pair: (doc_id, nexson_blob) for each document in this repository. Order is arbitrary.
peyotl/git_storage/git_shard.py
def iter_doc_objs(self, **kwargs): """Returns a pair: (doc_id, nexson_blob) for each document in this repository. Order is arbitrary. """ _LOG = get_logger('TypeAwareGitShard') try: for doc_id, fp in self.iter_doc_filepaths(**kwargs): if not se...
def iter_doc_objs(self, **kwargs): """Returns a pair: (doc_id, nexson_blob) for each document in this repository. Order is arbitrary. """ _LOG = get_logger('TypeAwareGitShard') try: for doc_id, fp in self.iter_doc_filepaths(**kwargs): if not se...
[ "Returns", "a", "pair", ":", "(", "doc_id", "nexson_blob", ")", "for", "each", "document", "in", "this", "repository", ".", "Order", "is", "arbitrary", "." ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L202-L221
[ "def", "iter_doc_objs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "_LOG", "=", "get_logger", "(", "'TypeAwareGitShard'", ")", "try", ":", "for", "doc_id", ",", "fp", "in", "self", ".", "iter_doc_filepaths", "(", "*", "*", "kwargs", ")", ":", "if"...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TypeAwareGitShard.get_configuration_dict
Generic configuration, may be overridden by type-specific version
peyotl/git_storage/git_shard.py
def get_configuration_dict(self, secret_attrs=False): """Generic configuration, may be overridden by type-specific version""" rd = {'name': self.name, 'path': self.path, 'git_dir': self.git_dir, 'assumed_doc_version': self.assumed_doc_version, 'doc...
def get_configuration_dict(self, secret_attrs=False): """Generic configuration, may be overridden by type-specific version""" rd = {'name': self.name, 'path': self.path, 'git_dir': self.git_dir, 'assumed_doc_version': self.assumed_doc_version, 'doc...
[ "Generic", "configuration", "may", "be", "overridden", "by", "type", "-", "specific", "version" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L235-L259
[ "def", "get_configuration_dict", "(", "self", ",", "secret_attrs", "=", "False", ")", ":", "rd", "=", "{", "'name'", ":", "self", ".", "name", ",", "'path'", ":", "self", ".", "path", ",", "'git_dir'", ":", "self", ".", "git_dir", ",", "'assumed_doc_vers...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TypeAwareGitShard._read_master_branch_resource
This will force the current branch to master!
peyotl/git_storage/git_shard.py
def _read_master_branch_resource(self, fn, is_json=False): """This will force the current branch to master! """ with self._master_branch_repo_lock: ga = self._create_git_action_for_global_resource() with ga.lock(): ga.checkout_master() if os.path.e...
def _read_master_branch_resource(self, fn, is_json=False): """This will force the current branch to master! """ with self._master_branch_repo_lock: ga = self._create_git_action_for_global_resource() with ga.lock(): ga.checkout_master() if os.path.e...
[ "This", "will", "force", "the", "current", "branch", "to", "master!" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L275-L287
[ "def", "_read_master_branch_resource", "(", "self", ",", "fn", ",", "is_json", "=", "False", ")", ":", "with", "self", ".", "_master_branch_repo_lock", ":", "ga", "=", "self", ".", "_create_git_action_for_global_resource", "(", ")", "with", "ga", ".", "lock", ...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
TypeAwareGitShard._write_master_branch_resource
This will force the current branch to master!
peyotl/git_storage/git_shard.py
def _write_master_branch_resource(self, content, fn, commit_msg, is_json=False): """This will force the current branch to master! """ # TODO: we might want this to push, but currently it is only called in contexts in which # we are about to push anyway (document creation) with self._mast...
def _write_master_branch_resource(self, content, fn, commit_msg, is_json=False): """This will force the current branch to master! """ # TODO: we might want this to push, but currently it is only called in contexts in which # we are about to push anyway (document creation) with self._mast...
[ "This", "will", "force", "the", "current", "branch", "to", "master!" ]
OpenTreeOfLife/peyotl
python
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/git_storage/git_shard.py#L289-L301
[ "def", "_write_master_branch_resource", "(", "self", ",", "content", ",", "fn", ",", "commit_msg", ",", "is_json", "=", "False", ")", ":", "# TODO: we might want this to push, but currently it is only called in contexts in which", "# we are about to push anyway (document creation)"...
5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0
train
InclusionRequest.create
Create a record inclusion request to a community. :param community: Community object. :param record: Record API object. :param expires_at: Time after which the request expires and shouldn't be resolved anymore.
invenio_communities/models.py
def create(cls, community, record, user=None, expires_at=None, notify=True): """Create a record inclusion request to a community. :param community: Community object. :param record: Record API object. :param expires_at: Time after which the request expires and shouldn't ...
def create(cls, community, record, user=None, expires_at=None, notify=True): """Create a record inclusion request to a community. :param community: Community object. :param record: Record API object. :param expires_at: Time after which the request expires and shouldn't ...
[ "Create", "a", "record", "inclusion", "request", "to", "a", "community", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L114-L152
[ "def", "create", "(", "cls", ",", "community", ",", "record", ",", "user", "=", "None", ",", "expires_at", "=", "None", ",", "notify", "=", "True", ")", ":", "if", "expires_at", "and", "expires_at", "<", "datetime", ".", "utcnow", "(", ")", ":", "rai...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
InclusionRequest.get
Get an inclusion request.
invenio_communities/models.py
def get(cls, community_id, record_uuid): """Get an inclusion request.""" return cls.query.filter_by( id_record=record_uuid, id_community=community_id ).one_or_none()
def get(cls, community_id, record_uuid): """Get an inclusion request.""" return cls.query.filter_by( id_record=record_uuid, id_community=community_id ).one_or_none()
[ "Get", "an", "inclusion", "request", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L155-L159
[ "def", "get", "(", "cls", ",", "community_id", ",", "record_uuid", ")", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "id_record", "=", "record_uuid", ",", "id_community", "=", "community_id", ")", ".", "one_or_none", "(", ")" ]
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
Community.create
Get a community.
invenio_communities/models.py
def create(cls, community_id, user_id, **data): """Get a community.""" with db.session.begin_nested(): obj = cls(id=community_id, id_user=user_id, **data) db.session.add(obj) return obj
def create(cls, community_id, user_id, **data): """Get a community.""" with db.session.begin_nested(): obj = cls(id=community_id, id_user=user_id, **data) db.session.add(obj) return obj
[ "Get", "a", "community", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L222-L227
[ "def", "create", "(", "cls", ",", "community_id", ",", "user_id", ",", "*", "*", "data", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "obj", "=", "cls", "(", "id", "=", "community_id", ",", "id_user", "=", "user_id", ...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
Community.save_logo
Get a community.
invenio_communities/models.py
def save_logo(self, stream, filename): """Get a community.""" logo_ext = save_and_validate_logo(stream, filename, self.id) if logo_ext: self.logo_ext = logo_ext return True return False
def save_logo(self, stream, filename): """Get a community.""" logo_ext = save_and_validate_logo(stream, filename, self.id) if logo_ext: self.logo_ext = logo_ext return True return False
[ "Get", "a", "community", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L229-L235
[ "def", "save_logo", "(", "self", ",", "stream", ",", "filename", ")", ":", "logo_ext", "=", "save_and_validate_logo", "(", "stream", ",", "filename", ",", "self", ".", "id", ")", "if", "logo_ext", ":", "self", ".", "logo_ext", "=", "logo_ext", "return", ...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
Community.get
Get a community.
invenio_communities/models.py
def get(cls, community_id, with_deleted=False): """Get a community.""" q = cls.query.filter_by(id=community_id) if not with_deleted: q = q.filter(cls.deleted_at.is_(None)) return q.one_or_none()
def get(cls, community_id, with_deleted=False): """Get a community.""" q = cls.query.filter_by(id=community_id) if not with_deleted: q = q.filter(cls.deleted_at.is_(None)) return q.one_or_none()
[ "Get", "a", "community", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L238-L243
[ "def", "get", "(", "cls", ",", "community_id", ",", "with_deleted", "=", "False", ")", ":", "q", "=", "cls", ".", "query", ".", "filter_by", "(", "id", "=", "community_id", ")", "if", "not", "with_deleted", ":", "q", "=", "q", ".", "filter", "(", "...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
Community.get_by_user
Get a community.
invenio_communities/models.py
def get_by_user(cls, user_id, with_deleted=False): """Get a community.""" query = cls.query.filter_by( id_user=user_id ) if not with_deleted: query = query.filter(cls.deleted_at.is_(None)) return query.order_by(db.asc(Community.title))
def get_by_user(cls, user_id, with_deleted=False): """Get a community.""" query = cls.query.filter_by( id_user=user_id ) if not with_deleted: query = query.filter(cls.deleted_at.is_(None)) return query.order_by(db.asc(Community.title))
[ "Get", "a", "community", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L246-L254
[ "def", "get_by_user", "(", "cls", ",", "user_id", ",", "with_deleted", "=", "False", ")", ":", "query", "=", "cls", ".", "query", ".", "filter_by", "(", "id_user", "=", "user_id", ")", "if", "not", "with_deleted", ":", "query", "=", "query", ".", "filt...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a
train
Community.filter_communities
Search for communities. Helper function which takes from database only those communities which match search criteria. Uses parameter 'so' to set communities in the correct order. Parameter 'page' is introduced to restrict results and return only slice of them for the current pa...
invenio_communities/models.py
def filter_communities(cls, p, so, with_deleted=False): """Search for communities. Helper function which takes from database only those communities which match search criteria. Uses parameter 'so' to set communities in the correct order. Parameter 'page' is introduced to restri...
def filter_communities(cls, p, so, with_deleted=False): """Search for communities. Helper function which takes from database only those communities which match search criteria. Uses parameter 'so' to set communities in the correct order. Parameter 'page' is introduced to restri...
[ "Search", "for", "communities", "." ]
inveniosoftware/invenio-communities
python
https://github.com/inveniosoftware/invenio-communities/blob/5c4de6783724d276ae1b6dd13a399a9e22fadc7a/invenio_communities/models.py#L257-L284
[ "def", "filter_communities", "(", "cls", ",", "p", ",", "so", ",", "with_deleted", "=", "False", ")", ":", "query", "=", "cls", ".", "query", "if", "with_deleted", "else", "cls", ".", "query", ".", "filter", "(", "cls", ".", "deleted_at", ".", "is_", ...
5c4de6783724d276ae1b6dd13a399a9e22fadc7a