repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
delfick/harpoon
harpoon/option_spec/image_objs.py
ContainerPort.port_pair
def port_pair(self): """The port and it's transport as a pair""" if self.transport is NotSpecified: return (self.port, "tcp") else: return (self.port, self.transport)
python
def port_pair(self): """The port and it's transport as a pair""" if self.transport is NotSpecified: return (self.port, "tcp") else: return (self.port, self.transport)
[ "def", "port_pair", "(", "self", ")", ":", "if", "self", ".", "transport", "is", "NotSpecified", ":", "return", "(", "self", ".", "port", ",", "\"tcp\"", ")", "else", ":", "return", "(", "self", ".", "port", ",", "self", ".", "transport", ")" ]
The port and it's transport as a pair
[ "The", "port", "and", "it", "s", "transport", "as", "a", "pair" ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/image_objs.py#L524-L529
delfick/harpoon
harpoon/option_spec/image_objs.py
ContainerPort.port_str
def port_str(self): """The port and it's transport as a single string""" if self.transport is NotSpecified: return str(self.port) else: return "{0}/{1}".format(self.port, self.transport)
python
def port_str(self): """The port and it's transport as a single string""" if self.transport is NotSpecified: return str(self.port) else: return "{0}/{1}".format(self.port, self.transport)
[ "def", "port_str", "(", "self", ")", ":", "if", "self", ".", "transport", "is", "NotSpecified", ":", "return", "str", "(", "self", ".", "port", ")", "else", ":", "return", "\"{0}/{1}\"", ".", "format", "(", "self", ".", "port", ",", "self", ".", "tra...
The port and it's transport as a single string
[ "The", "port", "and", "it", "s", "transport", "as", "a", "single", "string" ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/image_objs.py#L532-L537
theosysbio/means
src/means/inference/distances.py
get_distance_function
def get_distance_function(distance): """ Returns the distance function from the string name provided :param distance: The string name of the distributions :return: """ # If we provided distance function ourselves, use it if callable(distance): return distance try: return...
python
def get_distance_function(distance): """ Returns the distance function from the string name provided :param distance: The string name of the distributions :return: """ # If we provided distance function ourselves, use it if callable(distance): return distance try: return...
[ "def", "get_distance_function", "(", "distance", ")", ":", "# If we provided distance function ourselves, use it", "if", "callable", "(", "distance", ")", ":", "return", "distance", "try", ":", "return", "_supported_distances_lookup", "(", ")", "[", "distance", "]", "...
Returns the distance function from the string name provided :param distance: The string name of the distributions :return:
[ "Returns", "the", "distance", "function", "from", "the", "string", "name", "provided" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/inference/distances.py#L21-L34
theosysbio/means
src/means/inference/distances.py
sum_of_squares
def sum_of_squares(simulated_trajectories, observed_trajectories_lookup): """ Returns the sum-of-squares distance between the simulated_trajectories and observed_trajectories :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means.simulation.Trajectory`] ...
python
def sum_of_squares(simulated_trajectories, observed_trajectories_lookup): """ Returns the sum-of-squares distance between the simulated_trajectories and observed_trajectories :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means.simulation.Trajectory`] ...
[ "def", "sum_of_squares", "(", "simulated_trajectories", ",", "observed_trajectories_lookup", ")", ":", "dist", "=", "0", "for", "simulated_trajectory", "in", "simulated_trajectories", ":", "observed_trajectory", "=", "None", "try", ":", "observed_trajectory", "=", "obse...
Returns the sum-of-squares distance between the simulated_trajectories and observed_trajectories :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means.simulation.Trajectory`] :param observed_trajectories_lookup: A dictionary of (trajectory.description: traje...
[ "Returns", "the", "sum", "-", "of", "-", "squares", "distance", "between", "the", "simulated_trajectories", "and", "observed_trajectories" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/inference/distances.py#L36-L61
theosysbio/means
src/means/inference/distances.py
_distribution_distance
def _distribution_distance(simulated_trajectories, observed_trajectories_lookup, distribution): """ Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means....
python
def _distribution_distance(simulated_trajectories, observed_trajectories_lookup, distribution): """ Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means....
[ "def", "_distribution_distance", "(", "simulated_trajectories", ",", "observed_trajectories_lookup", ",", "distribution", ")", ":", "mean_variance_lookup", "=", "_compile_mean_variance_lookup", "(", "simulated_trajectories", ")", "# get moment expansion result with current parameters...
Returns the distance between the simulated and observed trajectory, w.r.t. the assumed distribution :param simulated_trajectories: Simulated trajectories :type simulated_trajectories: list[:class:`means.simulation.Trajectory`] :param observed_trajectories_lookup: A dictionary of (trajectory.description: tr...
[ "Returns", "the", "distance", "between", "the", "simulated", "and", "observed", "trajectory", "w", ".", "r", ".", "t", ".", "the", "assumed", "distribution" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/inference/distances.py#L104-L135
theosysbio/means
src/means/inference/distances.py
_eval_density
def _eval_density(means, variances,observed_values, distribution): """ Calculates gamma/lognormal/normal pdf given mean variance, x where x is the experimental species number measured at a particular timepoint. Returns ln(pdf) :param mean: mean :param var: variance :param observed_values: experi...
python
def _eval_density(means, variances,observed_values, distribution): """ Calculates gamma/lognormal/normal pdf given mean variance, x where x is the experimental species number measured at a particular timepoint. Returns ln(pdf) :param mean: mean :param var: variance :param observed_values: experi...
[ "def", "_eval_density", "(", "means", ",", "variances", ",", "observed_values", ",", "distribution", ")", ":", "means", "=", "np", ".", "array", "(", "means", ",", "dtype", "=", "NP_FLOATING_POINT_PRECISION", ")", "variances", "=", "np", ".", "array", "(", ...
Calculates gamma/lognormal/normal pdf given mean variance, x where x is the experimental species number measured at a particular timepoint. Returns ln(pdf) :param mean: mean :param var: variance :param observed_values: experimental species number measured at a particular timepoint :param distributio...
[ "Calculates", "gamma", "/", "lognormal", "/", "normal", "pdf", "given", "mean", "variance", "x", "where", "x", "is", "the", "experimental", "species", "number", "measured", "at", "a", "particular", "timepoint", ".", "Returns", "ln", "(", "pdf", ")", ":", "...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/inference/distances.py#L163-L203
TechnicalBro/spiget
spiget/__init__.py
retrieve_author
def retrieve_author(id=None, username=None): """ Retrieve a SpigotAuthor via their id, or username. :param id: :param username: :return: """ if id is None and username is None: raise SpigotAuthorException("Unable to retrieve an Author without an Identifier") if id is None: ...
python
def retrieve_author(id=None, username=None): """ Retrieve a SpigotAuthor via their id, or username. :param id: :param username: :return: """ if id is None and username is None: raise SpigotAuthorException("Unable to retrieve an Author without an Identifier") if id is None: ...
[ "def", "retrieve_author", "(", "id", "=", "None", ",", "username", "=", "None", ")", ":", "if", "id", "is", "None", "and", "username", "is", "None", ":", "raise", "SpigotAuthorException", "(", "\"Unable to retrieve an Author without an Identifier\"", ")", "if", ...
Retrieve a SpigotAuthor via their id, or username. :param id: :param username: :return:
[ "Retrieve", "a", "SpigotAuthor", "via", "their", "id", "or", "username", ".", ":", "param", "id", ":", ":", "param", "username", ":", ":", "return", ":" ]
train
https://github.com/TechnicalBro/spiget/blob/fcc822cf0f0bb762a47d1f9f9cc6a574ff0e3eb0/spiget/__init__.py#L378-L392
linzhonghong/zapi
zapi/core/db.py
DB._escape_identifiers
def _escape_identifiers(self, item): """ This function escapes column and table names @param item: """ if self._escape_char == '': return item for field in self._reserved_identifiers: if item.find('.%s' % field) != -1: _str = "%s%s...
python
def _escape_identifiers(self, item): """ This function escapes column and table names @param item: """ if self._escape_char == '': return item for field in self._reserved_identifiers: if item.find('.%s' % field) != -1: _str = "%s%s...
[ "def", "_escape_identifiers", "(", "self", ",", "item", ")", ":", "if", "self", ".", "_escape_char", "==", "''", ":", "return", "item", "for", "field", "in", "self", ".", "_reserved_identifiers", ":", "if", "item", ".", "find", "(", "'.%s'", "%", "field"...
This function escapes column and table names @param item:
[ "This", "function", "escapes", "column", "and", "table", "names" ]
train
https://github.com/linzhonghong/zapi/blob/ac55c3ddbc4153561472faaf59fb72ef794f13a5/zapi/core/db.py#L524-L544
5monkeys/content-io
cio/backends/base.py
CacheBackend.get
def get(self, uri): """ Return node for uri or None if not exists: {uri: x, content: y} """ cache_key = self._build_cache_key(uri) value = self._get(cache_key) if value is not None: return self._decode_node(uri, value)
python
def get(self, uri): """ Return node for uri or None if not exists: {uri: x, content: y} """ cache_key = self._build_cache_key(uri) value = self._get(cache_key) if value is not None: return self._decode_node(uri, value)
[ "def", "get", "(", "self", ",", "uri", ")", ":", "cache_key", "=", "self", ".", "_build_cache_key", "(", "uri", ")", "value", "=", "self", ".", "_get", "(", "cache_key", ")", "if", "value", "is", "not", "None", ":", "return", "self", ".", "_decode_no...
Return node for uri or None if not exists: {uri: x, content: y}
[ "Return", "node", "for", "uri", "or", "None", "if", "not", "exists", ":", "{", "uri", ":", "x", "content", ":", "y", "}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L26-L34
5monkeys/content-io
cio/backends/base.py
CacheBackend.get_many
def get_many(self, uris): """ Return request uri map of found nodes as dicts: {requested_uri: {uri: x, content: y}} """ cache_keys = dict((self._build_cache_key(uri), uri) for uri in uris) result = self._get_many(cache_keys) nodes = {} for cache_key in...
python
def get_many(self, uris): """ Return request uri map of found nodes as dicts: {requested_uri: {uri: x, content: y}} """ cache_keys = dict((self._build_cache_key(uri), uri) for uri in uris) result = self._get_many(cache_keys) nodes = {} for cache_key in...
[ "def", "get_many", "(", "self", ",", "uris", ")", ":", "cache_keys", "=", "dict", "(", "(", "self", ".", "_build_cache_key", "(", "uri", ")", ",", "uri", ")", "for", "uri", "in", "uris", ")", "result", "=", "self", ".", "_get_many", "(", "cache_keys"...
Return request uri map of found nodes as dicts: {requested_uri: {uri: x, content: y}}
[ "Return", "request", "uri", "map", "of", "found", "nodes", "as", "dicts", ":", "{", "requested_uri", ":", "{", "uri", ":", "x", "content", ":", "y", "}}" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L36-L50
5monkeys/content-io
cio/backends/base.py
CacheBackend.set
def set(self, uri, content): """ Cache node content for uri. No return. """ key, value = self._prepare_node(uri, content) self._set(key, value)
python
def set(self, uri, content): """ Cache node content for uri. No return. """ key, value = self._prepare_node(uri, content) self._set(key, value)
[ "def", "set", "(", "self", ",", "uri", ",", "content", ")", ":", "key", ",", "value", "=", "self", ".", "_prepare_node", "(", "uri", ",", "content", ")", "self", ".", "_set", "(", "key", ",", "value", ")" ]
Cache node content for uri. No return.
[ "Cache", "node", "content", "for", "uri", ".", "No", "return", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L52-L58
5monkeys/content-io
cio/backends/base.py
CacheBackend.set_many
def set_many(self, nodes): """ Takes nodes dict {uri: content, ...} as argument. No return. """ data = self._prepare_nodes(nodes) self._set_many(data)
python
def set_many(self, nodes): """ Takes nodes dict {uri: content, ...} as argument. No return. """ data = self._prepare_nodes(nodes) self._set_many(data)
[ "def", "set_many", "(", "self", ",", "nodes", ")", ":", "data", "=", "self", ".", "_prepare_nodes", "(", "nodes", ")", "self", ".", "_set_many", "(", "data", ")" ]
Takes nodes dict {uri: content, ...} as argument. No return.
[ "Takes", "nodes", "dict", "{", "uri", ":", "content", "...", "}", "as", "argument", ".", "No", "return", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L60-L66
5monkeys/content-io
cio/backends/base.py
CacheBackend.delete
def delete(self, uri): """ Remove node uri from cache. No return. """ cache_key = self._build_cache_key(uri) self._delete(cache_key)
python
def delete(self, uri): """ Remove node uri from cache. No return. """ cache_key = self._build_cache_key(uri) self._delete(cache_key)
[ "def", "delete", "(", "self", ",", "uri", ")", ":", "cache_key", "=", "self", ".", "_build_cache_key", "(", "uri", ")", "self", ".", "_delete", "(", "cache_key", ")" ]
Remove node uri from cache. No return.
[ "Remove", "node", "uri", "from", "cache", ".", "No", "return", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L68-L74
5monkeys/content-io
cio/backends/base.py
CacheBackend.delete_many
def delete_many(self, uris): """ Remove many nodes from cache. No return. """ cache_keys = (self._build_cache_key(uri) for uri in uris) self._delete_many(cache_keys)
python
def delete_many(self, uris): """ Remove many nodes from cache. No return. """ cache_keys = (self._build_cache_key(uri) for uri in uris) self._delete_many(cache_keys)
[ "def", "delete_many", "(", "self", ",", "uris", ")", ":", "cache_keys", "=", "(", "self", ".", "_build_cache_key", "(", "uri", ")", "for", "uri", "in", "uris", ")", "self", ".", "_delete_many", "(", "cache_keys", ")" ]
Remove many nodes from cache. No return.
[ "Remove", "many", "nodes", "from", "cache", ".", "No", "return", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L76-L82
5monkeys/content-io
cio/backends/base.py
CacheBackend._build_cache_key
def _build_cache_key(self, uri): """ Build sha1 hex cache key to handle key length and whitespace to be compatible with Memcached """ key = uri.clone(ext=None, version=None) if six.PY3: key = key.encode('utf-8') return sha1(key).hexdigest()
python
def _build_cache_key(self, uri): """ Build sha1 hex cache key to handle key length and whitespace to be compatible with Memcached """ key = uri.clone(ext=None, version=None) if six.PY3: key = key.encode('utf-8') return sha1(key).hexdigest()
[ "def", "_build_cache_key", "(", "self", ",", "uri", ")", ":", "key", "=", "uri", ".", "clone", "(", "ext", "=", "None", ",", "version", "=", "None", ")", "if", "six", ".", "PY3", ":", "key", "=", "key", ".", "encode", "(", "'utf-8'", ")", "return...
Build sha1 hex cache key to handle key length and whitespace to be compatible with Memcached
[ "Build", "sha1", "hex", "cache", "key", "to", "handle", "key", "length", "and", "whitespace", "to", "be", "compatible", "with", "Memcached" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L90-L99
5monkeys/content-io
cio/backends/base.py
DatabaseBackend.get_many
def get_many(self, uris): """ Simple implementation, could be better implemented by backend not hitting db for every uri. """ nodes = {} for uri in uris: try: node = self.get(uri) except NodeDoesNotExist: continue ...
python
def get_many(self, uris): """ Simple implementation, could be better implemented by backend not hitting db for every uri. """ nodes = {} for uri in uris: try: node = self.get(uri) except NodeDoesNotExist: continue ...
[ "def", "get_many", "(", "self", ",", "uris", ")", ":", "nodes", "=", "{", "}", "for", "uri", "in", "uris", ":", "try", ":", "node", "=", "self", ".", "get", "(", "uri", ")", "except", "NodeDoesNotExist", ":", "continue", "else", ":", "nodes", "[", ...
Simple implementation, could be better implemented by backend not hitting db for every uri.
[ "Simple", "implementation", "could", "be", "better", "implemented", "by", "backend", "not", "hitting", "db", "for", "every", "uri", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L217-L232
5monkeys/content-io
cio/backends/base.py
DatabaseBackend.set
def set(self, uri, content, **meta): """ Dispatches private update/create handlers """ try: node = self._update(uri, content, **meta) created = False except NodeDoesNotExist: node = self._create(uri, content, **meta) created = True ...
python
def set(self, uri, content, **meta): """ Dispatches private update/create handlers """ try: node = self._update(uri, content, **meta) created = False except NodeDoesNotExist: node = self._create(uri, content, **meta) created = True ...
[ "def", "set", "(", "self", ",", "uri", ",", "content", ",", "*", "*", "meta", ")", ":", "try", ":", "node", "=", "self", ".", "_update", "(", "uri", ",", "content", ",", "*", "*", "meta", ")", "created", "=", "False", "except", "NodeDoesNotExist", ...
Dispatches private update/create handlers
[ "Dispatches", "private", "update", "/", "create", "handlers" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L234-L244
5monkeys/content-io
cio/backends/base.py
DatabaseBackend.delete_many
def delete_many(self, uris): """ Simple implementation, could be better implemented by backend not hitting db for every uri. """ deleted_nodes = {} for uri in uris: node = self.delete(uri) if node: deleted_nodes[uri] = node ...
python
def delete_many(self, uris): """ Simple implementation, could be better implemented by backend not hitting db for every uri. """ deleted_nodes = {} for uri in uris: node = self.delete(uri) if node: deleted_nodes[uri] = node ...
[ "def", "delete_many", "(", "self", ",", "uris", ")", ":", "deleted_nodes", "=", "{", "}", "for", "uri", "in", "uris", ":", "node", "=", "self", ".", "delete", "(", "uri", ")", "if", "node", ":", "deleted_nodes", "[", "uri", "]", "=", "node", "retur...
Simple implementation, could be better implemented by backend not hitting db for every uri.
[ "Simple", "implementation", "could", "be", "better", "implemented", "by", "backend", "not", "hitting", "db", "for", "every", "uri", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L257-L269
5monkeys/content-io
cio/backends/base.py
DatabaseBackend._serialize
def _serialize(self, uri, node): """ Serialize node result as dict """ meta = self._decode_meta(node['meta'], is_published=bool(node['is_published'])) return { 'uri': uri.clone(ext=node['plugin'], version=node['version']), 'content': node['content'], ...
python
def _serialize(self, uri, node): """ Serialize node result as dict """ meta = self._decode_meta(node['meta'], is_published=bool(node['is_published'])) return { 'uri': uri.clone(ext=node['plugin'], version=node['version']), 'content': node['content'], ...
[ "def", "_serialize", "(", "self", ",", "uri", ",", "node", ")", ":", "meta", "=", "self", ".", "_decode_meta", "(", "node", "[", "'meta'", "]", ",", "is_published", "=", "bool", "(", "node", "[", "'is_published'", "]", ")", ")", "return", "{", "'uri'...
Serialize node result as dict
[ "Serialize", "node", "result", "as", "dict" ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L289-L298
5monkeys/content-io
cio/backends/base.py
DatabaseBackend._decode_meta
def _decode_meta(self, meta, **extra): """ Decode and load underlying meta structure to dict and apply optional extra values. """ _meta = json.loads(meta) if meta else {} _meta.update(extra) return _meta
python
def _decode_meta(self, meta, **extra): """ Decode and load underlying meta structure to dict and apply optional extra values. """ _meta = json.loads(meta) if meta else {} _meta.update(extra) return _meta
[ "def", "_decode_meta", "(", "self", ",", "meta", ",", "*", "*", "extra", ")", ":", "_meta", "=", "json", ".", "loads", "(", "meta", ")", "if", "meta", "else", "{", "}", "_meta", ".", "update", "(", "extra", ")", "return", "_meta" ]
Decode and load underlying meta structure to dict and apply optional extra values.
[ "Decode", "and", "load", "underlying", "meta", "structure", "to", "dict", "and", "apply", "optional", "extra", "values", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L300-L306
5monkeys/content-io
cio/backends/base.py
DatabaseBackend._merge_meta
def _merge_meta(self, encoded_meta, meta): """ Merge new meta dict into encoded meta. Returns new encoded meta. """ new_meta = None if meta: _meta = self._decode_meta(encoded_meta) for key, value in six.iteritems(meta): if value is None: ...
python
def _merge_meta(self, encoded_meta, meta): """ Merge new meta dict into encoded meta. Returns new encoded meta. """ new_meta = None if meta: _meta = self._decode_meta(encoded_meta) for key, value in six.iteritems(meta): if value is None: ...
[ "def", "_merge_meta", "(", "self", ",", "encoded_meta", ",", "meta", ")", ":", "new_meta", "=", "None", "if", "meta", ":", "_meta", "=", "self", ".", "_decode_meta", "(", "encoded_meta", ")", "for", "key", ",", "value", "in", "six", ".", "iteritems", "...
Merge new meta dict into encoded meta. Returns new encoded meta.
[ "Merge", "new", "meta", "dict", "into", "encoded", "meta", ".", "Returns", "new", "encoded", "meta", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L314-L329
5monkeys/content-io
cio/backends/base.py
DatabaseBackend._get_next_version
def _get_next_version(self, revisions): """ Calculates new version number based on existing numeric ones. """ versions = [0] for v in revisions: if v.isdigit(): versions.append(int(v)) return six.text_type(sorted(versions)[-1] + 1)
python
def _get_next_version(self, revisions): """ Calculates new version number based on existing numeric ones. """ versions = [0] for v in revisions: if v.isdigit(): versions.append(int(v)) return six.text_type(sorted(versions)[-1] + 1)
[ "def", "_get_next_version", "(", "self", ",", "revisions", ")", ":", "versions", "=", "[", "0", "]", "for", "v", "in", "revisions", ":", "if", "v", ".", "isdigit", "(", ")", ":", "versions", ".", "append", "(", "int", "(", "v", ")", ")", "return", ...
Calculates new version number based on existing numeric ones.
[ "Calculates", "new", "version", "number", "based", "on", "existing", "numeric", "ones", "." ]
train
https://github.com/5monkeys/content-io/blob/8c8519c74cbadab871f7151c0e02252cb5753759/cio/backends/base.py#L331-L339
theosysbio/means
src/means/approximation/mea/mea_helpers.py
get_one_over_n_factorial
def get_one_over_n_factorial(counter_entry): r""" Calculates the :math:`\frac{1}{\mathbf{n!}}` of eq. 6 (see Ale et al. 2013). That is the invert of a product of factorials. :param counter_entry: an entry of counter. That is an array of integers of length equal to the number of variables. For insta...
python
def get_one_over_n_factorial(counter_entry): r""" Calculates the :math:`\frac{1}{\mathbf{n!}}` of eq. 6 (see Ale et al. 2013). That is the invert of a product of factorials. :param counter_entry: an entry of counter. That is an array of integers of length equal to the number of variables. For insta...
[ "def", "get_one_over_n_factorial", "(", "counter_entry", ")", ":", "# compute all factorials", "factos", "=", "[", "sp", ".", "factorial", "(", "c", ")", "for", "c", "in", "counter_entry", "]", "# multiply them", "prod", "=", "product", "(", "factos", ")", "# ...
r""" Calculates the :math:`\frac{1}{\mathbf{n!}}` of eq. 6 (see Ale et al. 2013). That is the invert of a product of factorials. :param counter_entry: an entry of counter. That is an array of integers of length equal to the number of variables. For instance, `counter_entry` could be `[1,0,1]` for three...
[ "r", "Calculates", "the", ":", "math", ":", "\\", "frac", "{", "1", "}", "{", "\\", "mathbf", "{", "n!", "}}", "of", "eq", ".", "6", "(", "see", "Ale", "et", "al", ".", "2013", ")", ".", "That", "is", "the", "invert", "of", "a", "product", "o...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/mea_helpers.py#L31-L44
theosysbio/means
src/means/approximation/mea/mea_helpers.py
derive_expr_from_counter_entry
def derive_expr_from_counter_entry(expression, species, counter_entry): r""" Derives an given expression with respect to arbitrary species and orders. This is used to compute :math:`\frac{\partial^n \mathbf{n}a_l(\mathbf{x})}{\partial \mathbf{x^n}}` in eq. 6 :param expression: the expression to be deri...
python
def derive_expr_from_counter_entry(expression, species, counter_entry): r""" Derives an given expression with respect to arbitrary species and orders. This is used to compute :math:`\frac{\partial^n \mathbf{n}a_l(\mathbf{x})}{\partial \mathbf{x^n}}` in eq. 6 :param expression: the expression to be deri...
[ "def", "derive_expr_from_counter_entry", "(", "expression", ",", "species", ",", "counter_entry", ")", ":", "# no derivation, we return the unchanged expression", "if", "sum", "(", "counter_entry", ")", "==", "0", ":", "return", "expression", "# repeat a variable as many ti...
r""" Derives an given expression with respect to arbitrary species and orders. This is used to compute :math:`\frac{\partial^n \mathbf{n}a_l(\mathbf{x})}{\partial \mathbf{x^n}}` in eq. 6 :param expression: the expression to be derived :type expression: :class:`~sympy.Expr` :param species: the name ...
[ "r", "Derives", "an", "given", "expression", "with", "respect", "to", "arbitrary", "species", "and", "orders", ".", "This", "is", "used", "to", "compute", ":", "math", ":", "\\", "frac", "{", "\\", "partial^n", "\\", "mathbf", "{", "n", "}", "a_l", "("...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/mea_helpers.py#L47-L77
theosysbio/means
src/means/approximation/mea/mea_helpers.py
make_k_chose_e
def make_k_chose_e(e_vec, k_vec): """ Computes the product :math:`{\mathbf{n} \choose \mathbf{k}}` :param e_vec: the vector e :type e_vec: :class:`numpy.array` :param k_vec: the vector k :type k_vec: :class:`numpy.array` :return: a scalar """ return product([sp.factorial(k) / (sp.fa...
python
def make_k_chose_e(e_vec, k_vec): """ Computes the product :math:`{\mathbf{n} \choose \mathbf{k}}` :param e_vec: the vector e :type e_vec: :class:`numpy.array` :param k_vec: the vector k :type k_vec: :class:`numpy.array` :return: a scalar """ return product([sp.factorial(k) / (sp.fa...
[ "def", "make_k_chose_e", "(", "e_vec", ",", "k_vec", ")", ":", "return", "product", "(", "[", "sp", ".", "factorial", "(", "k", ")", "/", "(", "sp", ".", "factorial", "(", "e", ")", "*", "sp", ".", "factorial", "(", "k", "-", "e", ")", ")", "fo...
Computes the product :math:`{\mathbf{n} \choose \mathbf{k}}` :param e_vec: the vector e :type e_vec: :class:`numpy.array` :param k_vec: the vector k :type k_vec: :class:`numpy.array` :return: a scalar
[ "Computes", "the", "product", ":", "math", ":", "{", "\\", "mathbf", "{", "n", "}", "\\", "choose", "\\", "mathbf", "{", "k", "}}" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/mea_helpers.py#L80-L90
jason-weirather/py-seq-tools
seqtools/structure/gene.py
trim_ordered_range_list
def trim_ordered_range_list(ranges,start,finish): """A function to help with slicing a mapping Start with a list of ranges and get another list of ranges constrained by start (0-indexed) and finish (1-indexed) :param ranges: ordered non-overlapping ranges on the same chromosome :param start: start 0-i...
python
def trim_ordered_range_list(ranges,start,finish): """A function to help with slicing a mapping Start with a list of ranges and get another list of ranges constrained by start (0-indexed) and finish (1-indexed) :param ranges: ordered non-overlapping ranges on the same chromosome :param start: start 0-i...
[ "def", "trim_ordered_range_list", "(", "ranges", ",", "start", ",", "finish", ")", ":", "z", "=", "0", "keep_ranges", "=", "[", "]", "for", "inrng", "in", "self", ".", "ranges", ":", "z", "+=", "1", "original_rng", "=", "inrng", "rng", "=", "inrng", ...
A function to help with slicing a mapping Start with a list of ranges and get another list of ranges constrained by start (0-indexed) and finish (1-indexed) :param ranges: ordered non-overlapping ranges on the same chromosome :param start: start 0-indexed :param finish: ending 1-indexed :type ...
[ "A", "function", "to", "help", "with", "slicing", "a", "mapping", "Start", "with", "a", "list", "of", "ranges", "and", "get", "another", "list", "of", "ranges", "constrained", "by", "start", "(", "0", "-", "indexed", ")", "and", "finish", "(", "1", "-"...
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L408-L448
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.remove_transcript
def remove_transcript(self,tx_id): """Remove a transcript from the locus by its id :param tx_id: :type tx_id: string """ txs = self.get_transcripts() if tx_id not in [x.id for x in txs]: return tx = [x for x in txs if x.id==tx_id][0] for n in [x for x in self.g.get_nodes()]: ...
python
def remove_transcript(self,tx_id): """Remove a transcript from the locus by its id :param tx_id: :type tx_id: string """ txs = self.get_transcripts() if tx_id not in [x.id for x in txs]: return tx = [x for x in txs if x.id==tx_id][0] for n in [x for x in self.g.get_nodes()]: ...
[ "def", "remove_transcript", "(", "self", ",", "tx_id", ")", ":", "txs", "=", "self", ".", "get_transcripts", "(", ")", "if", "tx_id", "not", "in", "[", "x", ".", "id", "for", "x", "in", "txs", "]", ":", "return", "tx", "=", "[", "x", "for", "x", ...
Remove a transcript from the locus by its id :param tx_id: :type tx_id: string
[ "Remove", "a", "transcript", "from", "the", "locus", "by", "its", "id" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L25-L40
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.get_depth_per_transcript
def get_depth_per_transcript(self,mindepth=1): """ using all the transcripts find the depth """ bedarray = [] for tx in self.get_transcripts(): for ex in [x.range for x in tx.exons]: bedarray.append(ex) cov = ranges_to_coverage(bedarray) results = {} for tx in self.get_transcripts(): ...
python
def get_depth_per_transcript(self,mindepth=1): """ using all the transcripts find the depth """ bedarray = [] for tx in self.get_transcripts(): for ex in [x.range for x in tx.exons]: bedarray.append(ex) cov = ranges_to_coverage(bedarray) results = {} for tx in self.get_transcripts(): ...
[ "def", "get_depth_per_transcript", "(", "self", ",", "mindepth", "=", "1", ")", ":", "bedarray", "=", "[", "]", "for", "tx", "in", "self", ".", "get_transcripts", "(", ")", ":", "for", "ex", "in", "[", "x", ".", "range", "for", "x", "in", "tx", "."...
using all the transcripts find the depth
[ "using", "all", "the", "transcripts", "find", "the", "depth" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L49-L76
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.range
def range(self): """Return the range the transcript loci covers :return: range :rtype: GenomicRange """ chrs = set([x.range.chr for x in self.get_transcripts()]) if len(chrs) != 1: return None start = min([x.range.start for x in self.get_transcripts()]) end = max([x.range.end for x in s...
python
def range(self): """Return the range the transcript loci covers :return: range :rtype: GenomicRange """ chrs = set([x.range.chr for x in self.get_transcripts()]) if len(chrs) != 1: return None start = min([x.range.start for x in self.get_transcripts()]) end = max([x.range.end for x in s...
[ "def", "range", "(", "self", ")", ":", "chrs", "=", "set", "(", "[", "x", ".", "range", ".", "chr", "for", "x", "in", "self", ".", "get_transcripts", "(", ")", "]", ")", "if", "len", "(", "chrs", ")", "!=", "1", ":", "return", "None", "start", ...
Return the range the transcript loci covers :return: range :rtype: GenomicRange
[ "Return", "the", "range", "the", "transcript", "loci", "covers" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L79-L89
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.get_transcripts
def get_transcripts(self): """ a list of the transcripts in the locus""" txs = [] for pays in [x.payload for x in self.g.get_nodes()]: for pay in pays: txs.append(pay) return txs
python
def get_transcripts(self): """ a list of the transcripts in the locus""" txs = [] for pays in [x.payload for x in self.g.get_nodes()]: for pay in pays: txs.append(pay) return txs
[ "def", "get_transcripts", "(", "self", ")", ":", "txs", "=", "[", "]", "for", "pays", "in", "[", "x", ".", "payload", "for", "x", "in", "self", ".", "g", ".", "get_nodes", "(", ")", "]", ":", "for", "pay", "in", "pays", ":", "txs", ".", "append...
a list of the transcripts in the locus
[ "a", "list", "of", "the", "transcripts", "in", "the", "locus" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L91-L97
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.partition_loci
def partition_loci(self,verbose=False): """ break the locus up into unconnected loci :return: list of loci :rtype: TranscriptLoci[] """ self.g.merge_cycles() #sys.stderr.write(self.g.get_report()+"\n") gs = self.g.partition_graph(verbose=verbose) tls = [] # makea list of transcript loci...
python
def partition_loci(self,verbose=False): """ break the locus up into unconnected loci :return: list of loci :rtype: TranscriptLoci[] """ self.g.merge_cycles() #sys.stderr.write(self.g.get_report()+"\n") gs = self.g.partition_graph(verbose=verbose) tls = [] # makea list of transcript loci...
[ "def", "partition_loci", "(", "self", ",", "verbose", "=", "False", ")", ":", "self", ".", "g", ".", "merge_cycles", "(", ")", "#sys.stderr.write(self.g.get_report()+\"\\n\")", "gs", "=", "self", ".", "g", ".", "partition_graph", "(", "verbose", "=", "verbose"...
break the locus up into unconnected loci :return: list of loci :rtype: TranscriptLoci[]
[ "break", "the", "locus", "up", "into", "unconnected", "loci" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L99-L126
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptLoci.add_transcript
def add_transcript(self,tx): """Add a transcript to the locus :param tx: transcript to add :type tx: Transcript """ for y in [x.payload for x in self.g.get_nodes()]: if tx.id in [z.id for z in y]: sys.stderr.write("WARNING tx is already in graph\n") return True # transcrip...
python
def add_transcript(self,tx): """Add a transcript to the locus :param tx: transcript to add :type tx: Transcript """ for y in [x.payload for x in self.g.get_nodes()]: if tx.id in [z.id for z in y]: sys.stderr.write("WARNING tx is already in graph\n") return True # transcrip...
[ "def", "add_transcript", "(", "self", ",", "tx", ")", ":", "for", "y", "in", "[", "x", ".", "payload", "for", "x", "in", "self", ".", "g", ".", "get_nodes", "(", ")", "]", ":", "if", "tx", ".", "id", "in", "[", "z", ".", "id", "for", "z", "...
Add a transcript to the locus :param tx: transcript to add :type tx: Transcript
[ "Add", "a", "transcript", "to", "the", "locus" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L128-L194
jason-weirather/py-seq-tools
seqtools/structure/gene.py
TranscriptGroup.get_transcript
def get_transcript(self,exon_bounds='max'): """Return a representative transcript object""" out = Transcript() out.junctions = [x.get_junction() for x in self.junction_groups] # check for single exon transcript if len(out.junctions) == 0: leftcoord = min([x.exons[0].range.start for x in self.t...
python
def get_transcript(self,exon_bounds='max'): """Return a representative transcript object""" out = Transcript() out.junctions = [x.get_junction() for x in self.junction_groups] # check for single exon transcript if len(out.junctions) == 0: leftcoord = min([x.exons[0].range.start for x in self.t...
[ "def", "get_transcript", "(", "self", ",", "exon_bounds", "=", "'max'", ")", ":", "out", "=", "Transcript", "(", ")", "out", ".", "junctions", "=", "[", "x", ".", "get_junction", "(", ")", "for", "x", "in", "self", ".", "junction_groups", "]", "# check...
Return a representative transcript object
[ "Return", "a", "representative", "transcript", "object" ]
train
https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/structure/gene.py#L247-L290
nrcharles/caelum
caelum/tools.py
download
def download(url, filename): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() local_file = open(filename, '...
python
def download(url, filename): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() local_file = open(filename, '...
[ "def", "download", "(", "url", ",", "filename", ")", ":", "logger", ".", "info", "(", "\"Downloading %s\"", ",", "url", ")", "request", "=", "urllib2", ".", "Request", "(", "url", ")", "request", ".", "add_header", "(", "'User-Agent'", ",", "'caelum/0.1 +h...
download and extract file.
[ "download", "and", "extract", "file", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L20-L29
nrcharles/caelum
caelum/tools.py
download_extract
def download_extract(url): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() with tempfile.TemporaryFile(suf...
python
def download_extract(url): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() with tempfile.TemporaryFile(suf...
[ "def", "download_extract", "(", "url", ")", ":", "logger", ".", "info", "(", "\"Downloading %s\"", ",", "url", ")", "request", "=", "urllib2", ".", "Request", "(", "url", ")", "request", ".", "add_header", "(", "'User-Agent'", ",", "'caelum/0.1 +https://github...
download and extract file.
[ "download", "and", "extract", "file", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L32-L46
nrcharles/caelum
caelum/tools.py
parse_noaa_line
def parse_noaa_line(line): """Parse NOAA stations. This is an old list, the format is: NUMBER NAME & STATE/COUNTRY LAT LON ELEV (meters) 010250 TROMSO NO 6941N 01855E 10 """ station = {} station['station_name'] = line[7:51].strip()...
python
def parse_noaa_line(line): """Parse NOAA stations. This is an old list, the format is: NUMBER NAME & STATE/COUNTRY LAT LON ELEV (meters) 010250 TROMSO NO 6941N 01855E 10 """ station = {} station['station_name'] = line[7:51].strip()...
[ "def", "parse_noaa_line", "(", "line", ")", ":", "station", "=", "{", "}", "station", "[", "'station_name'", "]", "=", "line", "[", "7", ":", "51", "]", ".", "strip", "(", ")", "station", "[", "'station_code'", "]", "=", "line", "[", "0", ":", "6",...
Parse NOAA stations. This is an old list, the format is: NUMBER NAME & STATE/COUNTRY LAT LON ELEV (meters) 010250 TROMSO NO 6941N 01855E 10
[ "Parse", "NOAA", "stations", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L59-L76
nrcharles/caelum
caelum/tools.py
closest_noaa
def closest_noaa(latitude, longitude): """Find closest station from the old list.""" with open(env.SRC_PATH + '/inswo-stns.txt') as index: index.readline() # header index.readline() # whitespace min_dist = 9999 station_name = '' station_name = '' for line in ind...
python
def closest_noaa(latitude, longitude): """Find closest station from the old list.""" with open(env.SRC_PATH + '/inswo-stns.txt') as index: index.readline() # header index.readline() # whitespace min_dist = 9999 station_name = '' station_name = '' for line in ind...
[ "def", "closest_noaa", "(", "latitude", ",", "longitude", ")", ":", "with", "open", "(", "env", ".", "SRC_PATH", "+", "'/inswo-stns.txt'", ")", "as", "index", ":", "index", ".", "readline", "(", ")", "# header", "index", ".", "readline", "(", ")", "# whi...
Find closest station from the old list.
[ "Find", "closest", "station", "from", "the", "old", "list", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L79-L104
nrcharles/caelum
caelum/tools.py
closest_eere
def closest_eere(latitude, longitude): """Find closest station from the new(er) list. Warning: There may be some errors with smaller non US stations. Args: latitude (float) longitude (float) Returns: tuple (station_code (str), station_name (str)) """ with open(env.SRC...
python
def closest_eere(latitude, longitude): """Find closest station from the new(er) list. Warning: There may be some errors with smaller non US stations. Args: latitude (float) longitude (float) Returns: tuple (station_code (str), station_name (str)) """ with open(env.SRC...
[ "def", "closest_eere", "(", "latitude", ",", "longitude", ")", ":", "with", "open", "(", "env", ".", "SRC_PATH", "+", "'/eere_meta.csv'", ")", "as", "eere_meta", ":", "stations", "=", "csv", ".", "DictReader", "(", "eere_meta", ")", "d", "=", "9999", "st...
Find closest station from the new(er) list. Warning: There may be some errors with smaller non US stations. Args: latitude (float) longitude (float) Returns: tuple (station_code (str), station_name (str))
[ "Find", "closest", "station", "from", "the", "new", "(", "er", ")", "list", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L107-L134
nrcharles/caelum
caelum/tools.py
eere_station
def eere_station(station_code): """Station information. Args: station_code (str): station code. Returns (dict): station information """ with open(env.SRC_PATH + '/eere_meta.csv') as eere_meta: stations = csv.DictReader(eere_meta) for station in stations: if stat...
python
def eere_station(station_code): """Station information. Args: station_code (str): station code. Returns (dict): station information """ with open(env.SRC_PATH + '/eere_meta.csv') as eere_meta: stations = csv.DictReader(eere_meta) for station in stations: if stat...
[ "def", "eere_station", "(", "station_code", ")", ":", "with", "open", "(", "env", ".", "SRC_PATH", "+", "'/eere_meta.csv'", ")", "as", "eere_meta", ":", "stations", "=", "csv", ".", "DictReader", "(", "eere_meta", ")", "for", "station", "in", "stations", "...
Station information. Args: station_code (str): station code. Returns (dict): station information
[ "Station", "information", "." ]
train
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L137-L150
mitsei/dlkit
dlkit/json_/logging_/searches.py
LogEntrySearchResults.get_log_entries
def get_log_entries(self): """Gets the log entry list resulting from a search. return: (osid.logging.LogEntryList) - the log entry list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: ...
python
def get_log_entries(self): """Gets the log entry list resulting from a search. return: (osid.logging.LogEntryList) - the log entry list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: ...
[ "def", "get_log_entries", "(", "self", ")", ":", "if", "self", ".", "retrieved", ":", "raise", "errors", ".", "IllegalState", "(", "'List has already been retrieved.'", ")", "self", ".", "retrieved", "=", "True", "return", "objects", ".", "LogEntryList", "(", ...
Gets the log entry list resulting from a search. return: (osid.logging.LogEntryList) - the log entry list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "log", "entry", "list", "resulting", "from", "a", "search", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/searches.py#L97-L108
mitsei/dlkit
dlkit/json_/logging_/searches.py
LogSearchResults.get_logs
def get_logs(self): """Gets the log list resulting from a search. return: (osid.logging.LogList) - the log list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.Ille...
python
def get_logs(self): """Gets the log list resulting from a search. return: (osid.logging.LogList) - the log list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: raise errors.Ille...
[ "def", "get_logs", "(", "self", ")", ":", "if", "self", ".", "retrieved", ":", "raise", "errors", ".", "IllegalState", "(", "'List has already been retrieved.'", ")", "self", ".", "retrieved", "=", "True", "return", "objects", ".", "LogList", "(", "self", "....
Gets the log list resulting from a search. return: (osid.logging.LogList) - the log list raise: IllegalState - list already retrieved *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "log", "list", "resulting", "from", "a", "search", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/searches.py#L218-L229
django-fluent/fluentcms-googlemaps
fluentcms_googlemaps/views.py
MarkerDetailView.get_object
def get_object(self, queryset=None): """ Returns the object the view is displaying. """ if queryset is None: queryset = self.get_queryset() # Take a GET parameter instead of URLConf variable. try: pk = long(self.request.GET[self.pk_url_kwarg]) ...
python
def get_object(self, queryset=None): """ Returns the object the view is displaying. """ if queryset is None: queryset = self.get_queryset() # Take a GET parameter instead of URLConf variable. try: pk = long(self.request.GET[self.pk_url_kwarg]) ...
[ "def", "get_object", "(", "self", ",", "queryset", "=", "None", ")", ":", "if", "queryset", "is", "None", ":", "queryset", "=", "self", ".", "get_queryset", "(", ")", "# Take a GET parameter instead of URLConf variable.", "try", ":", "pk", "=", "long", "(", ...
Returns the object the view is displaying.
[ "Returns", "the", "object", "the", "view", "is", "displaying", "." ]
train
https://github.com/django-fluent/fluentcms-googlemaps/blob/e4034b0f1c9896ce355628ed8e0c3532c08214d1/fluentcms_googlemaps/views.py#L24-L43
OpenAgInitiative/openag_python
openag/cli/cloud/db.py
init
def init(cloud_url): """ Choose a cloud server to use. Sets CLOUD_URL as the cloud server to use and sets up replication of global databases from that cloud server if a local database is already initialized (via `openag db init`). """ old_cloud_url = config["cloud_server"]["url"] if old_clou...
python
def init(cloud_url): """ Choose a cloud server to use. Sets CLOUD_URL as the cloud server to use and sets up replication of global databases from that cloud server if a local database is already initialized (via `openag db init`). """ old_cloud_url = config["cloud_server"]["url"] if old_clou...
[ "def", "init", "(", "cloud_url", ")", ":", "old_cloud_url", "=", "config", "[", "\"cloud_server\"", "]", "[", "\"url\"", "]", "if", "old_cloud_url", "and", "old_cloud_url", "!=", "cloud_url", ":", "raise", "click", ".", "ClickException", "(", "'Server \"{}\" alr...
Choose a cloud server to use. Sets CLOUD_URL as the cloud server to use and sets up replication of global databases from that cloud server if a local database is already initialized (via `openag db init`).
[ "Choose", "a", "cloud", "server", "to", "use", ".", "Sets", "CLOUD_URL", "as", "the", "cloud", "server", "to", "use", "and", "sets", "up", "replication", "of", "global", "databases", "from", "that", "cloud", "server", "if", "a", "local", "database", "is", ...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/cloud/db.py#L10-L29
OpenAgInitiative/openag_python
openag/cli/cloud/db.py
show
def show(): """ Shows the URL of the current cloud server or throws an error if no cloud server is selected """ utils.check_for_cloud_server() click.echo("Using cloud server at \"{}\"".format( config["cloud_server"]["url"] )) if config["cloud_server"]["username"]: click.e...
python
def show(): """ Shows the URL of the current cloud server or throws an error if no cloud server is selected """ utils.check_for_cloud_server() click.echo("Using cloud server at \"{}\"".format( config["cloud_server"]["url"] )) if config["cloud_server"]["username"]: click.e...
[ "def", "show", "(", ")", ":", "utils", ".", "check_for_cloud_server", "(", ")", "click", ".", "echo", "(", "\"Using cloud server at \\\"{}\\\"\"", ".", "format", "(", "config", "[", "\"cloud_server\"", "]", "[", "\"url\"", "]", ")", ")", "if", "config", "[",...
Shows the URL of the current cloud server or throws an error if no cloud server is selected
[ "Shows", "the", "URL", "of", "the", "current", "cloud", "server", "or", "throws", "an", "error", "if", "no", "cloud", "server", "is", "selected" ]
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/cloud/db.py#L32-L48
OpenAgInitiative/openag_python
openag/cli/cloud/db.py
deinit
def deinit(ctx): """ Detach from the current cloud server """ utils.check_for_cloud_server() if config["local_server"]["url"]: utils.cancel_global_db_replication() if config["cloud_server"]["username"]: ctx.invoke(logout_user) config["cloud_server"]["url"] = None
python
def deinit(ctx): """ Detach from the current cloud server """ utils.check_for_cloud_server() if config["local_server"]["url"]: utils.cancel_global_db_replication() if config["cloud_server"]["username"]: ctx.invoke(logout_user) config["cloud_server"]["url"] = None
[ "def", "deinit", "(", "ctx", ")", ":", "utils", ".", "check_for_cloud_server", "(", ")", "if", "config", "[", "\"local_server\"", "]", "[", "\"url\"", "]", ":", "utils", ".", "cancel_global_db_replication", "(", ")", "if", "config", "[", "\"cloud_server\"", ...
Detach from the current cloud server
[ "Detach", "from", "the", "current", "cloud", "server" ]
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/cli/cloud/db.py#L52-L61
ilgarm/pyzimbra
pyzimbra/zclient.py
ZimbraSoapClient.invoke
def invoke(self, ns, request_name, params={}, simplify=False): """ Invokes zimbra method using established authentication session. @param req: zimbra request @parm params: request params @param simplify: True to return python object, False to return xml struct @return: zi...
python
def invoke(self, ns, request_name, params={}, simplify=False): """ Invokes zimbra method using established authentication session. @param req: zimbra request @parm params: request params @param simplify: True to return python object, False to return xml struct @return: zi...
[ "def", "invoke", "(", "self", ",", "ns", ",", "request_name", ",", "params", "=", "{", "}", ",", "simplify", "=", "False", ")", ":", "if", "self", ".", "auth_token", "==", "None", ":", "raise", "AuthException", "(", "'Unable to invoke zimbra method'", ")",...
Invokes zimbra method using established authentication session. @param req: zimbra request @parm params: request params @param simplify: True to return python object, False to return xml struct @return: zimbra response @raise AuthException: if authentication fails @raise ...
[ "Invokes", "zimbra", "method", "using", "established", "authentication", "session", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/zclient.py#L67-L87
ascribe/pyspool
spool/ownership.py
Ownership.can_transfer
def can_transfer(self): """ bool: :const:`True` if :attr:`address` can transfer the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. """ # 1. The address needs to own the edition chain = BlockchainSpider.chain(self._tree, self.edition_number) ...
python
def can_transfer(self): """ bool: :const:`True` if :attr:`address` can transfer the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. """ # 1. The address needs to own the edition chain = BlockchainSpider.chain(self._tree, self.edition_number) ...
[ "def", "can_transfer", "(", "self", ")", ":", "# 1. The address needs to own the edition", "chain", "=", "BlockchainSpider", ".", "chain", "(", "self", ".", "_tree", ",", "self", ".", "edition_number", ")", "if", "len", "(", "chain", ")", "==", "0", ":", "se...
bool: :const:`True` if :attr:`address` can transfer the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`.
[ "bool", ":", ":", "const", ":", "True", "if", ":", "attr", ":", "address", "can", "transfer", "the", "edition", ":", "attr", ":", "edition_number", "of", ":", "attr", ":", "piece_address", "else", ":", "const", ":", "False", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/ownership.py#L85-L104
ascribe/pyspool
spool/ownership.py
Ownership.can_unconsign
def can_unconsign(self): """ bool: :const:`True` if :attr:`address` can unconsign the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. If the last transaction is a consignment of the edition to the user. """ chain = BlockchainSpider.chain(sel...
python
def can_unconsign(self): """ bool: :const:`True` if :attr:`address` can unconsign the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. If the last transaction is a consignment of the edition to the user. """ chain = BlockchainSpider.chain(sel...
[ "def", "can_unconsign", "(", "self", ")", ":", "chain", "=", "BlockchainSpider", ".", "chain", "(", "self", ".", "_tree", ",", "self", ".", "edition_number", ")", "if", "len", "(", "chain", ")", "==", "0", ":", "self", ".", "reason", "=", "'Master edit...
bool: :const:`True` if :attr:`address` can unconsign the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. If the last transaction is a consignment of the edition to the user.
[ "bool", ":", ":", "const", ":", "True", "if", ":", "attr", ":", "address", "can", "unconsign", "the", "edition", ":", "attr", ":", "edition_number", "of", ":", "attr", ":", "piece_address", "else", ":", "const", ":", "False", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/ownership.py#L125-L148
ascribe/pyspool
spool/ownership.py
Ownership.can_register
def can_register(self): """ bool: :const:`True` if :attr:`address` can register the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. In order to register an edition: 1. The master piece needs to be registered. 2. The number of editions needs ...
python
def can_register(self): """ bool: :const:`True` if :attr:`address` can register the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. In order to register an edition: 1. The master piece needs to be registered. 2. The number of editions needs ...
[ "def", "can_register", "(", "self", ")", ":", "chain", "=", "BlockchainSpider", ".", "chain", "(", "self", ".", "_tree", ",", "REGISTERED_PIECE_CODE", ")", "# edition 0 should only have two transactions: REGISTER and EDITIONS", "if", "len", "(", "chain", ")", "==", ...
bool: :const:`True` if :attr:`address` can register the edition :attr:`edition_number` of :attr:`piece_address` else :const:`False`. In order to register an edition: 1. The master piece needs to be registered. 2. The number of editions needs to be registered. 3. The :attr:`edit...
[ "bool", ":", ":", "const", ":", "True", "if", ":", "attr", ":", "address", "can", "register", "the", "edition", ":", "attr", ":", "edition_number", "of", ":", "attr", ":", "piece_address", "else", ":", "const", ":", "False", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/ownership.py#L151-L188
ascribe/pyspool
spool/ownership.py
Ownership.can_editions
def can_editions(self): """ bool: :const:`True` if :attr:`address` can register the number of editions of :attr:`piece_address` else :const:`False`. In order to register the number of editions: 1. There needs to a least one transaction for the :attr:`piece_address` (the...
python
def can_editions(self): """ bool: :const:`True` if :attr:`address` can register the number of editions of :attr:`piece_address` else :const:`False`. In order to register the number of editions: 1. There needs to a least one transaction for the :attr:`piece_address` (the...
[ "def", "can_editions", "(", "self", ")", ":", "chain", "=", "BlockchainSpider", ".", "chain", "(", "self", ".", "_tree", ",", "REGISTERED_PIECE_CODE", ")", "if", "len", "(", "chain", ")", "==", "0", ":", "self", ".", "reason", "=", "'Master edition not yet...
bool: :const:`True` if :attr:`address` can register the number of editions of :attr:`piece_address` else :const:`False`. In order to register the number of editions: 1. There needs to a least one transaction for the :attr:`piece_address` (the registration of the master edition). ...
[ "bool", ":", ":", "const", ":", "True", "if", ":", "attr", ":", "address", "can", "register", "the", "number", "of", "editions", "of", ":", "attr", ":", "piece_address", "else", ":", "const", ":", "False", "." ]
train
https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/ownership.py#L208-L236
raamana/hiwenet
hiwenet/non_pairwise.py
relative_to_all
def relative_to_all(features, groups, bin_edges, weight_func, use_orig_distr, group_ids, num_groups, return_networkx_graph, out_weights_path): """ Computes the given function (aka weight or distance) between histogram from each of the groups to a "gran...
python
def relative_to_all(features, groups, bin_edges, weight_func, use_orig_distr, group_ids, num_groups, return_networkx_graph, out_weights_path): """ Computes the given function (aka weight or distance) between histogram from each of the groups to a "gran...
[ "def", "relative_to_all", "(", "features", ",", "groups", ",", "bin_edges", ",", "weight_func", ",", "use_orig_distr", ",", "group_ids", ",", "num_groups", ",", "return_networkx_graph", ",", "out_weights_path", ")", ":", "# notice the use of all features without regard to...
Computes the given function (aka weight or distance) between histogram from each of the groups to a "grand histogram" derived from all groups. Parameters ---------- features : ndarray or str 1d array of scalar values, either provided directly as a 1d numpy array, or as a path to a file cont...
[ "Computes", "the", "given", "function", "(", "aka", "weight", "or", "distance", ")", "between", "histogram", "from", "each", "of", "the", "groups", "to", "a", "grand", "histogram", "derived", "from", "all", "groups", "." ]
train
https://github.com/raamana/hiwenet/blob/b12699b3722fd0a6a835e7d7ca4baf58fb181809/hiwenet/non_pairwise.py#L19-L114
planetlabs/es_fluent
es_fluent/filters/core.py
Generic.add_filter
def add_filter(self, filter_or_string, *args, **kwargs): """ Appends a filter. """ self.filters.append(build_filter(filter_or_string, *args, **kwargs)) return self
python
def add_filter(self, filter_or_string, *args, **kwargs): """ Appends a filter. """ self.filters.append(build_filter(filter_or_string, *args, **kwargs)) return self
[ "def", "add_filter", "(", "self", ",", "filter_or_string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "filters", ".", "append", "(", "build_filter", "(", "filter_or_string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ")", ...
Appends a filter.
[ "Appends", "a", "filter", "." ]
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/filters/core.py#L27-L33
planetlabs/es_fluent
es_fluent/filters/core.py
Generic.and_filter
def and_filter(self, filter_or_string, *args, **kwargs): """ Adds a list of :class:`~es_fluent.filters.core.And` clauses, automatically generating :class:`~es_fluent.filters.core.And` filter if it does not exist. """ and_filter = self.find_filter(And) if and_filt...
python
def and_filter(self, filter_or_string, *args, **kwargs): """ Adds a list of :class:`~es_fluent.filters.core.And` clauses, automatically generating :class:`~es_fluent.filters.core.And` filter if it does not exist. """ and_filter = self.find_filter(And) if and_filt...
[ "def", "and_filter", "(", "self", ",", "filter_or_string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "and_filter", "=", "self", ".", "find_filter", "(", "And", ")", "if", "and_filter", "is", "None", ":", "and_filter", "=", "And", "(", ")", ...
Adds a list of :class:`~es_fluent.filters.core.And` clauses, automatically generating :class:`~es_fluent.filters.core.And` filter if it does not exist.
[ "Adds", "a", "list", "of", ":", "class", ":", "~es_fluent", ".", "filters", ".", "core", ".", "And", "clauses", "automatically", "generating", ":", "class", ":", "~es_fluent", ".", "filters", ".", "core", ".", "And", "filter", "if", "it", "does", "not", ...
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/filters/core.py#L35-L50
planetlabs/es_fluent
es_fluent/filters/core.py
Generic.or_filter
def or_filter(self, filter_or_string, *args, **kwargs): """ Adds a list of :class:`~es_fluent.filters.core.Or` clauses, automatically generating the an :class:`~es_fluent.filters.core.Or` filter if it does not exist. """ or_filter = self.find_filter(Or) if or_fil...
python
def or_filter(self, filter_or_string, *args, **kwargs): """ Adds a list of :class:`~es_fluent.filters.core.Or` clauses, automatically generating the an :class:`~es_fluent.filters.core.Or` filter if it does not exist. """ or_filter = self.find_filter(Or) if or_fil...
[ "def", "or_filter", "(", "self", ",", "filter_or_string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "or_filter", "=", "self", ".", "find_filter", "(", "Or", ")", "if", "or_filter", "is", "None", ":", "or_filter", "=", "Or", "(", ")", "self...
Adds a list of :class:`~es_fluent.filters.core.Or` clauses, automatically generating the an :class:`~es_fluent.filters.core.Or` filter if it does not exist.
[ "Adds", "a", "list", "of", ":", "class", ":", "~es_fluent", ".", "filters", ".", "core", ".", "Or", "clauses", "automatically", "generating", "the", "an", ":", "class", ":", "~es_fluent", ".", "filters", ".", "core", ".", "Or", "filter", "if", "it", "d...
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/filters/core.py#L52-L68
planetlabs/es_fluent
es_fluent/filters/core.py
Generic.find_filter
def find_filter(self, filter_cls): """ Find or create a filter instance of the provided ``filter_cls``. If it is found, use remaining arguments to augment the filter otherwise create a new instance of the desired type and add it to the current :class:`~es_fluent.builder.QueryBuil...
python
def find_filter(self, filter_cls): """ Find or create a filter instance of the provided ``filter_cls``. If it is found, use remaining arguments to augment the filter otherwise create a new instance of the desired type and add it to the current :class:`~es_fluent.builder.QueryBuil...
[ "def", "find_filter", "(", "self", ",", "filter_cls", ")", ":", "for", "filter_instance", "in", "self", ".", "filters", ":", "if", "isinstance", "(", "filter_instance", ",", "filter_cls", ")", ":", "return", "filter_instance", "return", "None" ]
Find or create a filter instance of the provided ``filter_cls``. If it is found, use remaining arguments to augment the filter otherwise create a new instance of the desired type and add it to the current :class:`~es_fluent.builder.QueryBuilder` accordingly.
[ "Find", "or", "create", "a", "filter", "instance", "of", "the", "provided", "filter_cls", ".", "If", "it", "is", "found", "use", "remaining", "arguments", "to", "augment", "the", "filter", "otherwise", "create", "a", "new", "instance", "of", "the", "desired"...
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/filters/core.py#L70-L81
planetlabs/es_fluent
es_fluent/filters/core.py
Dict.to_query
def to_query(self): """ Iterates over all filters and converts them to an Elastic HTTP API suitable query. Note: each :class:`~es_fluent.filters.Filter` is free to set it's own filter dictionary. ESFluent does not attempt to guard against filters that may clobber one ano...
python
def to_query(self): """ Iterates over all filters and converts them to an Elastic HTTP API suitable query. Note: each :class:`~es_fluent.filters.Filter` is free to set it's own filter dictionary. ESFluent does not attempt to guard against filters that may clobber one ano...
[ "def", "to_query", "(", "self", ")", ":", "query", "=", "{", "}", "for", "filter_instance", "in", "self", ".", "filters", ":", "if", "filter_instance", ".", "is_empty", "(", ")", ":", "continue", "filter_query", "=", "filter_instance", ".", "to_query", "("...
Iterates over all filters and converts them to an Elastic HTTP API suitable query. Note: each :class:`~es_fluent.filters.Filter` is free to set it's own filter dictionary. ESFluent does not attempt to guard against filters that may clobber one another. If you wish to ensure that filter...
[ "Iterates", "over", "all", "filters", "and", "converts", "them", "to", "an", "Elastic", "HTTP", "API", "suitable", "query", "." ]
train
https://github.com/planetlabs/es_fluent/blob/74f8db3a1bf9aa1d54512cf2d5e0ec58ee2f4b1c/es_fluent/filters/core.py#L93-L112
ND-CSE-30151/tock
tock/machines.py
determinize
def determinize(m): """Determinizes a finite automaton.""" if not m.is_finite(): raise TypeError("machine must be a finite automaton") transitions = collections.defaultdict(lambda: collections.defaultdict(set)) alphabet = set() for transition in m.get_transitions(): [[lstate], read]...
python
def determinize(m): """Determinizes a finite automaton.""" if not m.is_finite(): raise TypeError("machine must be a finite automaton") transitions = collections.defaultdict(lambda: collections.defaultdict(set)) alphabet = set() for transition in m.get_transitions(): [[lstate], read]...
[ "def", "determinize", "(", "m", ")", ":", "if", "not", "m", ".", "is_finite", "(", ")", ":", "raise", "TypeError", "(", "\"machine must be a finite automaton\"", ")", "transitions", "=", "collections", ".", "defaultdict", "(", "lambda", ":", "collections", "."...
Determinizes a finite automaton.
[ "Determinizes", "a", "finite", "automaton", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L408-L468
ND-CSE-30151/tock
tock/machines.py
equivalent
def equivalent(m1, m2): """Hopcroft-Karp algorithm.""" if not m1.is_finite() and m1.is_deterministic(): raise TypeError("machine must be a deterministic finite automaton") if not m2.is_finite() and m2.is_deterministic(): raise TypeError("machine must be a deterministic finite automaton") ...
python
def equivalent(m1, m2): """Hopcroft-Karp algorithm.""" if not m1.is_finite() and m1.is_deterministic(): raise TypeError("machine must be a deterministic finite automaton") if not m2.is_finite() and m2.is_deterministic(): raise TypeError("machine must be a deterministic finite automaton") ...
[ "def", "equivalent", "(", "m1", ",", "m2", ")", ":", "if", "not", "m1", ".", "is_finite", "(", ")", "and", "m1", ".", "is_deterministic", "(", ")", ":", "raise", "TypeError", "(", "\"machine must be a deterministic finite automaton\"", ")", "if", "not", "m2"...
Hopcroft-Karp algorithm.
[ "Hopcroft", "-", "Karp", "algorithm", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L470-L528
ND-CSE-30151/tock
tock/machines.py
Configuration.match
def match(self, other): """Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.""" if len(self) != len(other): raise ValueError() for s1, s2 in zip(self, oth...
python
def match(self, other): """Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.""" if len(self) != len(other): raise ValueError() for s1, s2 in zip(self, oth...
[ "def", "match", "(", "self", ",", "other", ")", ":", "if", "len", "(", "self", ")", "!=", "len", "(", "other", ")", ":", "raise", "ValueError", "(", ")", "for", "s1", ",", "s2", "in", "zip", "(", "self", ",", "other", ")", ":", "i", "=", "s2"...
Returns true iff self (as a pattern) matches other (as a configuration). Note that this is asymmetric: other is allowed to have symbols that aren't found in self.
[ "Returns", "true", "iff", "self", "(", "as", "a", "pattern", ")", "matches", "other", "(", "as", "a", "configuration", ")", ".", "Note", "that", "this", "is", "asymmetric", ":", "other", "is", "allowed", "to", "have", "symbols", "that", "aren", "t", "f...
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L107-L123
ND-CSE-30151/tock
tock/machines.py
Machine.has_cell
def has_cell(self, s): """Tests whether store `s` is a cell, that is, it uses exactly one cell, and there can take on only a finite number of states).""" for t in self.transitions: if len(t.lhs[s]) != 1: return False if len(t.rhs[s]) != 1: ...
python
def has_cell(self, s): """Tests whether store `s` is a cell, that is, it uses exactly one cell, and there can take on only a finite number of states).""" for t in self.transitions: if len(t.lhs[s]) != 1: return False if len(t.rhs[s]) != 1: ...
[ "def", "has_cell", "(", "self", ",", "s", ")", ":", "for", "t", "in", "self", ".", "transitions", ":", "if", "len", "(", "t", ".", "lhs", "[", "s", "]", ")", "!=", "1", ":", "return", "False", "if", "len", "(", "t", ".", "rhs", "[", "s", "]...
Tests whether store `s` is a cell, that is, it uses exactly one cell, and there can take on only a finite number of states).
[ "Tests", "whether", "store", "s", "is", "a", "cell", "that", "is", "it", "uses", "exactly", "one", "cell", "and", "there", "can", "take", "on", "only", "a", "finite", "number", "of", "states", ")", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L321-L334
ND-CSE-30151/tock
tock/machines.py
Machine.has_stack
def has_stack(self, s): """Tests whether store `s` is a stack, that is, it never moves from position 0.""" for t in self.transitions: if t.lhs[s].position != 0: return False if t.rhs[s].position != 0: return False return True
python
def has_stack(self, s): """Tests whether store `s` is a stack, that is, it never moves from position 0.""" for t in self.transitions: if t.lhs[s].position != 0: return False if t.rhs[s].position != 0: return False return True
[ "def", "has_stack", "(", "self", ",", "s", ")", ":", "for", "t", "in", "self", ".", "transitions", ":", "if", "t", ".", "lhs", "[", "s", "]", ".", "position", "!=", "0", ":", "return", "False", "if", "t", ".", "rhs", "[", "s", "]", ".", "posi...
Tests whether store `s` is a stack, that is, it never moves from position 0.
[ "Tests", "whether", "store", "s", "is", "a", "stack", "that", "is", "it", "never", "moves", "from", "position", "0", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L359-L367
ND-CSE-30151/tock
tock/machines.py
Machine.has_readonly
def has_readonly(self, s): """Tests whether store `s` is read-only.""" for t in self.transitions: if list(t.lhs[s]) != list(t.rhs[s]): return False return True
python
def has_readonly(self, s): """Tests whether store `s` is read-only.""" for t in self.transitions: if list(t.lhs[s]) != list(t.rhs[s]): return False return True
[ "def", "has_readonly", "(", "self", ",", "s", ")", ":", "for", "t", "in", "self", ".", "transitions", ":", "if", "list", "(", "t", ".", "lhs", "[", "s", "]", ")", "!=", "list", "(", "t", ".", "rhs", "[", "s", "]", ")", ":", "return", "False",...
Tests whether store `s` is read-only.
[ "Tests", "whether", "store", "s", "is", "read", "-", "only", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L369-L374
ND-CSE-30151/tock
tock/machines.py
Machine.is_finite
def is_finite(self): """Tests whether machine is a finite automaton.""" return (self.num_stores == 2 and self.state == 0 and self.has_cell(0) and self.input == 1 and self.has_input(1))
python
def is_finite(self): """Tests whether machine is a finite automaton.""" return (self.num_stores == 2 and self.state == 0 and self.has_cell(0) and self.input == 1 and self.has_input(1))
[ "def", "is_finite", "(", "self", ")", ":", "return", "(", "self", ".", "num_stores", "==", "2", "and", "self", ".", "state", "==", "0", "and", "self", ".", "has_cell", "(", "0", ")", "and", "self", ".", "input", "==", "1", "and", "self", ".", "ha...
Tests whether machine is a finite automaton.
[ "Tests", "whether", "machine", "is", "a", "finite", "automaton", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L376-L380
ND-CSE-30151/tock
tock/machines.py
Machine.is_pushdown
def is_pushdown(self): """Tests whether machine is a pushdown automaton.""" return (self.num_stores == 3 and self.state == 0 and self.has_cell(0) and self.input == 1 and self.has_input(1) and self.has_stack(2))
python
def is_pushdown(self): """Tests whether machine is a pushdown automaton.""" return (self.num_stores == 3 and self.state == 0 and self.has_cell(0) and self.input == 1 and self.has_input(1) and self.has_stack(2))
[ "def", "is_pushdown", "(", "self", ")", ":", "return", "(", "self", ".", "num_stores", "==", "3", "and", "self", ".", "state", "==", "0", "and", "self", ".", "has_cell", "(", "0", ")", "and", "self", ".", "input", "==", "1", "and", "self", ".", "...
Tests whether machine is a pushdown automaton.
[ "Tests", "whether", "machine", "is", "a", "pushdown", "automaton", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L382-L387
ND-CSE-30151/tock
tock/machines.py
Machine.is_deterministic
def is_deterministic(self): """Tests whether machine is deterministic.""" # naive quadratic algorithm patterns = [t.lhs for t in self.transitions] + list(self.accept_configs) for i, t1 in enumerate(patterns): for t2 in patterns[:i]: match = True ...
python
def is_deterministic(self): """Tests whether machine is deterministic.""" # naive quadratic algorithm patterns = [t.lhs for t in self.transitions] + list(self.accept_configs) for i, t1 in enumerate(patterns): for t2 in patterns[:i]: match = True ...
[ "def", "is_deterministic", "(", "self", ")", ":", "# naive quadratic algorithm", "patterns", "=", "[", "t", ".", "lhs", "for", "t", "in", "self", ".", "transitions", "]", "+", "list", "(", "self", ".", "accept_configs", ")", "for", "i", ",", "t1", "in", ...
Tests whether machine is deterministic.
[ "Tests", "whether", "machine", "is", "deterministic", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/machines.py#L389-L406
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationship
def get_relationship(self, relationship_id): """Gets the ``Relationship`` specified by its ``Id``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to retrieve return: (osid.relationship.Relationship) - the returned ``Relationship`` ...
python
def get_relationship(self, relationship_id): """Gets the ``Relationship`` specified by its ``Id``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to retrieve return: (osid.relationship.Relationship) - the returned ``Relationship`` ...
[ "def", "get_relationship", "(", "self", ",", "relationship_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resource", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'relationship...
Gets the ``Relationship`` specified by its ``Id``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to retrieve return: (osid.relationship.Relationship) - the returned ``Relationship`` raise: NotFound - no ``Relationship`` found with the ...
[ "Gets", "the", "Relationship", "specified", "by", "its", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L205-L229
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_by_ids
def get_relationships_by_ids(self, relationship_ids): """Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ``Re...
python
def get_relationships_by_ids(self, relationship_ids): """Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ``Re...
[ "def", "get_relationships_by_ids", "(", "self", ",", "relationship_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_ids", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(",...
Gets a ``RelationshipList`` corresponding to the given ``IdList``. arg: relationship_ids (osid.id.IdList): the list of ``Ids`` to retrieve return: (osid.relationship.RelationshipList) - the returned ``Relationship list`` raise: NotFound - an ``Id`` was not fo...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "IdList", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L232-L265
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_by_genus_type
def get_relationships_by_genus_type(self, relationship_genus_type): """Gets a ``RelationshipList`` corresponding to the given relationship genus ``Type`` which does not include relationships of types derived from the specified ``Type``. arg: relationship_genus_type (osid.type.Type): a relationship ...
python
def get_relationships_by_genus_type(self, relationship_genus_type): """Gets a ``RelationshipList`` corresponding to the given relationship genus ``Type`` which does not include relationships of types derived from the specified ``Type``. arg: relationship_genus_type (osid.type.Type): a relationship ...
[ "def", "get_relationships_by_genus_type", "(", "self", ",", "relationship_genus_type", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_genus_type", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONCli...
Gets a ``RelationshipList`` corresponding to the given relationship genus ``Type`` which does not include relationships of types derived from the specified ``Type``. arg: relationship_genus_type (osid.type.Type): a relationship genus type return: (osid.relationship.RelationshipList) ...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "relationship", "genus", "Type", "which", "does", "not", "include", "relationships", "of", "types", "derived", "from", "the", "specified", "Type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L268-L290
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_on_date
def get_relationships_on_date(self, from_, to): """Gets a ``RelationshipList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return: (...
python
def get_relationships_on_date(self, from_, to): """Gets a ``RelationshipList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return: (...
[ "def", "get_relationships_on_date", "(", "self", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_on_date", "relationship_list", "=", "[", "]", "for", "relationship", "in", "self", ".", "g...
Gets a ``RelationshipList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return: (osid.relationship.RelationshipList) - the relationships ...
[ "Gets", "a", "RelationshipList", "effective", "during", "the", "entire", "given", "date", "range", "inclusive", "but", "not", "confined", "to", "the", "date", "range", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L331-L350
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_for_source
def get_relationships_for_source(self, source_id): """Gets a ``RelationshipList`` corresponding to the given peer ``Id``. arg: source_id (osid.id.Id): a peer ``Id`` return: (osid.relationship.RelationshipList) - the relationships raise: NullArgument - ``source_id`` is ``null`` ...
python
def get_relationships_for_source(self, source_id): """Gets a ``RelationshipList`` corresponding to the given peer ``Id``. arg: source_id (osid.id.Id): a peer ``Id`` return: (osid.relationship.RelationshipList) - the relationships raise: NullArgument - ``source_id`` is ``null`` ...
[ "def", "get_relationships_for_source", "(", "self", ",", "source_id", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_for_source", "# NOTE: This implementation currently ignores plenary and effective views", "collection", "=", "...
Gets a ``RelationshipList`` corresponding to the given peer ``Id``. arg: source_id (osid.id.Id): a peer ``Id`` return: (osid.relationship.RelationshipList) - the relationships raise: NullArgument - ``source_id`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "peer", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L353-L373
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_for_source_on_date
def get_relationships_for_source_on_date(self, source_id, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and effective during the entire given date range inclusive but not confined to the date range. arg: source_id (osid.id.Id): a peer ``Id`` arg: from (...
python
def get_relationships_for_source_on_date(self, source_id, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and effective during the entire given date range inclusive but not confined to the date range. arg: source_id (osid.id.Id): a peer ``Id`` arg: from (...
[ "def", "get_relationships_for_source_on_date", "(", "self", ",", "source_id", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_for_source_on_date", "relationship_list", "=", "[", "]", "for", "...
Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and effective during the entire given date range inclusive but not confined to the date range. arg: source_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.Da...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "peer", "Id", "and", "effective", "during", "the", "entire", "given", "date", "range", "inclusive", "but", "not", "confined", "to", "the", "date", "range", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L376-L397
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_by_genus_type_for_source_on_date
def get_relationships_by_genus_type_for_source_on_date(self, source_id, relationship_genus_type, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and relationship genus ``Type`` and effective during the entire given date range inclusive but not confined to the date range. ...
python
def get_relationships_by_genus_type_for_source_on_date(self, source_id, relationship_genus_type, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and relationship genus ``Type`` and effective during the entire given date range inclusive but not confined to the date range. ...
[ "def", "get_relationships_by_genus_type_for_source_on_date", "(", "self", ",", "source_id", ",", "relationship_genus_type", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_by_genus_type_for_source_on...
Gets a ``RelationshipList`` corresponding to the given peer ``Id`` and relationship genus ``Type`` and effective during the entire given date range inclusive but not confined to the date range. arg: source_id (osid.id.Id): a peer ``Id`` arg: relationship_genus_type (osid.type.Type): a relationshi...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "peer", "Id", "and", "relationship", "genus", "Type", "and", "effective", "during", "the", "entire", "given", "date", "range", "inclusive", "but", "not", "confined", "to", "the", "date", "...
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L441-L464
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships_for_destination_on_date
def get_relationships_for_destination_on_date(self, destination_id, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` with a starting effective date in the given range inclusive. arg: destination_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.Da...
python
def get_relationships_for_destination_on_date(self, destination_id, from_, to): """Gets a ``RelationshipList`` corresponding to the given peer ``Id`` with a starting effective date in the given range inclusive. arg: destination_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.Da...
[ "def", "get_relationships_for_destination_on_date", "(", "self", ",", "destination_id", ",", "from_", ",", "to", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipLookupSession.get_relationships_for_destination_on_date", "relationship_list", "=", "[", "]...
Gets a ``RelationshipList`` corresponding to the given peer ``Id`` with a starting effective date in the given range inclusive. arg: destination_id (osid.id.Id): a peer ``Id`` arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date ...
[ "Gets", "a", "RelationshipList", "corresponding", "to", "the", "given", "peer", "Id", "with", "a", "starting", "effective", "date", "in", "the", "given", "range", "inclusive", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L490-L511
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipLookupSession.get_relationships
def get_relationships(self): """Gets all ``Relationships``. return: (osid.relationship.RelationshipList) - a list of ``Relationships`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- ...
python
def get_relationships(self): """Gets all ``Relationships``. return: (osid.relationship.RelationshipList) - a list of ``Relationships`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- ...
[ "def", "get_relationships", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'relationship'", ",", "collection",...
Gets all ``Relationships``. return: (osid.relationship.RelationshipList) - a list of ``Relationships`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implemented.*
[ "Gets", "all", "Relationships", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L681-L698
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipQuerySession.get_relationships_by_query
def get_relationships_by_query(self, relationship_query): """Gets a list of ``Relationships`` matching the given relationship query. arg: relationship_query (osid.relationship.RelationshipQuery): the relationship query return: (osid.relationship.RelationshipLi...
python
def get_relationships_by_query(self, relationship_query): """Gets a list of ``Relationships`` matching the given relationship query. arg: relationship_query (osid.relationship.RelationshipQuery): the relationship query return: (osid.relationship.RelationshipLi...
[ "def", "get_relationships_by_query", "(", "self", ",", "relationship_query", ")", ":", "# Implemented from template for", "# osid.resource.ResourceQuerySession.get_resources_by_query", "and_list", "=", "list", "(", ")", "or_list", "=", "list", "(", ")", "for", "term", "in...
Gets a list of ``Relationships`` matching the given relationship query. arg: relationship_query (osid.relationship.RelationshipQuery): the relationship query return: (osid.relationship.RelationshipList) - the returned ``RelationshipList`` raise...
[ "Gets", "a", "list", "of", "Relationships", "matching", "the", "given", "relationship", "query", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L814-L856
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipAdminSession.get_relationship_form_for_create
def get_relationship_form_for_create(self, source_id, destination_id, relationship_record_types): """Gets the relationship form for creating new relationships. A new form should be requested for each create transaction. arg: source_id (osid.id.Id): ``Id`` of a peer arg: destinati...
python
def get_relationship_form_for_create(self, source_id, destination_id, relationship_record_types): """Gets the relationship form for creating new relationships. A new form should be requested for each create transaction. arg: source_id (osid.id.Id): ``Id`` of a peer arg: destinati...
[ "def", "get_relationship_form_for_create", "(", "self", ",", "source_id", ",", "destination_id", ",", "relationship_record_types", ")", ":", "# Implemented from template for", "# osid.relationship.RelationshipAdminSession.get_relationship_form_for_create", "# These really need to be in m...
Gets the relationship form for creating new relationships. A new form should be requested for each create transaction. arg: source_id (osid.id.Id): ``Id`` of a peer arg: destination_id (osid.id.Id): ``Id`` of the related peer arg: relationship_record_types (osid.type.Type[]): ...
[ "Gets", "the", "relationship", "form", "for", "creating", "new", "relationships", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L982-L1036
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipAdminSession.create_relationship
def create_relationship(self, relationship_form): """Creates a new ``Relationship``. arg: relationship_form (osid.relationship.RelationshipForm): the form for this ``Relationship`` return: (osid.relationship.Relationship) - the new ``Relationship`` rai...
python
def create_relationship(self, relationship_form): """Creates a new ``Relationship``. arg: relationship_form (osid.relationship.RelationshipForm): the form for this ``Relationship`` return: (osid.relationship.Relationship) - the new ``Relationship`` rai...
[ "def", "create_relationship", "(", "self", ",", "relationship_form", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.create_resource_template", "collection", "=", "JSONClientValidated", "(", "'relationship'", ",", "collection", "=", "'Relationsh...
Creates a new ``Relationship``. arg: relationship_form (osid.relationship.RelationshipForm): the form for this ``Relationship`` return: (osid.relationship.Relationship) - the new ``Relationship`` raise: IllegalState - ``relationship_form`` already used in a ...
[ "Creates", "a", "new", "Relationship", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1039-L1082
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipAdminSession.update_relationship
def update_relationship(self, relationship_form): """Updates an existing relationship. arg: relationship_form (osid.relationship.RelationshipForm): the form containing the elements to be updated raise: IllegalState - ``relationship_form`` already used in an u...
python
def update_relationship(self, relationship_form): """Updates an existing relationship. arg: relationship_form (osid.relationship.RelationshipForm): the form containing the elements to be updated raise: IllegalState - ``relationship_form`` already used in an u...
[ "def", "update_relationship", "(", "self", ",", "relationship_form", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.update_resource_template", "collection", "=", "JSONClientValidated", "(", "'relationship'", ",", "collection", "=", "'Relationsh...
Updates an existing relationship. arg: relationship_form (osid.relationship.RelationshipForm): the form containing the elements to be updated raise: IllegalState - ``relationship_form`` already used in an update transaction raise: InvalidArgument - the form ...
[ "Updates", "an", "existing", "relationship", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1140-L1180
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipAdminSession.delete_relationship
def delete_relationship(self, relationship_id): """Deletes a ``Relationship``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to remove raise: NotFound - ``relationship_id`` not found raise: NullArgument - ``relationship_id`` is ``null`` ...
python
def delete_relationship(self, relationship_id): """Deletes a ``Relationship``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to remove raise: NotFound - ``relationship_id`` not found raise: NullArgument - ``relationship_id`` is ``null`` ...
[ "def", "delete_relationship", "(", "self", ",", "relationship_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.delete_resource_template", "collection", "=", "JSONClientValidated", "(", "'relationship'", ",", "collection", "=", "'Relationship...
Deletes a ``Relationship``. arg: relationship_id (osid.id.Id): the ``Id`` of the ``Relationship`` to remove raise: NotFound - ``relationship_id`` not found raise: NullArgument - ``relationship_id`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Deletes", "a", "Relationship", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1203-L1227
mitsei/dlkit
dlkit/json_/relationship/sessions.py
RelationshipAdminSession.alias_relationship
def alias_relationship(self, relationship_id, alias_id): """Adds an ``Id`` to a ``Relationship`` for the purpose of creating compatibility. The primary ``Id`` of the ``Relationship`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias i...
python
def alias_relationship(self, relationship_id, alias_id): """Adds an ``Id`` to a ``Relationship`` for the purpose of creating compatibility. The primary ``Id`` of the ``Relationship`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias i...
[ "def", "alias_relationship", "(", "self", ",", "relationship_id", ",", "alias_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.alias_resources_template", "self", ".", "_alias_id", "(", "primary_id", "=", "relationship_id", ",", "equivale...
Adds an ``Id`` to a ``Relationship`` for the purpose of creating compatibility. The primary ``Id`` of the ``Relationship`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another relationship, it is reassigned to the...
[ "Adds", "an", "Id", "to", "a", "Relationship", "for", "the", "purpose", "of", "creating", "compatibility", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1248-L1270
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyAdminSession.can_create_family_with_record_types
def can_create_family_with_record_types(self, family_record_types): """Tests if this user can create a single ``Family`` using the desired record types. While ``RelationshipManager.getFamilyRecordTypes()`` can be used to examine which records are supported, this method tests which recor...
python
def can_create_family_with_record_types(self, family_record_types): """Tests if this user can create a single ``Family`` using the desired record types. While ``RelationshipManager.getFamilyRecordTypes()`` can be used to examine which records are supported, this method tests which recor...
[ "def", "can_create_family_with_record_types", "(", "self", ",", "family_record_types", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.can_create_bin_with_record_types", "# NOTE: It is expected that real authentication hints will be", "# handled in a service adapt...
Tests if this user can create a single ``Family`` using the desired record types. While ``RelationshipManager.getFamilyRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a specific ``Family``. Providing an empt...
[ "Tests", "if", "this", "user", "can", "create", "a", "single", "Family", "using", "the", "desired", "record", "types", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1612-L1636
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyAdminSession.update_family
def update_family(self, family_form): """Updates an existing family. arg: family_form (osid.relationship.FamilyForm): the form containing the elements to be updated raise: IllegalState - ``family_form`` already used in an update transaction raise: In...
python
def update_family(self, family_form): """Updates an existing family. arg: family_form (osid.relationship.FamilyForm): the form containing the elements to be updated raise: IllegalState - ``family_form`` already used in an update transaction raise: In...
[ "def", "update_family", "(", "self", ",", "family_form", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.update_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", ...
Updates an existing family. arg: family_form (osid.relationship.FamilyForm): the form containing the elements to be updated raise: IllegalState - ``family_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid valu...
[ "Updates", "an", "existing", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1778-L1818
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyAdminSession.alias_family
def alias_family(self, family_id, alias_id): """Adds an ``Id`` to a ``Family`` for the purpose of creating compatibility. The primary ``Id`` of the ``Family`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another f...
python
def alias_family(self, family_id, alias_id): """Adds an ``Id`` to a ``Family`` for the purpose of creating compatibility. The primary ``Id`` of the ``Family`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another f...
[ "def", "alias_family", "(", "self", ",", "family_id", ",", "alias_id", ")", ":", "# Implemented from template for", "# osid.resource.BinLookupSession.alias_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_s...
Adds an ``Id`` to a ``Family`` for the purpose of creating compatibility. The primary ``Id`` of the ``Family`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another family, it is reassigned to the given family ``Id...
[ "Adds", "an", "Id", "to", "a", "Family", "for", "the", "purpose", "of", "creating", "compatibility", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L1891-L1913
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_root_families
def get_root_families(self): """Gets the root families in the family hierarchy. A node with no parents is an orphan. While all family ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node. ...
python
def get_root_families(self): """Gets the root families in the family hierarchy. A node with no parents is an orphan. While all family ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node. ...
[ "def", "get_root_families", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_root_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "get_root_catalogs", ...
Gets the root families in the family hierarchy. A node with no parents is an orphan. While all family ``Ids`` are known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node. return: (osid.relationship.Famil...
[ "Gets", "the", "root", "families", "in", "the", "family", "hierarchy", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2065-L2085
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.has_parent_families
def has_parent_families(self, family_id): """Tests if the ``Family`` has any parents. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the family has parents, ``false`` otherwise raise: NotFound - ``family_id`` is not found ...
python
def has_parent_families(self, family_id): """Tests if the ``Family`` has any parents. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the family has parents, ``false`` otherwise raise: NotFound - ``family_id`` is not found ...
[ "def", "has_parent_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.has_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", "."...
Tests if the ``Family`` has any parents. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the family has parents, ``false`` otherwise raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` is ``null`` ...
[ "Tests", "if", "the", "Family", "has", "any", "parents", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2090-L2107
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.is_parent_of_family
def is_parent_of_family(self, id_, family_id): """Tests if an ``Id`` is a direct parent of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is a parent of ``family_id,`` ``fal...
python
def is_parent_of_family(self, id_, family_id): """Tests if an ``Id`` is a direct parent of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is a parent of ``family_id,`` ``fal...
[ "def", "is_parent_of_family", "(", "self", ",", "id_", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_parent_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalo...
Tests if an ``Id`` is a direct parent of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is a parent of ``family_id,`` ``false`` otherwise raise: NotFound - ``family_id`` is...
[ "Tests", "if", "an", "Id", "is", "a", "direct", "parent", "of", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2110-L2129
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_parent_family_ids
def get_parent_family_ids(self, family_id): """Gets the parent ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` of a family return: (osid.id.IdList) - the parent ``Ids`` of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``f...
python
def get_parent_family_ids(self, family_id): """Gets the parent ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` of a family return: (osid.id.IdList) - the parent ``Ids`` of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``f...
[ "def", "get_parent_family_ids", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_parent_bin_ids", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ...
Gets the parent ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` of a family return: (osid.id.IdList) - the parent ``Ids`` of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed ...
[ "Gets", "the", "parent", "Ids", "of", "the", "given", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2132-L2148
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_parent_families
def get_parent_families(self, family_id): """Gets the parent families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the parent families of the ``id`` raise: NotFound - ...
python
def get_parent_families(self, family_id): """Gets the parent families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the parent families of the ``id`` raise: NotFound - ...
[ "def", "get_parent_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_parent_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", "."...
Gets the parent families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the parent families of the ``id`` raise: NotFound - a ``Family`` identified by ``Id is`` not ...
[ "Gets", "the", "parent", "families", "of", "the", "given", "id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2151-L2173
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.is_ancestor_of_family
def is_ancestor_of_family(self, id_, family_id): """Tests if an ``Id`` is an ancestor of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is an ancestor of ``family_id,`` ``fa...
python
def is_ancestor_of_family(self, id_, family_id): """Tests if an ``Id`` is an ancestor of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is an ancestor of ``family_id,`` ``fa...
[ "def", "is_ancestor_of_family", "(", "self", ",", "id_", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_ancestor_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_ca...
Tests if an ``Id`` is an ancestor of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if this ``id`` is an ancestor of ``family_id,`` ``false`` otherwise raise: NotFound - ``family_id`` is ...
[ "Tests", "if", "an", "Id", "is", "an", "ancestor", "of", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2176-L2195
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.has_child_families
def has_child_families(self, family_id): """Tests if a family has any children. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``family_id`` has children, ``false`` otherwise raise: NotFound - ``family_id`` is not found ...
python
def has_child_families(self, family_id): """Tests if a family has any children. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``family_id`` has children, ``false`` otherwise raise: NotFound - ``family_id`` is not found ...
[ "def", "has_child_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.has_child_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", ...
Tests if a family has any children. arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``family_id`` has children, ``false`` otherwise raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` is ``null`` ...
[ "Tests", "if", "a", "family", "has", "any", "children", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2198-L2215
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.is_child_of_family
def is_child_of_family(self, id_, family_id): """Tests if a family is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a child of ``family_id,`` ``false`` o...
python
def is_child_of_family(self, id_, family_id): """Tests if a family is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a child of ``family_id,`` ``false`` o...
[ "def", "is_child_of_family", "(", "self", ",", "id_", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_child_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_...
Tests if a family is a direct child of another. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a child of ``family_id,`` ``false`` otherwise raise: NotFound - ``family_id`` is not ...
[ "Tests", "if", "a", "family", "is", "a", "direct", "child", "of", "another", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2218-L2237
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_child_family_ids
def get_child_family_ids(self, family_id): """Gets the child ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` ...
python
def get_child_family_ids(self, family_id): """Gets the child ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` ...
[ "def", "get_child_family_ids", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_child_bin_ids", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ...
Gets the child ``Ids`` of the given family. arg: family_id (osid.id.Id): the ``Id`` to query return: (osid.id.IdList) - the children of the family raise: NotFound - ``family_id`` is not found raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable t...
[ "Gets", "the", "child", "Ids", "of", "the", "given", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2240-L2256
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_child_families
def get_child_families(self, family_id): """Gets the child families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the child families of the ``id`` raise: NotFound - a `...
python
def get_child_families(self, family_id): """Gets the child families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the child families of the ``id`` raise: NotFound - a `...
[ "def", "get_child_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_child_bins", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", ...
Gets the child families of the given ``id``. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` to query return: (osid.relationship.FamilyList) - the child families of the ``id`` raise: NotFound - a ``Family`` identified by ``Id is`` not ...
[ "Gets", "the", "child", "families", "of", "the", "given", "id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2259-L2281
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.is_descendant_of_family
def is_descendant_of_family(self, id_, family_id): """Tests if an ``Id`` is a descendant of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a descendant of the ``family_id,`...
python
def is_descendant_of_family(self, id_, family_id): """Tests if an ``Id`` is a descendant of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a descendant of the ``family_id,`...
[ "def", "is_descendant_of_family", "(", "self", ",", "id_", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.is_descendant_of_bin", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", ...
Tests if an ``Id`` is a descendant of a family. arg: id (osid.id.Id): an ``Id`` arg: family_id (osid.id.Id): the ``Id`` of a family return: (boolean) - ``true`` if the ``id`` is a descendant of the ``family_id,`` ``false`` otherwise raise: NotFound - ``family_id`...
[ "Tests", "if", "an", "Id", "is", "a", "descendant", "of", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2284-L2303
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchySession.get_family_nodes
def get_family_nodes(self, family_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given family. arg: family_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to ...
python
def get_family_nodes(self, family_id, ancestor_levels, descendant_levels, include_siblings): """Gets a portion of the hierarchy for the given family. arg: family_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to ...
[ "def", "get_family_nodes", "(", "self", ",", "family_id", ",", "ancestor_levels", ",", "descendant_levels", ",", "include_siblings", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchySession.get_bin_nodes", "return", "objects", ".", "FamilyNode", "(", ...
Gets a portion of the hierarchy for the given family. arg: family_id (osid.id.Id): the ``Id`` to query arg: ancestor_levels (cardinal): the maximum number of ancestor levels to include. A value of 0 returns no parents in the node. arg: descendant_levels ...
[ "Gets", "a", "portion", "of", "the", "hierarchy", "for", "the", "given", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2342-L2369
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.add_root_family
def add_root_family(self, family_id): """Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` r...
python
def add_root_family(self, family_id): """Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` r...
[ "def", "add_root_family", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.add_root_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session...
Adds a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: AlreadyExists - ``family_id`` is already in hierarchy raise: NotFound - ``family_id`` not found raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete reque...
[ "Adds", "a", "root", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2456-L2472
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.remove_root_family
def remove_root_family(self, family_id): """Removes a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not a root raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete request rai...
python
def remove_root_family(self, family_id): """Removes a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not a root raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete request rai...
[ "def", "remove_root_family", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_root_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_s...
Removes a root family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not a root raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure ...
[ "Removes", "a", "root", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2475-L2490
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.add_child_family
def add_child_family(self, family_id, child_id): """Adds a child to a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``family_id`` is already a parent of ``child_id`` ...
python
def add_child_family(self, family_id, child_id): """Adds a child to a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``family_id`` is already a parent of ``child_id`` ...
[ "def", "add_child_family", "(", "self", ",", "family_id", ",", "child_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.add_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", "...
Adds a child to a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: AlreadyExists - ``family_id`` is already a parent of ``child_id`` raise: NotFound - ``family_id`` or ``child_id`` not foun...
[ "Adds", "a", "child", "to", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2493-L2511
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.remove_child_family
def remove_child_family(self, family_id, child_id): """Removes a child from a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``family_id`` not a parent of ``child_id`` raise: NullArgum...
python
def remove_child_family(self, family_id, child_id): """Removes a child from a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``family_id`` not a parent of ``child_id`` raise: NullArgum...
[ "def", "remove_child_family", "(", "self", ",", "family_id", ",", "child_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self...
Removes a child from a family. arg: family_id (osid.id.Id): the ``Id`` of a family arg: child_id (osid.id.Id): the ``Id`` of the new child raise: NotFound - ``family_id`` not a parent of ``child_id`` raise: NullArgument - ``family_id`` or ``child_id`` is ``null`` raise: ...
[ "Removes", "a", "child", "from", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2514-L2530
mitsei/dlkit
dlkit/json_/relationship/sessions.py
FamilyHierarchyDesignSession.remove_child_families
def remove_child_families(self, family_id): """Removes all children from a family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not in hierarchy raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to comple...
python
def remove_child_families(self, family_id): """Removes all children from a family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not in hierarchy raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to comple...
[ "def", "remove_child_families", "(", "self", ",", "family_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catal...
Removes all children from a family. arg: family_id (osid.id.Id): the ``Id`` of a family raise: NotFound - ``family_id`` not in hierarchy raise: NullArgument - ``family_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authoriza...
[ "Removes", "all", "children", "from", "a", "family", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/sessions.py#L2533-L2548