repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
brunato/lograptor
lograptor/cache.py
LookupCache.map_value
def map_value(self, value, gid): """ Return the value for a group id, applying requested mapping. Map only groups related to a filter, ie when the basename of the group is identical to the name of a filter. """ base_gid = self.base_gid_pattern.search(gid).group(1) ...
python
def map_value(self, value, gid): """ Return the value for a group id, applying requested mapping. Map only groups related to a filter, ie when the basename of the group is identical to the name of a filter. """ base_gid = self.base_gid_pattern.search(gid).group(1) ...
[ "def", "map_value", "(", "self", ",", "value", ",", "gid", ")", ":", "base_gid", "=", "self", ".", "base_gid_pattern", ".", "search", "(", "gid", ")", ".", "group", "(", "1", ")", "if", "self", ".", "anonymyze", ":", "try", ":", "if", "value", "in"...
Return the value for a group id, applying requested mapping. Map only groups related to a filter, ie when the basename of the group is identical to the name of a filter.
[ "Return", "the", "value", "for", "a", "group", "id", "applying", "requested", "mapping", ".", "Map", "only", "groups", "related", "to", "a", "filter", "ie", "when", "the", "basename", "of", "the", "group", "is", "identical", "to", "the", "name", "of", "a...
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/cache.py#L69-L101
train
brunato/lograptor
lograptor/cache.py
LookupCache.match_to_dict
def match_to_dict(self, match, gids): """ Map values from match into a dictionary. """ values = {} for gid in gids: try: values[gid] = self.map_value(match.group(gid), gid) except IndexError: pass return values
python
def match_to_dict(self, match, gids): """ Map values from match into a dictionary. """ values = {} for gid in gids: try: values[gid] = self.map_value(match.group(gid), gid) except IndexError: pass return values
[ "def", "match_to_dict", "(", "self", ",", "match", ",", "gids", ")", ":", "values", "=", "{", "}", "for", "gid", "in", "gids", ":", "try", ":", "values", "[", "gid", "]", "=", "self", ".", "map_value", "(", "match", ".", "group", "(", "gid", ")",...
Map values from match into a dictionary.
[ "Map", "values", "from", "match", "into", "a", "dictionary", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/cache.py#L103-L113
train
brunato/lograptor
lograptor/cache.py
LookupCache.match_to_string
def match_to_string(self, match, gids, values=None): """ Return the mapped string from match object. If a dictionary of values is provided then use it to build the string. """ s = match.string parts = [] k = 0 for gid in sorted(gids, key=lambda x: gids[x])...
python
def match_to_string(self, match, gids, values=None): """ Return the mapped string from match object. If a dictionary of values is provided then use it to build the string. """ s = match.string parts = [] k = 0 for gid in sorted(gids, key=lambda x: gids[x])...
[ "def", "match_to_string", "(", "self", ",", "match", ",", "gids", ",", "values", "=", "None", ")", ":", "s", "=", "match", ".", "string", "parts", "=", "[", "]", "k", "=", "0", "for", "gid", "in", "sorted", "(", "gids", ",", "key", "=", "lambda",...
Return the mapped string from match object. If a dictionary of values is provided then use it to build the string.
[ "Return", "the", "mapped", "string", "from", "match", "object", ".", "If", "a", "dictionary", "of", "values", "is", "provided", "then", "use", "it", "to", "build", "the", "string", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/cache.py#L115-L137
train
brunato/lograptor
lograptor/cache.py
LookupCache.gethost
def gethost(self, ip_addr): """ Do reverse lookup on an ip address """ # Handle silly fake ipv6 addresses try: if ip_addr[:7] == '::ffff:': ip_addr = ip_addr[7:] except TypeError: pass if ip_addr[0] in string.letters: ...
python
def gethost(self, ip_addr): """ Do reverse lookup on an ip address """ # Handle silly fake ipv6 addresses try: if ip_addr[:7] == '::ffff:': ip_addr = ip_addr[7:] except TypeError: pass if ip_addr[0] in string.letters: ...
[ "def", "gethost", "(", "self", ",", "ip_addr", ")", ":", "try", ":", "if", "ip_addr", "[", ":", "7", "]", "==", "'::ffff:'", ":", "ip_addr", "=", "ip_addr", "[", "7", ":", "]", "except", "TypeError", ":", "pass", "if", "ip_addr", "[", "0", "]", "...
Do reverse lookup on an ip address
[ "Do", "reverse", "lookup", "on", "an", "ip", "address" ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/cache.py#L139-L164
train
brunato/lograptor
lograptor/cache.py
LookupCache.getuname
def getuname(self, uid): """ Get the username of a given uid. """ uid = int(uid) try: return self.uidsmap[uid] except KeyError: pass try: name = pwd.getpwuid(uid)[0] except (KeyError, AttributeError): name =...
python
def getuname(self, uid): """ Get the username of a given uid. """ uid = int(uid) try: return self.uidsmap[uid] except KeyError: pass try: name = pwd.getpwuid(uid)[0] except (KeyError, AttributeError): name =...
[ "def", "getuname", "(", "self", ",", "uid", ")", ":", "uid", "=", "int", "(", "uid", ")", "try", ":", "return", "self", ".", "uidsmap", "[", "uid", "]", "except", "KeyError", ":", "pass", "try", ":", "name", "=", "pwd", ".", "getpwuid", "(", "uid...
Get the username of a given uid.
[ "Get", "the", "username", "of", "a", "given", "uid", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/cache.py#L166-L182
train
mardix/Mocha
mocha/core.py
redirect
def redirect(endpoint, **kw): """ Redirect allow to redirect dynamically using the classes methods without knowing the right endpoint. Expecting all endpoint have GET as method, it will try to pick the first match, based on the endpoint provided or the based on the Rule map_url An endpoint can ...
python
def redirect(endpoint, **kw): """ Redirect allow to redirect dynamically using the classes methods without knowing the right endpoint. Expecting all endpoint have GET as method, it will try to pick the first match, based on the endpoint provided or the based on the Rule map_url An endpoint can ...
[ "def", "redirect", "(", "endpoint", ",", "**", "kw", ")", ":", "_endpoint", "=", "None", "if", "isinstance", "(", "endpoint", ",", "six", ".", "string_types", ")", ":", "_endpoint", "=", "endpoint", "if", "\"/\"", "in", "endpoint", ":", "return", "f_redi...
Redirect allow to redirect dynamically using the classes methods without knowing the right endpoint. Expecting all endpoint have GET as method, it will try to pick the first match, based on the endpoint provided or the based on the Rule map_url An endpoint can also be passed along with **kw An htt...
[ "Redirect", "allow", "to", "redirect", "dynamically", "using", "the", "classes", "methods", "without", "knowing", "the", "right", "endpoint", ".", "Expecting", "all", "endpoint", "have", "GET", "as", "method", "it", "will", "try", "to", "pick", "the", "first",...
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L395-L442
train
mardix/Mocha
mocha/core.py
get_true_argspec
def get_true_argspec(method): """Drills through layers of decorators attempting to locate the actual argspec for the method.""" argspec = inspect.getargspec(method) args = argspec[0] if args and args[0] == 'self': return argspec if hasattr(method, '__func__'): method = method.__func...
python
def get_true_argspec(method): """Drills through layers of decorators attempting to locate the actual argspec for the method.""" argspec = inspect.getargspec(method) args = argspec[0] if args and args[0] == 'self': return argspec if hasattr(method, '__func__'): method = method.__func...
[ "def", "get_true_argspec", "(", "method", ")", ":", "argspec", "=", "inspect", ".", "getargspec", "(", "method", ")", "args", "=", "argspec", "[", "0", "]", "if", "args", "and", "args", "[", "0", "]", "==", "'self'", ":", "return", "argspec", "if", "...
Drills through layers of decorators attempting to locate the actual argspec for the method.
[ "Drills", "through", "layers", "of", "decorators", "attempting", "to", "locate", "the", "actual", "argspec", "for", "the", "method", "." ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L1215-L1237
train
mardix/Mocha
mocha/core.py
Mocha.setup_installed_apps
def setup_installed_apps(cls): """ To import 3rd party applications along with associated properties It is a list of dict or string. When a dict, it contains the `app` key and the configuration, if it's a string, it is just the app name If you require dependencies from...
python
def setup_installed_apps(cls): """ To import 3rd party applications along with associated properties It is a list of dict or string. When a dict, it contains the `app` key and the configuration, if it's a string, it is just the app name If you require dependencies from...
[ "def", "setup_installed_apps", "(", "cls", ")", ":", "cls", ".", "_installed_apps", "=", "cls", ".", "_app", ".", "config", ".", "get", "(", "\"INSTALLED_APPS\"", ",", "[", "]", ")", "if", "cls", ".", "_installed_apps", ":", "def", "import_app", "(", "mo...
To import 3rd party applications along with associated properties It is a list of dict or string. When a dict, it contains the `app` key and the configuration, if it's a string, it is just the app name If you require dependencies from other packages, dependencies must be place...
[ "To", "import", "3rd", "party", "applications", "along", "with", "associated", "properties" ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L746-L787
train
mardix/Mocha
mocha/core.py
Mocha._add_asset_bundle
def _add_asset_bundle(cls, path): """ Add a webassets bundle yml file """ f = "%s/assets.yml" % path if os.path.isfile(f): cls._asset_bundles.add(f)
python
def _add_asset_bundle(cls, path): """ Add a webassets bundle yml file """ f = "%s/assets.yml" % path if os.path.isfile(f): cls._asset_bundles.add(f)
[ "def", "_add_asset_bundle", "(", "cls", ",", "path", ")", ":", "f", "=", "\"%s/assets.yml\"", "%", "path", "if", "os", ".", "path", ".", "isfile", "(", "f", ")", ":", "cls", ".", "_asset_bundles", ".", "add", "(", "f", ")" ]
Add a webassets bundle yml file
[ "Add", "a", "webassets", "bundle", "yml", "file" ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L825-L831
train
mardix/Mocha
mocha/core.py
Mocha._setup_db
def _setup_db(cls): """ Setup the DB connection if DB_URL is set """ uri = cls._app.config.get("DB_URL") if uri: db.connect__(uri, cls._app)
python
def _setup_db(cls): """ Setup the DB connection if DB_URL is set """ uri = cls._app.config.get("DB_URL") if uri: db.connect__(uri, cls._app)
[ "def", "_setup_db", "(", "cls", ")", ":", "uri", "=", "cls", ".", "_app", ".", "config", ".", "get", "(", "\"DB_URL\"", ")", "if", "uri", ":", "db", ".", "connect__", "(", "uri", ",", "cls", ".", "_app", ")" ]
Setup the DB connection if DB_URL is set
[ "Setup", "the", "DB", "connection", "if", "DB_URL", "is", "set" ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L858-L864
train
mardix/Mocha
mocha/core.py
Mocha.parse_options
def parse_options(cls, options): """Extracts subdomain and endpoint values from the options dict and returns them along with a new dict without those values. """ options = options.copy() subdomain = options.pop('subdomain', None) endpoint = options.pop('endpoint', None...
python
def parse_options(cls, options): """Extracts subdomain and endpoint values from the options dict and returns them along with a new dict without those values. """ options = options.copy() subdomain = options.pop('subdomain', None) endpoint = options.pop('endpoint', None...
[ "def", "parse_options", "(", "cls", ",", "options", ")", ":", "options", "=", "options", ".", "copy", "(", ")", "subdomain", "=", "options", ".", "pop", "(", "'subdomain'", ",", "None", ")", "endpoint", "=", "options", ".", "pop", "(", "'endpoint'", ",...
Extracts subdomain and endpoint values from the options dict and returns them along with a new dict without those values.
[ "Extracts", "subdomain", "and", "endpoint", "values", "from", "the", "options", "dict", "and", "returns", "them", "along", "with", "a", "new", "dict", "without", "those", "values", "." ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L1002-L1009
train
mardix/Mocha
mocha/core.py
Mocha.get_base_route
def get_base_route(cls): """Returns the route base to use for the current class.""" base_route = cls.__name__.lower() if cls.base_route is not None: base_route = cls.base_route base_rule = parse_rule(base_route) cls.base_args = [r[2] for r in base_rule] ...
python
def get_base_route(cls): """Returns the route base to use for the current class.""" base_route = cls.__name__.lower() if cls.base_route is not None: base_route = cls.base_route base_rule = parse_rule(base_route) cls.base_args = [r[2] for r in base_rule] ...
[ "def", "get_base_route", "(", "cls", ")", ":", "base_route", "=", "cls", ".", "__name__", ".", "lower", "(", ")", "if", "cls", ".", "base_route", "is", "not", "None", ":", "base_route", "=", "cls", ".", "base_route", "base_rule", "=", "parse_rule", "(", ...
Returns the route base to use for the current class.
[ "Returns", "the", "route", "base", "to", "use", "for", "the", "current", "class", "." ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/core.py#L1119-L1126
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph.find_gene_by_name
def find_gene_by_name(self, gene_name: str) -> Gene: """ Find and return a gene in the influence graph with the given name. Raise an AttributeError if there is no gene in the graph with the given name. """ for gene in self.genes: if gene.name == gene_name: ...
python
def find_gene_by_name(self, gene_name: str) -> Gene: """ Find and return a gene in the influence graph with the given name. Raise an AttributeError if there is no gene in the graph with the given name. """ for gene in self.genes: if gene.name == gene_name: ...
[ "def", "find_gene_by_name", "(", "self", ",", "gene_name", ":", "str", ")", "->", "Gene", ":", "for", "gene", "in", "self", ".", "genes", ":", "if", "gene", ".", "name", "==", "gene_name", ":", "return", "gene", "raise", "AttributeError", "(", "f'gene \"...
Find and return a gene in the influence graph with the given name. Raise an AttributeError if there is no gene in the graph with the given name.
[ "Find", "and", "return", "a", "gene", "in", "the", "influence", "graph", "with", "the", "given", "name", ".", "Raise", "an", "AttributeError", "if", "there", "is", "no", "gene", "in", "the", "graph", "with", "the", "given", "name", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L24-L32
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph.find_multiplex_by_name
def find_multiplex_by_name(self, multiplex_name: str) -> Multiplex: """ Find and return a multiplex in the influence graph with the given name. Raise an AttributeError if there is no multiplex in the graph with the given name. """ for multiplex in self.multiplexes: i...
python
def find_multiplex_by_name(self, multiplex_name: str) -> Multiplex: """ Find and return a multiplex in the influence graph with the given name. Raise an AttributeError if there is no multiplex in the graph with the given name. """ for multiplex in self.multiplexes: i...
[ "def", "find_multiplex_by_name", "(", "self", ",", "multiplex_name", ":", "str", ")", "->", "Multiplex", ":", "for", "multiplex", "in", "self", ".", "multiplexes", ":", "if", "multiplex", ".", "name", "==", "multiplex_name", ":", "return", "multiplex", "raise"...
Find and return a multiplex in the influence graph with the given name. Raise an AttributeError if there is no multiplex in the graph with the given name.
[ "Find", "and", "return", "a", "multiplex", "in", "the", "influence", "graph", "with", "the", "given", "name", ".", "Raise", "an", "AttributeError", "if", "there", "is", "no", "multiplex", "in", "the", "graph", "with", "the", "given", "name", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L38-L46
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph.all_states
def all_states(self) -> Tuple[State, ...]: """ Return all the possible states of this influence graph. """ return tuple(self._transform_list_of_states_to_state(states) for states in self._cartesian_product_of_every_states_of_each_genes())
python
def all_states(self) -> Tuple[State, ...]: """ Return all the possible states of this influence graph. """ return tuple(self._transform_list_of_states_to_state(states) for states in self._cartesian_product_of_every_states_of_each_genes())
[ "def", "all_states", "(", "self", ")", "->", "Tuple", "[", "State", ",", "...", "]", ":", "return", "tuple", "(", "self", ".", "_transform_list_of_states_to_state", "(", "states", ")", "for", "states", "in", "self", ".", "_cartesian_product_of_every_states_of_ea...
Return all the possible states of this influence graph.
[ "Return", "all", "the", "possible", "states", "of", "this", "influence", "graph", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L48-L51
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph._cartesian_product_of_every_states_of_each_genes
def _cartesian_product_of_every_states_of_each_genes(self) -> Tuple[Tuple[int, ...]]: """ Private method which return the cartesian product of the states of the genes in the model. It represents all the possible state for a given model. Examples -------- The model cont...
python
def _cartesian_product_of_every_states_of_each_genes(self) -> Tuple[Tuple[int, ...]]: """ Private method which return the cartesian product of the states of the genes in the model. It represents all the possible state for a given model. Examples -------- The model cont...
[ "def", "_cartesian_product_of_every_states_of_each_genes", "(", "self", ")", "->", "Tuple", "[", "Tuple", "[", "int", ",", "...", "]", "]", ":", "if", "not", "self", ".", "genes", ":", "return", "(", ")", "return", "tuple", "(", "product", "(", "*", "[",...
Private method which return the cartesian product of the states of the genes in the model. It represents all the possible state for a given model. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} Then this metho...
[ "Private", "method", "which", "return", "the", "cartesian", "product", "of", "the", "states", "of", "the", "genes", "in", "the", "model", ".", "It", "represents", "all", "the", "possible", "state", "for", "a", "given", "model", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L53-L69
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/influence_graph.py
InfluenceGraph._transform_list_of_states_to_state
def _transform_list_of_states_to_state(self, state: List[int]) -> State: """ Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} ...
python
def _transform_list_of_states_to_state(self, state: List[int]) -> State: """ Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} ...
[ "def", "_transform_list_of_states_to_state", "(", "self", ",", "state", ":", "List", "[", "int", "]", ")", "->", "State", ":", "return", "State", "(", "{", "gene", ":", "state", "[", "i", "]", "for", "i", ",", "gene", "in", "enumerate", "(", "self", ...
Private method which transform a list which contains the state of the gene in the models to a State object. Examples -------- The model contains 2 genes: operon = {0, 1, 2} mucuB = {0, 1} >>> graph._transform_list_of_states_to_dict_of_states(...
[ "Private", "method", "which", "transform", "a", "list", "which", "contains", "the", "state", "of", "the", "gene", "in", "the", "models", "to", "a", "State", "object", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/influence_graph.py#L71-L86
train
Kortemme-Lab/klab
klab/box_backup.py
read_sha1
def read_sha1( file_path, buf_size = None, start_byte = 0, read_size = None, extra_hashers = [], # update(data) will be called on all of these ): ''' Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory ''' read_size = read_size or os.s...
python
def read_sha1( file_path, buf_size = None, start_byte = 0, read_size = None, extra_hashers = [], # update(data) will be called on all of these ): ''' Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory ''' read_size = read_size or os.s...
[ "def", "read_sha1", "(", "file_path", ",", "buf_size", "=", "None", ",", "start_byte", "=", "0", ",", "read_size", "=", "None", ",", "extra_hashers", "=", "[", "]", ",", ")", ":", "read_size", "=", "read_size", "or", "os", ".", "stat", "(", "file_path"...
Determines the sha1 hash of a file in chunks, to prevent loading the entire file at once into memory
[ "Determines", "the", "sha1", "hash", "of", "a", "file", "in", "chunks", "to", "prevent", "loading", "the", "entire", "file", "at", "once", "into", "memory" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/box_backup.py#L665-L692
train
Kortemme-Lab/klab
klab/box_backup.py
BoxAPI.verify_uploaded_file
def verify_uploaded_file( self, destination_folder_id, source_path, verbose = True, ): ''' Verifies the integrity of a file uploaded to Box ''' source_file_size = os.stat(source_path).st_size total_part_size = 0 file_po...
python
def verify_uploaded_file( self, destination_folder_id, source_path, verbose = True, ): ''' Verifies the integrity of a file uploaded to Box ''' source_file_size = os.stat(source_path).st_size total_part_size = 0 file_po...
[ "def", "verify_uploaded_file", "(", "self", ",", "destination_folder_id", ",", "source_path", ",", "verbose", "=", "True", ",", ")", ":", "source_file_size", "=", "os", ".", "stat", "(", "source_path", ")", ".", "st_size", "total_part_size", "=", "0", "file_po...
Verifies the integrity of a file uploaded to Box
[ "Verifies", "the", "integrity", "of", "a", "file", "uploaded", "to", "Box" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/box_backup.py#L242-L280
train
uogbuji/versa
tools/py/reader/md.py
handle_resourcelist
def handle_resourcelist(ltext, **kwargs): ''' A helper that converts lists of resources from a textual format such as Markdown, including absolutizing relative IRIs ''' base=kwargs.get('base', VERSA_BASEIRI) model=kwargs.get('model') iris = ltext.strip().split() newlist = model.generate_reso...
python
def handle_resourcelist(ltext, **kwargs): ''' A helper that converts lists of resources from a textual format such as Markdown, including absolutizing relative IRIs ''' base=kwargs.get('base', VERSA_BASEIRI) model=kwargs.get('model') iris = ltext.strip().split() newlist = model.generate_reso...
[ "def", "handle_resourcelist", "(", "ltext", ",", "**", "kwargs", ")", ":", "base", "=", "kwargs", ".", "get", "(", "'base'", ",", "VERSA_BASEIRI", ")", "model", "=", "kwargs", ".", "get", "(", "'model'", ")", "iris", "=", "ltext", ".", "strip", "(", ...
A helper that converts lists of resources from a textual format such as Markdown, including absolutizing relative IRIs
[ "A", "helper", "that", "converts", "lists", "of", "resources", "from", "a", "textual", "format", "such", "as", "Markdown", "including", "absolutizing", "relative", "IRIs" ]
f092ffc7ed363a5b170890955168500f32de0dd5
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/reader/md.py#L63-L73
train
uogbuji/versa
tools/py/reader/md.py
handle_resourceset
def handle_resourceset(ltext, **kwargs): ''' A helper that converts sets of resources from a textual format such as Markdown, including absolutizing relative IRIs ''' fullprop=kwargs.get('fullprop') rid=kwargs.get('rid') base=kwargs.get('base', VERSA_BASEIRI) model=kwargs.get('model') ir...
python
def handle_resourceset(ltext, **kwargs): ''' A helper that converts sets of resources from a textual format such as Markdown, including absolutizing relative IRIs ''' fullprop=kwargs.get('fullprop') rid=kwargs.get('rid') base=kwargs.get('base', VERSA_BASEIRI) model=kwargs.get('model') ir...
[ "def", "handle_resourceset", "(", "ltext", ",", "**", "kwargs", ")", ":", "fullprop", "=", "kwargs", ".", "get", "(", "'fullprop'", ")", "rid", "=", "kwargs", ".", "get", "(", "'rid'", ")", "base", "=", "kwargs", ".", "get", "(", "'base'", ",", "VERS...
A helper that converts sets of resources from a textual format such as Markdown, including absolutizing relative IRIs
[ "A", "helper", "that", "converts", "sets", "of", "resources", "from", "a", "textual", "format", "such", "as", "Markdown", "including", "absolutizing", "relative", "IRIs" ]
f092ffc7ed363a5b170890955168500f32de0dd5
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/reader/md.py#L76-L87
train
Alveo/pyalveo
pyalveo/cache.py
Cache.create_cache_database
def create_cache_database(self): """ Create a new SQLite3 database for use with Cache objects :raises: IOError if there is a problem creating the database file """ conn = sqlite3.connect(self.database) conn.text_factory = str c = conn.cursor() c.execute("""CR...
python
def create_cache_database(self): """ Create a new SQLite3 database for use with Cache objects :raises: IOError if there is a problem creating the database file """ conn = sqlite3.connect(self.database) conn.text_factory = str c = conn.cursor() c.execute("""CR...
[ "def", "create_cache_database", "(", "self", ")", ":", "conn", "=", "sqlite3", ".", "connect", "(", "self", ".", "database", ")", "conn", ".", "text_factory", "=", "str", "c", "=", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", ")", "c", ...
Create a new SQLite3 database for use with Cache objects :raises: IOError if there is a problem creating the database file
[ "Create", "a", "new", "SQLite3", "database", "for", "use", "with", "Cache", "objects" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L77-L96
train
Alveo/pyalveo
pyalveo/cache.py
Cache.__exists_row_not_too_old
def __exists_row_not_too_old(self, row): """ Check if the given row exists and is not too old """ if row is None: return False record_time = dateutil.parser.parse(row[2]) now = datetime.datetime.now(dateutil.tz.gettz()) age = (record_time - now).total_seconds() ...
python
def __exists_row_not_too_old(self, row): """ Check if the given row exists and is not too old """ if row is None: return False record_time = dateutil.parser.parse(row[2]) now = datetime.datetime.now(dateutil.tz.gettz()) age = (record_time - now).total_seconds() ...
[ "def", "__exists_row_not_too_old", "(", "self", ",", "row", ")", ":", "if", "row", "is", "None", ":", "return", "False", "record_time", "=", "dateutil", ".", "parser", ".", "parse", "(", "row", "[", "2", "]", ")", "now", "=", "datetime", ".", "datetime...
Check if the given row exists and is not too old
[ "Check", "if", "the", "given", "row", "exists", "and", "is", "not", "too", "old" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L135-L145
train
Alveo/pyalveo
pyalveo/cache.py
Cache.has_item
def has_item(self, item_url): """ Check if the metadata for the given item is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type item_url: String or Item :param ...
python
def has_item(self, item_url): """ Check if the metadata for the given item is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type item_url: String or Item :param ...
[ "def", "has_item", "(", "self", ",", "item_url", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"SELECT * FROM items WHERE url=?\"", ",", "(", "str", "(", "item_url", ")", ",", ")", ")", "row", "=", "c",...
Check if the metadata for the given item is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type item_url: String or Item :param item_url: the URL of the item, or an Item ...
[ "Check", "if", "the", "metadata", "for", "the", "given", "item", "is", "present", "in", "the", "cache" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L153-L172
train
Alveo/pyalveo
pyalveo/cache.py
Cache.has_document
def has_document(self, doc_url): """ Check if the content of the given document is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type doc_url: String or Document ...
python
def has_document(self, doc_url): """ Check if the content of the given document is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type doc_url: String or Document ...
[ "def", "has_document", "(", "self", ",", "doc_url", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"SELECT * FROM documents WHERE url=?\"", ",", "(", "str", "(", "doc_url", ")", ",", ")", ")", "row", "=", ...
Check if the content of the given document is present in the cache If the max_age attribute of this Cache is set to a nonzero value, entries older than the value of max_age in seconds will be ignored :type doc_url: String or Document :param doc_url: the URL of the document, or ...
[ "Check", "if", "the", "content", "of", "the", "given", "document", "is", "present", "in", "the", "cache" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L175-L194
train
Alveo/pyalveo
pyalveo/cache.py
Cache.get_document
def get_document(self, doc_url): """ Retrieve the content for the given document from the cache. :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :rtype: String :returns: the document data :raises: ValueError if the item i...
python
def get_document(self, doc_url): """ Retrieve the content for the given document from the cache. :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :rtype: String :returns: the document data :raises: ValueError if the item i...
[ "def", "get_document", "(", "self", ",", "doc_url", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"SELECT * FROM documents WHERE url=?\"", ",", "(", "str", "(", "doc_url", ")", ",", ")", ")", "row", "=", ...
Retrieve the content for the given document from the cache. :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :rtype: String :returns: the document data :raises: ValueError if the item is not in the cache
[ "Retrieve", "the", "content", "for", "the", "given", "document", "from", "the", "cache", "." ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L242-L268
train
Alveo/pyalveo
pyalveo/cache.py
Cache.get_primary_text
def get_primary_text(self, item_url): """ Retrieve the primary text for the given item from the cache. :type item_url: String or Item :param item_url: the URL of the item, or an Item object :rtype: String :returns: the primary text :raises: ValueError if the primary te...
python
def get_primary_text(self, item_url): """ Retrieve the primary text for the given item from the cache. :type item_url: String or Item :param item_url: the URL of the item, or an Item object :rtype: String :returns: the primary text :raises: ValueError if the primary te...
[ "def", "get_primary_text", "(", "self", ",", "item_url", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"SELECT * FROM primary_texts WHERE item_url=?\"", ",", "(", "str", "(", "item_url", ")", ",", ")", ")", ...
Retrieve the primary text for the given item from the cache. :type item_url: String or Item :param item_url: the URL of the item, or an Item object :rtype: String :returns: the primary text :raises: ValueError if the primary text is not in the cache
[ "Retrieve", "the", "primary", "text", "for", "the", "given", "item", "from", "the", "cache", "." ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L271-L291
train
Alveo/pyalveo
pyalveo/cache.py
Cache.add_item
def add_item(self, item_url, item_metadata): """ Add the given item to the cache database, updating the existing metadata if the item is already present :type item_url: String or Item :param item_url: the URL of the item, or an Item object :type item_metadata: String :pa...
python
def add_item(self, item_url, item_metadata): """ Add the given item to the cache database, updating the existing metadata if the item is already present :type item_url: String or Item :param item_url: the URL of the item, or an Item object :type item_metadata: String :pa...
[ "def", "add_item", "(", "self", ",", "item_url", ",", "item_metadata", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"DELETE FROM items WHERE url=?\"", ",", "(", "str", "(", "item_url", ")", ",", ")", ")"...
Add the given item to the cache database, updating the existing metadata if the item is already present :type item_url: String or Item :param item_url: the URL of the item, or an Item object :type item_metadata: String :param item_metadata: the item's metadata, as a JSON string
[ "Add", "the", "given", "item", "to", "the", "cache", "database", "updating", "the", "existing", "metadata", "if", "the", "item", "is", "already", "present" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L294-L311
train
Alveo/pyalveo
pyalveo/cache.py
Cache.add_document
def add_document(self, doc_url, data): """ Add the given document to the cache, updating the existing content data if the document is already present :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :type data: String :param...
python
def add_document(self, doc_url, data): """ Add the given document to the cache, updating the existing content data if the document is already present :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :type data: String :param...
[ "def", "add_document", "(", "self", ",", "doc_url", ",", "data", ")", ":", "file_path", "=", "self", ".", "__generate_filepath", "(", ")", "with", "open", "(", "file_path", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "data", ")", "c", ...
Add the given document to the cache, updating the existing content data if the document is already present :type doc_url: String or Document :param doc_url: the URL of the document, or a Document object :type data: String :param data: the document's content data
[ "Add", "the", "given", "document", "to", "the", "cache", "updating", "the", "existing", "content", "data", "if", "the", "document", "is", "already", "present" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L329-L355
train
Alveo/pyalveo
pyalveo/cache.py
Cache.add_primary_text
def add_primary_text(self, item_url, primary_text): """ Add the given primary text to the cache database, updating the existing record if the primary text is already present :type item_url: String or Item :param item_url: the URL of the corresponding item, or an Item object :typ...
python
def add_primary_text(self, item_url, primary_text): """ Add the given primary text to the cache database, updating the existing record if the primary text is already present :type item_url: String or Item :param item_url: the URL of the corresponding item, or an Item object :typ...
[ "def", "add_primary_text", "(", "self", ",", "item_url", ",", "primary_text", ")", ":", "c", "=", "self", ".", "conn", ".", "cursor", "(", ")", "c", ".", "execute", "(", "\"DELETE FROM primary_texts WHERE item_url=?\"", ",", "(", "str", "(", "item_url", ")",...
Add the given primary text to the cache database, updating the existing record if the primary text is already present :type item_url: String or Item :param item_url: the URL of the corresponding item, or an Item object :type primary_text: String :param primary_text: the item's p...
[ "Add", "the", "given", "primary", "text", "to", "the", "cache", "database", "updating", "the", "existing", "record", "if", "the", "primary", "text", "is", "already", "present" ]
1e9eec22bc031bc9a08066f9966565a546e6242e
https://github.com/Alveo/pyalveo/blob/1e9eec22bc031bc9a08066f9966565a546e6242e/pyalveo/cache.py#L357-L375
train
cgrok/cr-async
examples/crcog.py
ClashCog.profile
async def profile(self, ctx, tag): '''Example command for use inside a discord bot cog.''' if not self.check_valid_tag(tag): return await ctx.send('Invalid tag!') profile = await self.cr.get_profile(tag) em = discord.Embed(color=0x00FFFFF) em.set_author(name=str(pro...
python
async def profile(self, ctx, tag): '''Example command for use inside a discord bot cog.''' if not self.check_valid_tag(tag): return await ctx.send('Invalid tag!') profile = await self.cr.get_profile(tag) em = discord.Embed(color=0x00FFFFF) em.set_author(name=str(pro...
[ "async", "def", "profile", "(", "self", ",", "ctx", ",", "tag", ")", ":", "if", "not", "self", ".", "check_valid_tag", "(", "tag", ")", ":", "return", "await", "ctx", ".", "send", "(", "'Invalid tag!'", ")", "profile", "=", "await", "self", ".", "cr"...
Example command for use inside a discord bot cog.
[ "Example", "command", "for", "use", "inside", "a", "discord", "bot", "cog", "." ]
f65a968e54704168706d137d1ba662f55f8ab852
https://github.com/cgrok/cr-async/blob/f65a968e54704168706d137d1ba662f55f8ab852/examples/crcog.py#L22-L42
train
TheGhouls/oct
oct/results/stats_handler.py
StatsHandler.write_remaining
def write_remaining(self): """Write the remaning stack content """ if not self.results: return with db.execution_context(): with db.atomic(): Result.insert_many(self.results).execute() del self.results[:]
python
def write_remaining(self): """Write the remaning stack content """ if not self.results: return with db.execution_context(): with db.atomic(): Result.insert_many(self.results).execute() del self.results[:]
[ "def", "write_remaining", "(", "self", ")", ":", "if", "not", "self", ".", "results", ":", "return", "with", "db", ".", "execution_context", "(", ")", ":", "with", "db", ".", "atomic", "(", ")", ":", "Result", ".", "insert_many", "(", "self", ".", "r...
Write the remaning stack content
[ "Write", "the", "remaning", "stack", "content" ]
7e9bddeb3b8495a26442b1c86744e9fb187fe88f
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/results/stats_handler.py#L50-L58
train
TheGhouls/oct
oct/utilities/configuration.py
configure
def configure(project_path, config_file=None): """Get the configuration of the test and return it as a config object :return: the configured config object :rtype: Object """ if config_file is None: config_file = os.path.join(project_path, 'config.json') try: with open(config_fil...
python
def configure(project_path, config_file=None): """Get the configuration of the test and return it as a config object :return: the configured config object :rtype: Object """ if config_file is None: config_file = os.path.join(project_path, 'config.json') try: with open(config_fil...
[ "def", "configure", "(", "project_path", ",", "config_file", "=", "None", ")", ":", "if", "config_file", "is", "None", ":", "config_file", "=", "os", ".", "path", ".", "join", "(", "project_path", ",", "'config.json'", ")", "try", ":", "with", "open", "(...
Get the configuration of the test and return it as a config object :return: the configured config object :rtype: Object
[ "Get", "the", "configuration", "of", "the", "test", "and", "return", "it", "as", "a", "config", "object" ]
7e9bddeb3b8495a26442b1c86744e9fb187fe88f
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/utilities/configuration.py#L27-L43
train
TheGhouls/oct
oct/utilities/configuration.py
configure_for_turret
def configure_for_turret(project_name, config_file): """Load the configuration file in python dict and check for keys that will be set to default value if not present :param str project_name: the name of the project :param str config_file: the path of the configuration file :return: the loaded configur...
python
def configure_for_turret(project_name, config_file): """Load the configuration file in python dict and check for keys that will be set to default value if not present :param str project_name: the name of the project :param str config_file: the path of the configuration file :return: the loaded configur...
[ "def", "configure_for_turret", "(", "project_name", ",", "config_file", ")", ":", "config", "=", "configure", "(", "project_name", ",", "config_file", ")", "for", "key", "in", "WARNING_CONFIG_KEYS", ":", "if", "key", "not", "in", "config", ":", "print", "(", ...
Load the configuration file in python dict and check for keys that will be set to default value if not present :param str project_name: the name of the project :param str config_file: the path of the configuration file :return: the loaded configuration :rtype: dict
[ "Load", "the", "configuration", "file", "in", "python", "dict", "and", "check", "for", "keys", "that", "will", "be", "set", "to", "default", "value", "if", "not", "present" ]
7e9bddeb3b8495a26442b1c86744e9fb187fe88f
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/utilities/configuration.py#L56-L81
train
TheGhouls/oct
oct/utilities/configuration.py
get_db_uri
def get_db_uri(config, output_dir): """Process results_database parameters in config to format them for set database function :param dict config: project configuration dict :param str output_dir: output directory for results :return: string for db uri """ db_config = config.get("results_dat...
python
def get_db_uri(config, output_dir): """Process results_database parameters in config to format them for set database function :param dict config: project configuration dict :param str output_dir: output directory for results :return: string for db uri """ db_config = config.get("results_dat...
[ "def", "get_db_uri", "(", "config", ",", "output_dir", ")", ":", "db_config", "=", "config", ".", "get", "(", "\"results_database\"", ",", "{", "\"db_uri\"", ":", "\"default\"", "}", ")", "if", "db_config", "[", "'db_uri'", "]", "==", "'default'", ":", "re...
Process results_database parameters in config to format them for set database function :param dict config: project configuration dict :param str output_dir: output directory for results :return: string for db uri
[ "Process", "results_database", "parameters", "in", "config", "to", "format", "them", "for", "set", "database", "function" ]
7e9bddeb3b8495a26442b1c86744e9fb187fe88f
https://github.com/TheGhouls/oct/blob/7e9bddeb3b8495a26442b1c86744e9fb187fe88f/oct/utilities/configuration.py#L98-L109
train
ethan92429/onshapepy
onshapepy/document.py
Document.update
def update(self): """All client calls to update this instance with Onshape.""" self.json = c.get_document(self.uri.did).json() self.e_list = c.element_list(self.uri.as_dict()).json()
python
def update(self): """All client calls to update this instance with Onshape.""" self.json = c.get_document(self.uri.did).json() self.e_list = c.element_list(self.uri.as_dict()).json()
[ "def", "update", "(", "self", ")", ":", "self", ".", "json", "=", "c", ".", "get_document", "(", "self", ".", "uri", ".", "did", ")", ".", "json", "(", ")", "self", ".", "e_list", "=", "c", ".", "element_list", "(", "self", ".", "uri", ".", "as...
All client calls to update this instance with Onshape.
[ "All", "client", "calls", "to", "update", "this", "instance", "with", "Onshape", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/document.py#L54-L57
train
ethan92429/onshapepy
onshapepy/document.py
Document.find_element
def find_element(self, name, type=ElementType.ANY): """Find an elemnent in the document with the given name - could be a PartStudio, Assembly or blob. Args: name: str the name of the element. Returns: - onshapepy.uri of the element """ f...
python
def find_element(self, name, type=ElementType.ANY): """Find an elemnent in the document with the given name - could be a PartStudio, Assembly or blob. Args: name: str the name of the element. Returns: - onshapepy.uri of the element """ f...
[ "def", "find_element", "(", "self", ",", "name", ",", "type", "=", "ElementType", ".", "ANY", ")", ":", "for", "e", "in", "self", ".", "e_list", ":", "if", "type", ".", "value", "and", "not", "e", "[", "'elementType'", "]", "==", "type", ":", "cont...
Find an elemnent in the document with the given name - could be a PartStudio, Assembly or blob. Args: name: str the name of the element. Returns: - onshapepy.uri of the element
[ "Find", "an", "elemnent", "in", "the", "document", "with", "the", "given", "name", "-", "could", "be", "a", "PartStudio", "Assembly", "or", "blob", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/document.py#L63-L81
train
DsixTools/python-smeftrunner
smeftrunner/beta.py
beta_array
def beta_array(C, HIGHSCALE, *args, **kwargs): """Return the beta functions of all SM parameters and SMEFT Wilson coefficients as a 1D numpy array.""" beta_odict = beta(C, HIGHSCALE, *args, **kwargs) return np.hstack([np.asarray(b).ravel() for b in beta_odict.values()])
python
def beta_array(C, HIGHSCALE, *args, **kwargs): """Return the beta functions of all SM parameters and SMEFT Wilson coefficients as a 1D numpy array.""" beta_odict = beta(C, HIGHSCALE, *args, **kwargs) return np.hstack([np.asarray(b).ravel() for b in beta_odict.values()])
[ "def", "beta_array", "(", "C", ",", "HIGHSCALE", ",", "*", "args", ",", "**", "kwargs", ")", ":", "beta_odict", "=", "beta", "(", "C", ",", "HIGHSCALE", ",", "*", "args", ",", "**", "kwargs", ")", "return", "np", ".", "hstack", "(", "[", "np", "....
Return the beta functions of all SM parameters and SMEFT Wilson coefficients as a 1D numpy array.
[ "Return", "the", "beta", "functions", "of", "all", "SM", "parameters", "and", "SMEFT", "Wilson", "coefficients", "as", "a", "1D", "numpy", "array", "." ]
4c9130e53ad4f7bbb526657a82150ca9d57c4b37
https://github.com/DsixTools/python-smeftrunner/blob/4c9130e53ad4f7bbb526657a82150ca9d57c4b37/smeftrunner/beta.py#L1823-L1827
train
peergradeio/flask-mongo-profiler
flask_mongo_profiler/contrib/flask_admin/views/base.py
RelationalSearchMixin._search
def _search(self, query, search_term): """ Improved search between words. The original _search for MongoEngine dates back to November 12th, 2013 [1]_. In this ref it's stated that there is a bug with complex Q queries preventing multi-word searches. During this time, the MongoEn...
python
def _search(self, query, search_term): """ Improved search between words. The original _search for MongoEngine dates back to November 12th, 2013 [1]_. In this ref it's stated that there is a bug with complex Q queries preventing multi-word searches. During this time, the MongoEn...
[ "def", "_search", "(", "self", ",", "query", ",", "search_term", ")", ":", "criterias", "=", "mongoengine", ".", "Q", "(", ")", "rel_criterias", "=", "mongoengine", ".", "Q", "(", ")", "terms", "=", "shlex", ".", "split", "(", "search_term", ")", "if",...
Improved search between words. The original _search for MongoEngine dates back to November 12th, 2013 [1]_. In this ref it's stated that there is a bug with complex Q queries preventing multi-word searches. During this time, the MongoEngine version was earlier than 0.4 (predating PyPI) ...
[ "Improved", "search", "between", "words", "." ]
a267eeb49fea07c9a24fb370bd9d7a90ed313ccf
https://github.com/peergradeio/flask-mongo-profiler/blob/a267eeb49fea07c9a24fb370bd9d7a90ed313ccf/flask_mongo_profiler/contrib/flask_admin/views/base.py#L114-L195
train
DavidDoukhan/py_sonicvisualiser
py_sonicvisualiser/SVDataset.py
SVDataset2D.set_data_from_iterable
def set_data_from_iterable(self, frames, values, labels=None): """ Initialize a dataset structure from iterable parameters :param x: The temporal indices of the dataset :param y: The values of the dataset :type x: iterable :type y: iterable """ if not isi...
python
def set_data_from_iterable(self, frames, values, labels=None): """ Initialize a dataset structure from iterable parameters :param x: The temporal indices of the dataset :param y: The values of the dataset :type x: iterable :type y: iterable """ if not isi...
[ "def", "set_data_from_iterable", "(", "self", ",", "frames", ",", "values", ",", "labels", "=", "None", ")", ":", "if", "not", "isinstance", "(", "frames", ",", "collections", ".", "Iterable", ")", ":", "raise", "TypeError", ",", "\"frames must be an iterable\...
Initialize a dataset structure from iterable parameters :param x: The temporal indices of the dataset :param y: The values of the dataset :type x: iterable :type y: iterable
[ "Initialize", "a", "dataset", "structure", "from", "iterable", "parameters" ]
ebe83bd7dffb0275393255dcbcc6671cf0ade4a5
https://github.com/DavidDoukhan/py_sonicvisualiser/blob/ebe83bd7dffb0275393255dcbcc6671cf0ade4a5/py_sonicvisualiser/SVDataset.py#L50-L77
train
DavidDoukhan/py_sonicvisualiser
py_sonicvisualiser/SVDataset.py
SVDataset2D.writexml
def writexml(self, writer, indent="", addindent="", newl=""): """ Write the continuous dataset using sonic visualiser xml conventions """ # dataset = self.data.appendChild(self.doc.createElement('dataset')) # dataset.setAttribute('id', str(imodel)) # dataset.setAttribute...
python
def writexml(self, writer, indent="", addindent="", newl=""): """ Write the continuous dataset using sonic visualiser xml conventions """ # dataset = self.data.appendChild(self.doc.createElement('dataset')) # dataset.setAttribute('id', str(imodel)) # dataset.setAttribute...
[ "def", "writexml", "(", "self", ",", "writer", ",", "indent", "=", "\"\"", ",", "addindent", "=", "\"\"", ",", "newl", "=", "\"\"", ")", ":", "writer", ".", "write", "(", "'%s<dataset id=\"%s\" dimensions=\"%s\">%s'", "%", "(", "indent", ",", "self", ".", ...
Write the continuous dataset using sonic visualiser xml conventions
[ "Write", "the", "continuous", "dataset", "using", "sonic", "visualiser", "xml", "conventions" ]
ebe83bd7dffb0275393255dcbcc6671cf0ade4a5
https://github.com/DavidDoukhan/py_sonicvisualiser/blob/ebe83bd7dffb0275393255dcbcc6671cf0ade4a5/py_sonicvisualiser/SVDataset.py#L89-L100
train
assamite/creamas
creamas/math.py
gaus_pdf
def gaus_pdf(x, mean, std): '''Gaussian distribution's probability density function. See, e.g. `Wikipedia <https://en.wikipedia.org/wiki/Normal_distribution>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float mean: mean or expectation :param float str: standard deviation...
python
def gaus_pdf(x, mean, std): '''Gaussian distribution's probability density function. See, e.g. `Wikipedia <https://en.wikipedia.org/wiki/Normal_distribution>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float mean: mean or expectation :param float str: standard deviation...
[ "def", "gaus_pdf", "(", "x", ",", "mean", ",", "std", ")", ":", "return", "exp", "(", "-", "(", "(", "x", "-", "mean", ")", "/", "std", ")", "**", "2", "/", "2", ")", "/", "sqrt", "(", "2", "*", "pi", ")", "/", "std" ]
Gaussian distribution's probability density function. See, e.g. `Wikipedia <https://en.wikipedia.org/wiki/Normal_distribution>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float mean: mean or expectation :param float str: standard deviation :returns: pdf(s) in point **x*...
[ "Gaussian", "distribution", "s", "probability", "density", "function", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/math.py#L10-L22
train
assamite/creamas
creamas/math.py
logistic
def logistic(x, x0, k, L): '''Logistic function. See, e.g `Wikipedia <https://en.wikipedia.org/wiki/Logistic_function>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float x0: sigmoid's midpoint :param float k: steepness of the curve :param float L: maximum value of th...
python
def logistic(x, x0, k, L): '''Logistic function. See, e.g `Wikipedia <https://en.wikipedia.org/wiki/Logistic_function>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float x0: sigmoid's midpoint :param float k: steepness of the curve :param float L: maximum value of th...
[ "def", "logistic", "(", "x", ",", "x0", ",", "k", ",", "L", ")", ":", "return", "L", "/", "(", "1", "+", "exp", "(", "-", "k", "*", "(", "x", "-", "x0", ")", ")", ")" ]
Logistic function. See, e.g `Wikipedia <https://en.wikipedia.org/wiki/Logistic_function>`_. :param x: point in x-axis :type x: float or numpy.ndarray :param float x0: sigmoid's midpoint :param float k: steepness of the curve :param float L: maximum value of the curve :returns: function's v...
[ "Logistic", "function", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/math.py#L25-L38
train
assamite/creamas
creamas/examples/grid/grid_node.py
populate_menv
def populate_menv(menv, agent_cls_name, log_folder): '''Populate given multiprocessing grid environment with agents. :param menv: Instance of :py:class:`GridMultiEnvironment` :param str agent_cls_name: Name of the agent class, e.g. 'grip_mp:GridAgent' :param str log_folder: Root logging folder for the ...
python
def populate_menv(menv, agent_cls_name, log_folder): '''Populate given multiprocessing grid environment with agents. :param menv: Instance of :py:class:`GridMultiEnvironment` :param str agent_cls_name: Name of the agent class, e.g. 'grip_mp:GridAgent' :param str log_folder: Root logging folder for the ...
[ "def", "populate_menv", "(", "menv", ",", "agent_cls_name", ",", "log_folder", ")", ":", "gs", "=", "menv", ".", "gs", "n_agents", "=", "gs", "[", "0", "]", "*", "gs", "[", "1", "]", "n_slaves", "=", "len", "(", "menv", ".", "addrs", ")", "logger",...
Populate given multiprocessing grid environment with agents. :param menv: Instance of :py:class:`GridMultiEnvironment` :param str agent_cls_name: Name of the agent class, e.g. 'grip_mp:GridAgent' :param str log_folder: Root logging folder for the agents.
[ "Populate", "given", "multiprocessing", "grid", "environment", "with", "agents", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/grid_node.py#L70-L82
train
assamite/creamas
creamas/examples/grid/grid_node.py
get_slave_addrs
def get_slave_addrs(mgr_addr, N): '''Get ports for the slave environments. Currently the ports are not checked for availability. ''' return [(HOST, p) for p in range(mgr_addr+1, mgr_addr+1+N)]
python
def get_slave_addrs(mgr_addr, N): '''Get ports for the slave environments. Currently the ports are not checked for availability. ''' return [(HOST, p) for p in range(mgr_addr+1, mgr_addr+1+N)]
[ "def", "get_slave_addrs", "(", "mgr_addr", ",", "N", ")", ":", "return", "[", "(", "HOST", ",", "p", ")", "for", "p", "in", "range", "(", "mgr_addr", "+", "1", ",", "mgr_addr", "+", "1", "+", "N", ")", "]" ]
Get ports for the slave environments. Currently the ports are not checked for availability.
[ "Get", "ports", "for", "the", "slave", "environments", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/grid/grid_node.py#L85-L90
train
assamite/creamas
creamas/rules/rule.py
weighted_average
def weighted_average(rule, artifact): """Evaluate artifact's value to be weighted average of values returned by rule's subrules. """ e = 0 w = 0 for i in range(len(rule.R)): r = rule.R[i](artifact) if r is not None: e += r * rule.W[i] w += abs(rule.W[i]) ...
python
def weighted_average(rule, artifact): """Evaluate artifact's value to be weighted average of values returned by rule's subrules. """ e = 0 w = 0 for i in range(len(rule.R)): r = rule.R[i](artifact) if r is not None: e += r * rule.W[i] w += abs(rule.W[i]) ...
[ "def", "weighted_average", "(", "rule", ",", "artifact", ")", ":", "e", "=", "0", "w", "=", "0", "for", "i", "in", "range", "(", "len", "(", "rule", ".", "R", ")", ")", ":", "r", "=", "rule", ".", "R", "[", "i", "]", "(", "artifact", ")", "...
Evaluate artifact's value to be weighted average of values returned by rule's subrules.
[ "Evaluate", "artifact", "s", "value", "to", "be", "weighted", "average", "of", "values", "returned", "by", "rule", "s", "subrules", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/rules/rule.py#L207-L220
train
assamite/creamas
creamas/rules/rule.py
minimum
def minimum(rule, artifact): """Evaluate artifact's value to be minimum of values returned by rule's subrules. This evaluation function ignores subrule weights. """ m = 1.0 for i in range(len(rule.R)): e = rule.R[i](artifact) if e is not None: if e < m: ...
python
def minimum(rule, artifact): """Evaluate artifact's value to be minimum of values returned by rule's subrules. This evaluation function ignores subrule weights. """ m = 1.0 for i in range(len(rule.R)): e = rule.R[i](artifact) if e is not None: if e < m: ...
[ "def", "minimum", "(", "rule", ",", "artifact", ")", ":", "m", "=", "1.0", "for", "i", "in", "range", "(", "len", "(", "rule", ".", "R", ")", ")", ":", "e", "=", "rule", ".", "R", "[", "i", "]", "(", "artifact", ")", "if", "e", "is", "not",...
Evaluate artifact's value to be minimum of values returned by rule's subrules. This evaluation function ignores subrule weights.
[ "Evaluate", "artifact", "s", "value", "to", "be", "minimum", "of", "values", "returned", "by", "rule", "s", "subrules", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/rules/rule.py#L223-L235
train
assamite/creamas
creamas/rules/rule.py
Rule.add_subrule
def add_subrule(self, subrule, weight): """Add subrule to the rule. :param subrule: Subrule to add to this rule, an instance of :class:`Rule` or :class:`RuleLeaf`. :param float weight: Weight of the subrule """ if not issubclass(subrule.__class__, (Rule,...
python
def add_subrule(self, subrule, weight): """Add subrule to the rule. :param subrule: Subrule to add to this rule, an instance of :class:`Rule` or :class:`RuleLeaf`. :param float weight: Weight of the subrule """ if not issubclass(subrule.__class__, (Rule,...
[ "def", "add_subrule", "(", "self", ",", "subrule", ",", "weight", ")", ":", "if", "not", "issubclass", "(", "subrule", ".", "__class__", ",", "(", "Rule", ",", "RuleLeaf", ")", ")", ":", "raise", "TypeError", "(", "\"Rule's class must be (subclass of) {} or {}...
Add subrule to the rule. :param subrule: Subrule to add to this rule, an instance of :class:`Rule` or :class:`RuleLeaf`. :param float weight: Weight of the subrule
[ "Add", "subrule", "to", "the", "rule", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/rules/rule.py#L153-L167
train
Kortemme-Lab/klab
klab/chainsequence.py
ChainSequences.parse_seqres
def parse_seqres(self, pdb): """Parse the SEQRES entries into the object""" seqresre = re.compile("SEQRES") seqreslines = [line for line in pdb.lines if seqresre.match(line)] for line in seqreslines: chain = line[11] resnames = line[19:70].strip() self.setdefault(chain, ...
python
def parse_seqres(self, pdb): """Parse the SEQRES entries into the object""" seqresre = re.compile("SEQRES") seqreslines = [line for line in pdb.lines if seqresre.match(line)] for line in seqreslines: chain = line[11] resnames = line[19:70].strip() self.setdefault(chain, ...
[ "def", "parse_seqres", "(", "self", ",", "pdb", ")", ":", "seqresre", "=", "re", ".", "compile", "(", "\"SEQRES\"", ")", "seqreslines", "=", "[", "line", "for", "line", "in", "pdb", ".", "lines", "if", "seqresre", ".", "match", "(", "line", ")", "]",...
Parse the SEQRES entries into the object
[ "Parse", "the", "SEQRES", "entries", "into", "the", "object" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/chainsequence.py#L44-L55
train
Kortemme-Lab/klab
klab/chainsequence.py
ChainSequences.parse_atoms
def parse_atoms(self, pdb): """Parse the ATOM entries into the object""" atomre = re.compile("ATOM") atomlines = [line for line in pdb.lines if atomre.match(line)] chainresnums = {} for line in atomlines: chain = line[21] resname = line[17:20] resnum = line[22:2...
python
def parse_atoms(self, pdb): """Parse the ATOM entries into the object""" atomre = re.compile("ATOM") atomlines = [line for line in pdb.lines if atomre.match(line)] chainresnums = {} for line in atomlines: chain = line[21] resname = line[17:20] resnum = line[22:2...
[ "def", "parse_atoms", "(", "self", ",", "pdb", ")", ":", "atomre", "=", "re", ".", "compile", "(", "\"ATOM\"", ")", "atomlines", "=", "[", "line", "for", "line", "in", "pdb", ".", "lines", "if", "atomre", ".", "match", "(", "line", ")", "]", "chain...
Parse the ATOM entries into the object
[ "Parse", "the", "ATOM", "entries", "into", "the", "object" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/chainsequence.py#L57-L81
train
Kortemme-Lab/klab
klab/chainsequence.py
ChainSequences.seqres_lines
def seqres_lines(self): """Generate SEQRES lines representing the contents""" lines = [] for chain in self.keys(): seq = self[chain] serNum = 1 startidx = 0 while startidx < len(seq): endidx = min(startidx+13, len(seq)) lines += ["SEQRES %2i %s %4i %s\n" % (se...
python
def seqres_lines(self): """Generate SEQRES lines representing the contents""" lines = [] for chain in self.keys(): seq = self[chain] serNum = 1 startidx = 0 while startidx < len(seq): endidx = min(startidx+13, len(seq)) lines += ["SEQRES %2i %s %4i %s\n" % (se...
[ "def", "seqres_lines", "(", "self", ")", ":", "lines", "=", "[", "]", "for", "chain", "in", "self", ".", "keys", "(", ")", ":", "seq", "=", "self", "[", "chain", "]", "serNum", "=", "1", "startidx", "=", "0", "while", "startidx", "<", "len", "(",...
Generate SEQRES lines representing the contents
[ "Generate", "SEQRES", "lines", "representing", "the", "contents" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/chainsequence.py#L83-L98
train
Kortemme-Lab/klab
klab/chainsequence.py
ChainSequences.replace_seqres
def replace_seqres(self, pdb, update_atoms = True): """Replace SEQRES lines with a new sequence, optionally removing mutated sidechains""" newpdb = PDB() inserted_seqres = False entries_before_seqres = set(["HEADER", "OBSLTE", "TITLE", "CAVEAT", "COMPND", "SOURCE", ...
python
def replace_seqres(self, pdb, update_atoms = True): """Replace SEQRES lines with a new sequence, optionally removing mutated sidechains""" newpdb = PDB() inserted_seqres = False entries_before_seqres = set(["HEADER", "OBSLTE", "TITLE", "CAVEAT", "COMPND", "SOURCE", ...
[ "def", "replace_seqres", "(", "self", ",", "pdb", ",", "update_atoms", "=", "True", ")", ":", "newpdb", "=", "PDB", "(", ")", "inserted_seqres", "=", "False", "entries_before_seqres", "=", "set", "(", "[", "\"HEADER\"", ",", "\"OBSLTE\"", ",", "\"TITLE\"", ...
Replace SEQRES lines with a new sequence, optionally removing mutated sidechains
[ "Replace", "SEQRES", "lines", "with", "a", "new", "sequence", "optionally", "removing", "mutated", "sidechains" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/chainsequence.py#L100-L145
train
brunato/lograptor
lograptor/matcher.py
has_host_match
def has_host_match(log_data, hosts): """ Match the data with a list of hostname patterns. If the log line data doesn't include host information considers the line as matched. """ hostname = getattr(log_data, 'host', None) if hostname and hostname not in host_cache: for host_pattern in ho...
python
def has_host_match(log_data, hosts): """ Match the data with a list of hostname patterns. If the log line data doesn't include host information considers the line as matched. """ hostname = getattr(log_data, 'host', None) if hostname and hostname not in host_cache: for host_pattern in ho...
[ "def", "has_host_match", "(", "log_data", ",", "hosts", ")", ":", "hostname", "=", "getattr", "(", "log_data", ",", "'host'", ",", "None", ")", "if", "hostname", "and", "hostname", "not", "in", "host_cache", ":", "for", "host_pattern", "in", "hosts", ":", ...
Match the data with a list of hostname patterns. If the log line data doesn't include host information considers the line as matched.
[ "Match", "the", "data", "with", "a", "list", "of", "hostname", "patterns", ".", "If", "the", "log", "line", "data", "doesn", "t", "include", "host", "information", "considers", "the", "line", "as", "matched", "." ]
b1f09fe1b429ed15110610092704ef12d253f3c9
https://github.com/brunato/lograptor/blob/b1f09fe1b429ed15110610092704ef12d253f3c9/lograptor/matcher.py#L159-L172
train
aacanakin/glim
glim/commands.py
StartCommand.run
def run(self, app): """Function starts the web server given configuration.""" GlimLog.info('Glim server started on %s environment' % self.args.env) try: kwargs = Config.get('app.server.options') run(app.wsgi, host=Config.get('app.server.host'), ...
python
def run(self, app): """Function starts the web server given configuration.""" GlimLog.info('Glim server started on %s environment' % self.args.env) try: kwargs = Config.get('app.server.options') run(app.wsgi, host=Config.get('app.server.host'), ...
[ "def", "run", "(", "self", ",", "app", ")", ":", "GlimLog", ".", "info", "(", "'Glim server started on %s environment'", "%", "self", ".", "args", ".", "env", ")", "try", ":", "kwargs", "=", "Config", ".", "get", "(", "'app.server.options'", ")", "run", ...
Function starts the web server given configuration.
[ "Function", "starts", "the", "web", "server", "given", "configuration", "." ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/commands.py#L66-L80
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ssm.py
get_symmetrical_std_devs
def get_symmetrical_std_devs(values, ignore_zeros = True): """Takes a list of values and splits it into positive and negative values. For both of these subsets, a symmetrical distribution is created by mirroring each value along the origin and the standard deviation for both subsets is returned. :param ...
python
def get_symmetrical_std_devs(values, ignore_zeros = True): """Takes a list of values and splits it into positive and negative values. For both of these subsets, a symmetrical distribution is created by mirroring each value along the origin and the standard deviation for both subsets is returned. :param ...
[ "def", "get_symmetrical_std_devs", "(", "values", ",", "ignore_zeros", "=", "True", ")", ":", "pos_stdeviation", "=", "get_symmetrical_std_dev", "(", "values", ",", "True", ",", "ignore_zeros", "=", "ignore_zeros", ")", "neg_stdeviation", "=", "get_symmetrical_std_dev...
Takes a list of values and splits it into positive and negative values. For both of these subsets, a symmetrical distribution is created by mirroring each value along the origin and the standard deviation for both subsets is returned. :param values: A list of numerical values. :param ignore_zeros: Wheth...
[ "Takes", "a", "list", "of", "values", "and", "splits", "it", "into", "positive", "and", "negative", "values", ".", "For", "both", "of", "these", "subsets", "a", "symmetrical", "distribution", "is", "created", "by", "mirroring", "each", "value", "along", "the...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ssm.py#L160-L170
train
Kortemme-Lab/klab
klab/benchmarking/analysis/ssm.py
get_std_xy_dataset_statistics
def get_std_xy_dataset_statistics(x_values, y_values, expect_negative_correlation = False, STDev_cutoff = 1.0): '''Calls parse_csv and returns the analysis in a format similar to get_xy_dataset_statistics in klab.stats.misc.''' assert(len(x_values) == len(y_values)) csv_lines = ['ID,X,Y'] + [','.join(map(st...
python
def get_std_xy_dataset_statistics(x_values, y_values, expect_negative_correlation = False, STDev_cutoff = 1.0): '''Calls parse_csv and returns the analysis in a format similar to get_xy_dataset_statistics in klab.stats.misc.''' assert(len(x_values) == len(y_values)) csv_lines = ['ID,X,Y'] + [','.join(map(st...
[ "def", "get_std_xy_dataset_statistics", "(", "x_values", ",", "y_values", ",", "expect_negative_correlation", "=", "False", ",", "STDev_cutoff", "=", "1.0", ")", ":", "assert", "(", "len", "(", "x_values", ")", "==", "len", "(", "y_values", ")", ")", "csv_line...
Calls parse_csv and returns the analysis in a format similar to get_xy_dataset_statistics in klab.stats.misc.
[ "Calls", "parse_csv", "and", "returns", "the", "analysis", "in", "a", "format", "similar", "to", "get_xy_dataset_statistics", "in", "klab", ".", "stats", ".", "misc", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/benchmarking/analysis/ssm.py#L482-L500
train
clement-alexandre/TotemBionet
totembionet/src/discrete_model/gene.py
Gene.active_multiplex
def active_multiplex(self, state: 'State') -> Tuple['Multiplex']: """ Return a tuple of all the active multiplex in the given state. """ return tuple(multiplex for multiplex in self.multiplexes if multiplex.is_active(state))
python
def active_multiplex(self, state: 'State') -> Tuple['Multiplex']: """ Return a tuple of all the active multiplex in the given state. """ return tuple(multiplex for multiplex in self.multiplexes if multiplex.is_active(state))
[ "def", "active_multiplex", "(", "self", ",", "state", ":", "'State'", ")", "->", "Tuple", "[", "'Multiplex'", "]", ":", "return", "tuple", "(", "multiplex", "for", "multiplex", "in", "self", ".", "multiplexes", "if", "multiplex", ".", "is_active", "(", "st...
Return a tuple of all the active multiplex in the given state.
[ "Return", "a", "tuple", "of", "all", "the", "active", "multiplex", "in", "the", "given", "state", "." ]
f37a2f9358c1ce49f21c4a868b904da5dcd4614f
https://github.com/clement-alexandre/TotemBionet/blob/f37a2f9358c1ce49f21c4a868b904da5dcd4614f/totembionet/src/discrete_model/gene.py#L16-L20
train
assamite/creamas
creamas/core/agent.py
CreativeAgent.sanitized_name
def sanitized_name(self): """Sanitized name of the agent, used for file and directory creation. """ a = re.split("[:/]", self.name) return "_".join([i for i in a if len(i) > 0])
python
def sanitized_name(self): """Sanitized name of the agent, used for file and directory creation. """ a = re.split("[:/]", self.name) return "_".join([i for i in a if len(i) > 0])
[ "def", "sanitized_name", "(", "self", ")", ":", "a", "=", "re", ".", "split", "(", "\"[:/]\"", ",", "self", ".", "name", ")", "return", "\"_\"", ".", "join", "(", "[", "i", "for", "i", "in", "a", "if", "len", "(", "i", ")", ">", "0", "]", ")"...
Sanitized name of the agent, used for file and directory creation.
[ "Sanitized", "name", "of", "the", "agent", "used", "for", "file", "and", "directory", "creation", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/agent.py#L93-L97
train
assamite/creamas
creamas/core/agent.py
CreativeAgent.get_connections
def get_connections(self, data=False): """Get agent's current connections. :param bool data: Also return the data dictionary for each connection. :returns: A list of agent addresses or a dictionary """ if data: return self._connections return lis...
python
def get_connections(self, data=False): """Get agent's current connections. :param bool data: Also return the data dictionary for each connection. :returns: A list of agent addresses or a dictionary """ if data: return self._connections return lis...
[ "def", "get_connections", "(", "self", ",", "data", "=", "False", ")", ":", "if", "data", ":", "return", "self", ".", "_connections", "return", "list", "(", "self", ".", "_connections", ".", "keys", "(", ")", ")" ]
Get agent's current connections. :param bool data: Also return the data dictionary for each connection. :returns: A list of agent addresses or a dictionary
[ "Get", "agent", "s", "current", "connections", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/agent.py#L229-L239
train
assamite/creamas
creamas/core/agent.py
CreativeAgent.publish
def publish(self, artifact): """Publish artifact to agent's environment. :param artifact: artifact to be published :type artifact: :py:class:`~creamas.core.artifact.Artifact` """ self.env.add_artifact(artifact) self._log(logging.DEBUG, "Published {} to domain.".format(ar...
python
def publish(self, artifact): """Publish artifact to agent's environment. :param artifact: artifact to be published :type artifact: :py:class:`~creamas.core.artifact.Artifact` """ self.env.add_artifact(artifact) self._log(logging.DEBUG, "Published {} to domain.".format(ar...
[ "def", "publish", "(", "self", ",", "artifact", ")", ":", "self", ".", "env", ".", "add_artifact", "(", "artifact", ")", "self", ".", "_log", "(", "logging", ".", "DEBUG", ",", "\"Published {} to domain.\"", ".", "format", "(", "artifact", ")", ")" ]
Publish artifact to agent's environment. :param artifact: artifact to be published :type artifact: :py:class:`~creamas.core.artifact.Artifact`
[ "Publish", "artifact", "to", "agent", "s", "environment", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/agent.py#L259-L266
train
assamite/creamas
creamas/core/agent.py
CreativeAgent.ask_opinion
async def ask_opinion(self, addr, artifact): """Ask an agent's opinion about an artifact. :param str addr: Address of the agent which opinion is asked :type addr: :py:class:`~creamas.core.agent.CreativeAgent` :param object artifact: artifact to be evaluated :returns: agent's eva...
python
async def ask_opinion(self, addr, artifact): """Ask an agent's opinion about an artifact. :param str addr: Address of the agent which opinion is asked :type addr: :py:class:`~creamas.core.agent.CreativeAgent` :param object artifact: artifact to be evaluated :returns: agent's eva...
[ "async", "def", "ask_opinion", "(", "self", ",", "addr", ",", "artifact", ")", ":", "remote_agent", "=", "await", "self", ".", "env", ".", "connect", "(", "addr", ")", "return", "await", "remote_agent", ".", "evaluate", "(", "artifact", ")" ]
Ask an agent's opinion about an artifact. :param str addr: Address of the agent which opinion is asked :type addr: :py:class:`~creamas.core.agent.CreativeAgent` :param object artifact: artifact to be evaluated :returns: agent's evaluation of the artifact :rtype: float T...
[ "Ask", "an", "agent", "s", "opinion", "about", "an", "artifact", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/core/agent.py#L280-L299
train
projectshift/shift-boiler
boiler/feature/localization.py
localization_feature
def localization_feature(app): """ Localization feature This will initialize support for translations and localization of values such as numbers, money, dates and formatting timezones. """ # apply app default to babel app.config['BABEL_DEFAULT_LOCALE'] = app.config['DEFAULT_LOCALE'] app...
python
def localization_feature(app): """ Localization feature This will initialize support for translations and localization of values such as numbers, money, dates and formatting timezones. """ # apply app default to babel app.config['BABEL_DEFAULT_LOCALE'] = app.config['DEFAULT_LOCALE'] app...
[ "def", "localization_feature", "(", "app", ")", ":", "app", ".", "config", "[", "'BABEL_DEFAULT_LOCALE'", "]", "=", "app", ".", "config", "[", "'DEFAULT_LOCALE'", "]", "app", ".", "config", "[", "'BABEL_DEFAULT_TIMEZONE'", "]", "=", "app", ".", "config", "["...
Localization feature This will initialize support for translations and localization of values such as numbers, money, dates and formatting timezones.
[ "Localization", "feature", "This", "will", "initialize", "support", "for", "translations", "and", "localization", "of", "values", "such", "as", "numbers", "money", "dates", "and", "formatting", "timezones", "." ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/feature/localization.py#L4-L17
train
adaptive-learning/proso-apps
proso/django/enrichment.py
enrich_json_objects_by_object_type
def enrich_json_objects_by_object_type(request, value): """ Take the given value and start enrichment by object_type. The va Args: request (django.http.request.HttpRequest): request which is currently processed value (dict|list|django.db.models.Model): in case of django.db.model...
python
def enrich_json_objects_by_object_type(request, value): """ Take the given value and start enrichment by object_type. The va Args: request (django.http.request.HttpRequest): request which is currently processed value (dict|list|django.db.models.Model): in case of django.db.model...
[ "def", "enrich_json_objects_by_object_type", "(", "request", ",", "value", ")", ":", "time_start_globally", "=", "time", "(", ")", "if", "isinstance", "(", "value", ",", "list", ")", ":", "json", "=", "[", "x", ".", "to_json", "(", ")", "if", "hasattr", ...
Take the given value and start enrichment by object_type. The va Args: request (django.http.request.HttpRequest): request which is currently processed value (dict|list|django.db.models.Model): in case of django.db.models.Model object (or list of these objects), to_json metho...
[ "Take", "the", "given", "value", "and", "start", "enrichment", "by", "object_type", ".", "The", "va" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso/django/enrichment.py#L70-L108
train
adaptive-learning/proso-apps
proso/django/enrichment.py
enrich_by_predicate
def enrich_by_predicate(request, json, fun, predicate, skip_nested=False, **kwargs): """ Take the JSON, find all its subparts satisfying the given condition and them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint fro...
python
def enrich_by_predicate(request, json, fun, predicate, skip_nested=False, **kwargs): """ Take the JSON, find all its subparts satisfying the given condition and them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint fro...
[ "def", "enrich_by_predicate", "(", "request", ",", "json", ",", "fun", ",", "predicate", ",", "skip_nested", "=", "False", ",", "**", "kwargs", ")", ":", "time_start", "=", "time", "(", ")", "collected", "=", "[", "]", "memory", "=", "{", "'nested'", "...
Take the JSON, find all its subparts satisfying the given condition and them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint from proso.django.enrichment import enrich_by_predicate request = None .. testcode:: ...
[ "Take", "the", "JSON", "find", "all", "its", "subparts", "satisfying", "the", "given", "condition", "and", "them", "by", "the", "given", "function", ".", "Other", "key", "-", "word", "arguments", "are", "passed", "to", "the", "function", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso/django/enrichment.py#L139-L201
train
adaptive-learning/proso-apps
proso/django/enrichment.py
enrich_by_object_type
def enrich_by_object_type(request, json, fun, object_type, skip_nested=False, **kwargs): """ Take the JSON, find its subparts having the given object part and transform them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint ...
python
def enrich_by_object_type(request, json, fun, object_type, skip_nested=False, **kwargs): """ Take the JSON, find its subparts having the given object part and transform them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint ...
[ "def", "enrich_by_object_type", "(", "request", ",", "json", ",", "fun", ",", "object_type", ",", "skip_nested", "=", "False", ",", "**", "kwargs", ")", ":", "if", "not", "isinstance", "(", "object_type", ",", "list", ")", ":", "object_type", "=", "[", "...
Take the JSON, find its subparts having the given object part and transform them by the given function. Other key-word arguments are passed to the function. .. testsetup:: from pprint import pprint from proso.django.enrichment import enrich_by_object_type request = None .. testcod...
[ "Take", "the", "JSON", "find", "its", "subparts", "having", "the", "given", "object", "part", "and", "transform", "them", "by", "the", "given", "function", ".", "Other", "key", "-", "word", "arguments", "are", "passed", "to", "the", "function", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso/django/enrichment.py#L204-L247
train
adaptive-learning/proso-apps
proso_flashcards/models.py
change_parent
def change_parent(sender, instance, **kwargs): """ When the given flashcard has changed. Look at term and context and change the corresponding item relation. """ if instance.id is None: return if len({'term', 'term_id'} & set(instance.changed_fields)) != 0: diff = instance.diff ...
python
def change_parent(sender, instance, **kwargs): """ When the given flashcard has changed. Look at term and context and change the corresponding item relation. """ if instance.id is None: return if len({'term', 'term_id'} & set(instance.changed_fields)) != 0: diff = instance.diff ...
[ "def", "change_parent", "(", "sender", ",", "instance", ",", "**", "kwargs", ")", ":", "if", "instance", ".", "id", "is", "None", ":", "return", "if", "len", "(", "{", "'term'", ",", "'term_id'", "}", "&", "set", "(", "instance", ".", "changed_fields",...
When the given flashcard has changed. Look at term and context and change the corresponding item relation.
[ "When", "the", "given", "flashcard", "has", "changed", ".", "Look", "at", "term", "and", "context", "and", "change", "the", "corresponding", "item", "relation", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_flashcards/models.py#L367-L398
train
Kortemme-Lab/klab
klab/bio/bonsai.py
example
def example(): '''This section gives examples of how to use the module.''' # 1a8d is an example from the loops benchmark # 1lfa contains hydrogens b = Bonsai.retrieve('1lfa', cache_dir='/tmp') search_radius = 10.0 atom_of_interest = b.get_atom(1095) nearby_atoms = b.find_atoms_near_atom(at...
python
def example(): '''This section gives examples of how to use the module.''' # 1a8d is an example from the loops benchmark # 1lfa contains hydrogens b = Bonsai.retrieve('1lfa', cache_dir='/tmp') search_radius = 10.0 atom_of_interest = b.get_atom(1095) nearby_atoms = b.find_atoms_near_atom(at...
[ "def", "example", "(", ")", ":", "b", "=", "Bonsai", ".", "retrieve", "(", "'1lfa'", ",", "cache_dir", "=", "'/tmp'", ")", "search_radius", "=", "10.0", "atom_of_interest", "=", "b", ".", "get_atom", "(", "1095", ")", "nearby_atoms", "=", "b", ".", "fi...
This section gives examples of how to use the module.
[ "This", "section", "gives", "examples", "of", "how", "to", "use", "the", "module", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/bonsai.py#L788-L810
train
Kortemme-Lab/klab
klab/bio/bonsai.py
PDBSection.from_non_aligned_residue_IDs
def from_non_aligned_residue_IDs(Chain, StartResidueID, EndResidueID, Sequence = None): '''A more forgiving method that does not care about the padding of the residue IDs.''' return PDBSection(Chain, PDB.ResidueID2String(StartResidueID), PDB.ResidueID2String(EndResidueID), Sequence = Sequence)
python
def from_non_aligned_residue_IDs(Chain, StartResidueID, EndResidueID, Sequence = None): '''A more forgiving method that does not care about the padding of the residue IDs.''' return PDBSection(Chain, PDB.ResidueID2String(StartResidueID), PDB.ResidueID2String(EndResidueID), Sequence = Sequence)
[ "def", "from_non_aligned_residue_IDs", "(", "Chain", ",", "StartResidueID", ",", "EndResidueID", ",", "Sequence", "=", "None", ")", ":", "return", "PDBSection", "(", "Chain", ",", "PDB", ".", "ResidueID2String", "(", "StartResidueID", ")", ",", "PDB", ".", "Re...
A more forgiving method that does not care about the padding of the residue IDs.
[ "A", "more", "forgiving", "method", "that", "does", "not", "care", "about", "the", "padding", "of", "the", "residue", "IDs", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/bonsai.py#L63-L65
train
Kortemme-Lab/klab
klab/bio/bonsai.py
ResidueIndexedPDBFile.bin_atoms
def bin_atoms(self): '''This function bins the Atoms into fixed-size sections of the protein space in 3D.''' # Create the atom bins low_point = numpy.array([self.min_x, self.min_y, self.min_z]) high_point = numpy.array([self.max_x, self.max_y, self.max_z]) atom_bin_dimensions = ...
python
def bin_atoms(self): '''This function bins the Atoms into fixed-size sections of the protein space in 3D.''' # Create the atom bins low_point = numpy.array([self.min_x, self.min_y, self.min_z]) high_point = numpy.array([self.max_x, self.max_y, self.max_z]) atom_bin_dimensions = ...
[ "def", "bin_atoms", "(", "self", ")", ":", "low_point", "=", "numpy", ".", "array", "(", "[", "self", ".", "min_x", ",", "self", ".", "min_y", ",", "self", ".", "min_z", "]", ")", "high_point", "=", "numpy", ".", "array", "(", "[", "self", ".", "...
This function bins the Atoms into fixed-size sections of the protein space in 3D.
[ "This", "function", "bins", "the", "Atoms", "into", "fixed", "-", "size", "sections", "of", "the", "protein", "space", "in", "3D", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/bonsai.py#L308-L348
train
Kortemme-Lab/klab
klab/bio/bonsai.py
Bonsai.find_heavy_atoms_near_atom
def find_heavy_atoms_near_atom(self, source_atom, search_radius, atom_hit_cache = set(), restrict_to_CA = False): '''atom_hit_cache is a set of atom serial numbers which have already been tested. We keep track of these to avoid recalculating the distance. ''' #todo: Benchmark atom_hit_cache to s...
python
def find_heavy_atoms_near_atom(self, source_atom, search_radius, atom_hit_cache = set(), restrict_to_CA = False): '''atom_hit_cache is a set of atom serial numbers which have already been tested. We keep track of these to avoid recalculating the distance. ''' #todo: Benchmark atom_hit_cache to s...
[ "def", "find_heavy_atoms_near_atom", "(", "self", ",", "source_atom", ",", "search_radius", ",", "atom_hit_cache", "=", "set", "(", ")", ",", "restrict_to_CA", "=", "False", ")", ":", "non_heavy_atoms", "=", "self", ".", "get_atom_names_by_group", "(", "set", "(...
atom_hit_cache is a set of atom serial numbers which have already been tested. We keep track of these to avoid recalculating the distance.
[ "atom_hit_cache", "is", "a", "set", "of", "atom", "serial", "numbers", "which", "have", "already", "been", "tested", ".", "We", "keep", "track", "of", "these", "to", "avoid", "recalculating", "the", "distance", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/bonsai.py#L414-L420
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config.get
def get(self, attr_name, *args): """ Get the most retrieval attribute in the configuration file. This method will recursively look through the configuration file for the attribute specified and return the last found value or None. The values can be referenced by the key name provided in...
python
def get(self, attr_name, *args): """ Get the most retrieval attribute in the configuration file. This method will recursively look through the configuration file for the attribute specified and return the last found value or None. The values can be referenced by the key name provided in...
[ "def", "get", "(", "self", ",", "attr_name", ",", "*", "args", ")", ":", "if", "not", "isinstance", "(", "attr_name", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'attr_name must be a str.'", ")", "if", "'-'", "in", "attr_name", ...
Get the most retrieval attribute in the configuration file. This method will recursively look through the configuration file for the attribute specified and return the last found value or None. The values can be referenced by the key name provided in the configuration file or that value normali...
[ "Get", "the", "most", "retrieval", "attribute", "in", "the", "configuration", "file", ".", "This", "method", "will", "recursively", "look", "through", "the", "configuration", "file", "for", "the", "attribute", "specified", "and", "return", "the", "last", "found"...
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L883-L924
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config.service_references
def service_references(self): """ returns a list of service names """ services_blue_print = self._scheme_references.get('services') if services_blue_print is None: raise LookupError('unable to find any services in the config.') # TODO: this needs to be cleaned up and...
python
def service_references(self): """ returns a list of service names """ services_blue_print = self._scheme_references.get('services') if services_blue_print is None: raise LookupError('unable to find any services in the config.') # TODO: this needs to be cleaned up and...
[ "def", "service_references", "(", "self", ")", ":", "services_blue_print", "=", "self", ".", "_scheme_references", ".", "get", "(", "'services'", ")", "if", "services_blue_print", "is", "None", ":", "raise", "LookupError", "(", "'unable to find any services in the con...
returns a list of service names
[ "returns", "a", "list", "of", "service", "names" ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L928-L936
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config.validate
def validate(self): """ Validate the contents of the configuration file. Will return None if validation is successful or raise an error if not. """ if not isinstance(self._data, dict): raise TypeError('freight forwarder configuration file must be a dict.') current_lo...
python
def validate(self): """ Validate the contents of the configuration file. Will return None if validation is successful or raise an error if not. """ if not isinstance(self._data, dict): raise TypeError('freight forwarder configuration file must be a dict.') current_lo...
[ "def", "validate", "(", "self", ")", ":", "if", "not", "isinstance", "(", "self", ".", "_data", ",", "dict", ")", ":", "raise", "TypeError", "(", "'freight forwarder configuration file must be a dict.'", ")", "current_log_level", "=", "logger", ".", "get_level", ...
Validate the contents of the configuration file. Will return None if validation is successful or raise an error if not.
[ "Validate", "the", "contents", "of", "the", "configuration", "file", ".", "Will", "return", "None", "if", "validation", "is", "successful", "or", "raise", "an", "error", "if", "not", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L965-L992
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._load
def _load(self): """ Load a configuration file. This method will be called when the Config class is instantiated. The configuration file can be json or yaml. """ if os.path.isdir(self._path): for file_ext in ('yml', 'yaml', 'json'): test_path = os.path.join(...
python
def _load(self): """ Load a configuration file. This method will be called when the Config class is instantiated. The configuration file can be json or yaml. """ if os.path.isdir(self._path): for file_ext in ('yml', 'yaml', 'json'): test_path = os.path.join(...
[ "def", "_load", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "self", ".", "_path", ")", ":", "for", "file_ext", "in", "(", "'yml'", ",", "'yaml'", ",", "'json'", ")", ":", "test_path", "=", "os", ".", "path", ".", "join", ...
Load a configuration file. This method will be called when the Config class is instantiated. The configuration file can be json or yaml.
[ "Load", "a", "configuration", "file", ".", "This", "method", "will", "be", "called", "when", "the", "Config", "class", "is", "instantiated", ".", "The", "configuration", "file", "can", "be", "json", "or", "yaml", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L997-L1024
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._load_yml_config
def _load_yml_config(self, config_file): """ loads a yaml str, creates a few constructs for pyaml, serializes and normalized the config data. Then assigns the config data to self._data. :param config_file: A :string: loaded from a yaml file. """ if not isinstance(config_file, s...
python
def _load_yml_config(self, config_file): """ loads a yaml str, creates a few constructs for pyaml, serializes and normalized the config data. Then assigns the config data to self._data. :param config_file: A :string: loaded from a yaml file. """ if not isinstance(config_file, s...
[ "def", "_load_yml_config", "(", "self", ",", "config_file", ")", ":", "if", "not", "isinstance", "(", "config_file", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'config_file must be a str.'", ")", "try", ":", "def", "construct_yaml_int...
loads a yaml str, creates a few constructs for pyaml, serializes and normalized the config data. Then assigns the config data to self._data. :param config_file: A :string: loaded from a yaml file.
[ "loads", "a", "yaml", "str", "creates", "a", "few", "constructs", "for", "pyaml", "serializes", "and", "normalized", "the", "config", "data", ".", "Then", "assigns", "the", "config", "data", "to", "self", ".", "_data", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1026-L1112
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._create_attr
def _create_attr(self, property_key, data, ancestors): """ Dynamically Creates attributes on for a Config. Also adds name and alias to each Config object. :param property_key: A :string: configuration property name. :param data: The adds the user supplied for this specific property. :p...
python
def _create_attr(self, property_key, data, ancestors): """ Dynamically Creates attributes on for a Config. Also adds name and alias to each Config object. :param property_key: A :string: configuration property name. :param data: The adds the user supplied for this specific property. :p...
[ "def", "_create_attr", "(", "self", ",", "property_key", ",", "data", ",", "ancestors", ")", ":", "if", "not", "isinstance", "(", "property_key", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"property_key must be a string. type: {0} was ...
Dynamically Creates attributes on for a Config. Also adds name and alias to each Config object. :param property_key: A :string: configuration property name. :param data: The adds the user supplied for this specific property. :param ancestors: A :OrderedDict: that provides a history of its ance...
[ "Dynamically", "Creates", "attributes", "on", "for", "a", "Config", ".", "Also", "adds", "name", "and", "alias", "to", "each", "Config", "object", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1140-L1185
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._collect_unrecognized_values
def _collect_unrecognized_values(self, scheme, data, ancestors): """ Looks for values that aren't defined in the scheme and returns a dict with any unrecognized values found. :param scheme: A :dict:, The scheme defining the validations. :param data: A :dict: user supplied for this specific prop...
python
def _collect_unrecognized_values(self, scheme, data, ancestors): """ Looks for values that aren't defined in the scheme and returns a dict with any unrecognized values found. :param scheme: A :dict:, The scheme defining the validations. :param data: A :dict: user supplied for this specific prop...
[ "def", "_collect_unrecognized_values", "(", "self", ",", "scheme", ",", "data", ",", "ancestors", ")", ":", "if", "not", "isinstance", "(", "ancestors", ",", "OrderedDict", ")", ":", "raise", "TypeError", "(", "\"ancestors must be an OrderedDict. type: {0} was passed....
Looks for values that aren't defined in the scheme and returns a dict with any unrecognized values found. :param scheme: A :dict:, The scheme defining the validations. :param data: A :dict: user supplied for this specific property. :param ancestors: A :OrderedDict: that provides a history of it...
[ "Looks", "for", "values", "that", "aren", "t", "defined", "in", "the", "scheme", "and", "returns", "a", "dict", "with", "any", "unrecognized", "values", "found", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1187-L1225
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._update_scheme
def _update_scheme(self, scheme, ancestors): """ Updates the current scheme based off special pre-defined keys and retruns a new updated scheme. :param scheme: A :dict:, The scheme defining the validations. :param ancestors: A :OrderedDict: that provides a history of its ancestors. :rty...
python
def _update_scheme(self, scheme, ancestors): """ Updates the current scheme based off special pre-defined keys and retruns a new updated scheme. :param scheme: A :dict:, The scheme defining the validations. :param ancestors: A :OrderedDict: that provides a history of its ancestors. :rty...
[ "def", "_update_scheme", "(", "self", ",", "scheme", ",", "ancestors", ")", ":", "if", "not", "isinstance", "(", "ancestors", ",", "OrderedDict", ")", ":", "raise", "TypeError", "(", "\"ancestors must be an OrderedDict. type: {0} was passed.\"", ".", "format", "(", ...
Updates the current scheme based off special pre-defined keys and retruns a new updated scheme. :param scheme: A :dict:, The scheme defining the validations. :param ancestors: A :OrderedDict: that provides a history of its ancestors. :rtype: A new :dict: with updated scheme values.
[ "Updates", "the", "current", "scheme", "based", "off", "special", "pre", "-", "defined", "keys", "and", "retruns", "a", "new", "updated", "scheme", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1227-L1272
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._walk_tree
def _walk_tree(self, data, scheme, ancestors=None, property_name=None, prefix=None): """ This function takes configuration data and a validation scheme then walk the configuration tree validating the configuraton data agenst the scheme provided. Will raise error on failure otherwise return None....
python
def _walk_tree(self, data, scheme, ancestors=None, property_name=None, prefix=None): """ This function takes configuration data and a validation scheme then walk the configuration tree validating the configuraton data agenst the scheme provided. Will raise error on failure otherwise return None....
[ "def", "_walk_tree", "(", "self", ",", "data", ",", "scheme", ",", "ancestors", "=", "None", ",", "property_name", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "property_name", "is", "None", ":", "property_name", "=", "'root'", "order", "=", ...
This function takes configuration data and a validation scheme then walk the configuration tree validating the configuraton data agenst the scheme provided. Will raise error on failure otherwise return None. Usage:: >>> self._walk_tree( >>> OrderedDict([('root', confi...
[ "This", "function", "takes", "configuration", "data", "and", "a", "validation", "scheme", "then", "walk", "the", "configuration", "tree", "validating", "the", "configuraton", "data", "agenst", "the", "scheme", "provided", ".", "Will", "raise", "error", "on", "fa...
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1331-L1390
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._update_ancestors
def _update_ancestors(self, config_data, property_name, ancestors=None): """ Update ancestors for a specific property. :param ancestors: A :OrderedDict:, representing the ancestors of a property. :param config_data: The data that needs to be validated agents the scheme. :param property_...
python
def _update_ancestors(self, config_data, property_name, ancestors=None): """ Update ancestors for a specific property. :param ancestors: A :OrderedDict:, representing the ancestors of a property. :param config_data: The data that needs to be validated agents the scheme. :param property_...
[ "def", "_update_ancestors", "(", "self", ",", "config_data", ",", "property_name", ",", "ancestors", "=", "None", ")", ":", "if", "not", "isinstance", "(", "property_name", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "\"property_key m...
Update ancestors for a specific property. :param ancestors: A :OrderedDict:, representing the ancestors of a property. :param config_data: The data that needs to be validated agents the scheme. :param property_name: A :string: of the properties name. :rtype: A :OrderDict: that has been ...
[ "Update", "ancestors", "for", "a", "specific", "property", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1392-L1424
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config._reference_keys
def _reference_keys(self, reference): """ Returns a list of all of keys for a given reference. :param reference: a :string: :rtype: A :list: of reference keys. """ if not isinstance(reference, six.string_types): raise TypeError( 'When using ~ to refer...
python
def _reference_keys(self, reference): """ Returns a list of all of keys for a given reference. :param reference: a :string: :rtype: A :list: of reference keys. """ if not isinstance(reference, six.string_types): raise TypeError( 'When using ~ to refer...
[ "def", "_reference_keys", "(", "self", ",", "reference", ")", ":", "if", "not", "isinstance", "(", "reference", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'When using ~ to reference dynamic attributes ref must be a str. a {0} was provided.'", ...
Returns a list of all of keys for a given reference. :param reference: a :string: :rtype: A :list: of reference keys.
[ "Returns", "a", "list", "of", "all", "of", "keys", "for", "a", "given", "reference", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1426-L1450
train
TUNE-Archive/freight_forwarder
freight_forwarder/config.py
Config.__execute_validations
def __execute_validations(self, validations, data, property_name, ancestors, negation=False, prefix=None): """ Validate the data for a specific configuration value. This method will look up all of the validations provided and dynamically call any validation methods. If a validation fails a error will be...
python
def __execute_validations(self, validations, data, property_name, ancestors, negation=False, prefix=None): """ Validate the data for a specific configuration value. This method will look up all of the validations provided and dynamically call any validation methods. If a validation fails a error will be...
[ "def", "__execute_validations", "(", "self", ",", "validations", ",", "data", ",", "property_name", ",", "ancestors", ",", "negation", "=", "False", ",", "prefix", "=", "None", ")", ":", "if", "not", "isinstance", "(", "ancestors", ",", "OrderedDict", ")", ...
Validate the data for a specific configuration value. This method will look up all of the validations provided and dynamically call any validation methods. If a validation fails a error will be thrown. If no errors are found a attributes will be dynamically created on the Config object for the configur...
[ "Validate", "the", "data", "for", "a", "specific", "configuration", "value", ".", "This", "method", "will", "look", "up", "all", "of", "the", "validations", "provided", "and", "dynamically", "call", "any", "validation", "methods", ".", "If", "a", "validation",...
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/config.py#L1505-L1542
train
ZEDGR/pychal
challonge/tournaments.py
create
def create(name, url, tournament_type="single elimination", **params): """Create a new tournament.""" params.update({ "name": name, "url": url, "tournament_type": tournament_type, }) return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
python
def create(name, url, tournament_type="single elimination", **params): """Create a new tournament.""" params.update({ "name": name, "url": url, "tournament_type": tournament_type, }) return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
[ "def", "create", "(", "name", ",", "url", ",", "tournament_type", "=", "\"single elimination\"", ",", "**", "params", ")", ":", "params", ".", "update", "(", "{", "\"name\"", ":", "name", ",", "\"url\"", ":", "url", ",", "\"tournament_type\"", ":", "tourna...
Create a new tournament.
[ "Create", "a", "new", "tournament", "." ]
3600fa9e0557a2a14eb1ad0c0711d28dad3693d7
https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/tournaments.py#L9-L17
train
projectshift/shift-boiler
boiler/feature/users.py
users_feature
def users_feature(app): """ Add users feature Allows to register users and assign groups, instantiates flask login, flask principal and oauth integration """ # check we have jwt secret configures if not app.config.get('USER_JWT_SECRET', None): raise x.JwtSecretMissing('Please set US...
python
def users_feature(app): """ Add users feature Allows to register users and assign groups, instantiates flask login, flask principal and oauth integration """ # check we have jwt secret configures if not app.config.get('USER_JWT_SECRET', None): raise x.JwtSecretMissing('Please set US...
[ "def", "users_feature", "(", "app", ")", ":", "if", "not", "app", ".", "config", ".", "get", "(", "'USER_JWT_SECRET'", ",", "None", ")", ":", "raise", "x", ".", "JwtSecretMissing", "(", "'Please set USER_JWT_SECRET in config'", ")", "app", ".", "session_interf...
Add users feature Allows to register users and assign groups, instantiates flask login, flask principal and oauth integration
[ "Add", "users", "feature", "Allows", "to", "register", "users", "and", "assign", "groups", "instantiates", "flask", "login", "flask", "principal", "and", "oauth", "integration" ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/feature/users.py#L14-L69
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.rename_document
def rename_document(self, did, name): ''' Renames the specified document. Args: - did (str): Document ID - name (str): New document name Returns: - requests.Response: Onshape response data ''' payload = { 'name': name ...
python
def rename_document(self, did, name): ''' Renames the specified document. Args: - did (str): Document ID - name (str): New document name Returns: - requests.Response: Onshape response data ''' payload = { 'name': name ...
[ "def", "rename_document", "(", "self", ",", "did", ",", "name", ")", ":", "payload", "=", "{", "'name'", ":", "name", "}", "return", "self", ".", "_api", ".", "request", "(", "'post'", ",", "'/api/documents/'", "+", "did", ",", "body", "=", "payload", ...
Renames the specified document. Args: - did (str): Document ID - name (str): New document name Returns: - requests.Response: Onshape response data
[ "Renames", "the", "specified", "document", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L98-L114
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.copy_workspace
def copy_workspace(self, uri, new_name): ''' Copy the current workspace. Args: - uri (dict): the uri of the workspace being copied. Needs to have a did and wid key. - new_name (str): the new name of the copied workspace. Returns: - requests.Response:...
python
def copy_workspace(self, uri, new_name): ''' Copy the current workspace. Args: - uri (dict): the uri of the workspace being copied. Needs to have a did and wid key. - new_name (str): the new name of the copied workspace. Returns: - requests.Response:...
[ "def", "copy_workspace", "(", "self", ",", "uri", ",", "new_name", ")", ":", "payload", "=", "{", "'isPublic'", ":", "True", ",", "'newName'", ":", "new_name", "}", "return", "self", ".", "_api", ".", "request", "(", "'post'", ",", "'/api/documents/'", "...
Copy the current workspace. Args: - uri (dict): the uri of the workspace being copied. Needs to have a did and wid key. - new_name (str): the new name of the copied workspace. Returns: - requests.Response: Onshape response data
[ "Copy", "the", "current", "workspace", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L152-L169
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.create_workspace
def create_workspace(self, did, name, version_id=None): ''' Create a workspace in the specified document. Args: - did (str): the document id of where to create the new workspace - name (str): the new name of the copied workspace. - version_id (str): the ID of...
python
def create_workspace(self, did, name, version_id=None): ''' Create a workspace in the specified document. Args: - did (str): the document id of where to create the new workspace - name (str): the new name of the copied workspace. - version_id (str): the ID of...
[ "def", "create_workspace", "(", "self", ",", "did", ",", "name", ",", "version_id", "=", "None", ")", ":", "payload", "=", "{", "'isPublic'", ":", "True", ",", "'name'", ":", "name", ",", "}", "if", "version_id", ":", "payload", "[", "'versionId'", "]"...
Create a workspace in the specified document. Args: - did (str): the document id of where to create the new workspace - name (str): the new name of the copied workspace. - version_id (str): the ID of the version to be copied into a new workspace Returns: ...
[ "Create", "a", "workspace", "in", "the", "specified", "document", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L171-L192
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.get_partstudio_tessellatededges
def get_partstudio_tessellatededges(self, did, wid, eid): ''' Gets the tessellation of the edges of all parts in a part studio. Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response:...
python
def get_partstudio_tessellatededges(self, did, wid, eid): ''' Gets the tessellation of the edges of all parts in a part studio. Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response:...
[ "def", "get_partstudio_tessellatededges", "(", "self", ",", "did", ",", "wid", ",", "eid", ")", ":", "return", "self", ".", "_api", ".", "request", "(", "'get'", ",", "'/api/partstudios/d/'", "+", "did", "+", "'/w/'", "+", "wid", "+", "'/e/'", "+", "eid"...
Gets the tessellation of the edges of all parts in a part studio. Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response: Onshape response data
[ "Gets", "the", "tessellation", "of", "the", "edges", "of", "all", "parts", "in", "a", "part", "studio", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L228-L241
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.upload_blob
def upload_blob(self, did, wid, filepath='./blob.json'): ''' Uploads a file to a new blob element in the specified doc. Args: - did (str): Document ID - wid (str): Workspace ID - filepath (str, default='./blob.json'): Blob element location Returns: ...
python
def upload_blob(self, did, wid, filepath='./blob.json'): ''' Uploads a file to a new blob element in the specified doc. Args: - did (str): Document ID - wid (str): Workspace ID - filepath (str, default='./blob.json'): Blob element location Returns: ...
[ "def", "upload_blob", "(", "self", ",", "did", ",", "wid", ",", "filepath", "=", "'./blob.json'", ")", ":", "chars", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", "boundary_key", "=", "''", ".", "join", "(", "random", ".", "choice", ...
Uploads a file to a new blob element in the specified doc. Args: - did (str): Document ID - wid (str): Workspace ID - filepath (str, default='./blob.json'): Blob element location Returns: - requests.Response: Onshape response data
[ "Uploads", "a", "file", "to", "a", "new", "blob", "element", "in", "the", "specified", "doc", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L243-L276
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.part_studio_stl
def part_studio_stl(self, did, wid, eid): ''' Exports STL export from a part studio Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response: Onshape response data ''' ...
python
def part_studio_stl(self, did, wid, eid): ''' Exports STL export from a part studio Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response: Onshape response data ''' ...
[ "def", "part_studio_stl", "(", "self", ",", "did", ",", "wid", ",", "eid", ")", ":", "req_headers", "=", "{", "'Accept'", ":", "'application/vnd.onshape.v1+octet-stream'", "}", "return", "self", ".", "_api", ".", "request", "(", "'get'", ",", "'/api/partstudio...
Exports STL export from a part studio Args: - did (str): Document ID - wid (str): Workspace ID - eid (str): Element ID Returns: - requests.Response: Onshape response data
[ "Exports", "STL", "export", "from", "a", "part", "studio" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L278-L294
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.create_assembly_instance
def create_assembly_instance(self, assembly_uri, part_uri, configuration): ''' Insert a configurable part into an assembly. Args: - assembly (dict): eid, wid, and did of the assembly into which will be inserted - part (dict): eid and did of the configurable part ...
python
def create_assembly_instance(self, assembly_uri, part_uri, configuration): ''' Insert a configurable part into an assembly. Args: - assembly (dict): eid, wid, and did of the assembly into which will be inserted - part (dict): eid and did of the configurable part ...
[ "def", "create_assembly_instance", "(", "self", ",", "assembly_uri", ",", "part_uri", ",", "configuration", ")", ":", "payload", "=", "{", "\"documentId\"", ":", "part_uri", "[", "\"did\"", "]", ",", "\"elementId\"", ":", "part_uri", "[", "\"eid\"", "]", ",", ...
Insert a configurable part into an assembly. Args: - assembly (dict): eid, wid, and did of the assembly into which will be inserted - part (dict): eid and did of the configurable part - configuration (dict): the configuration Returns: - requests.Response...
[ "Insert", "a", "configurable", "part", "into", "an", "assembly", "." ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L298-L325
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.encode_configuration
def encode_configuration(self, did, eid, parameters): ''' Encode parameters as a URL-ready string Args: - did (str): Document ID - eid (str): Element ID - parameters (dict): key-value pairs of the parameters to be encoded Returns: - config...
python
def encode_configuration(self, did, eid, parameters): ''' Encode parameters as a URL-ready string Args: - did (str): Document ID - eid (str): Element ID - parameters (dict): key-value pairs of the parameters to be encoded Returns: - config...
[ "def", "encode_configuration", "(", "self", ",", "did", ",", "eid", ",", "parameters", ")", ":", "parameters", "=", "[", "{", "\"parameterId\"", ":", "k", ",", "\"parameterValue\"", ":", "v", "}", "for", "(", "k", ",", "v", ")", "in", "parameters", "."...
Encode parameters as a URL-ready string Args: - did (str): Document ID - eid (str): Element ID - parameters (dict): key-value pairs of the parameters to be encoded Returns: - configuration (str): the url-ready configuration string.
[ "Encode", "parameters", "as", "a", "URL", "-", "ready", "string" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L327-L352
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.get_configuration
def get_configuration(self, uri): ''' get the configuration of a PartStudio Args: - uri (dict): points to a particular element Returns: - requests.Response: Onshape response data ''' req_headers = { 'Accept': 'application/vnd.onshape...
python
def get_configuration(self, uri): ''' get the configuration of a PartStudio Args: - uri (dict): points to a particular element Returns: - requests.Response: Onshape response data ''' req_headers = { 'Accept': 'application/vnd.onshape...
[ "def", "get_configuration", "(", "self", ",", "uri", ")", ":", "req_headers", "=", "{", "'Accept'", ":", "'application/vnd.onshape.v1+json'", ",", "'Content-Type'", ":", "'application/json'", "}", "return", "self", ".", "_api", ".", "request", "(", "'get'", ",",...
get the configuration of a PartStudio Args: - uri (dict): points to a particular element Returns: - requests.Response: Onshape response data
[ "get", "the", "configuration", "of", "a", "PartStudio" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L355-L370
train
ethan92429/onshapepy
onshapepy/core/client.py
Client.update_configuration
def update_configuration(self, did, wid, eid, payload): ''' Update the configuration specified in the payload Args: - did (str): Document ID - eid (str): Element ID - payload (json): the request body Returns: - configuration (str): the url...
python
def update_configuration(self, did, wid, eid, payload): ''' Update the configuration specified in the payload Args: - did (str): Document ID - eid (str): Element ID - payload (json): the request body Returns: - configuration (str): the url...
[ "def", "update_configuration", "(", "self", ",", "did", ",", "wid", ",", "eid", ",", "payload", ")", ":", "req_headers", "=", "{", "'Accept'", ":", "'application/vnd.onshape.v1+json'", ",", "'Content-Type'", ":", "'application/json'", "}", "res", "=", "self", ...
Update the configuration specified in the payload Args: - did (str): Document ID - eid (str): Element ID - payload (json): the request body Returns: - configuration (str): the url-ready configuration string.
[ "Update", "the", "configuration", "specified", "in", "the", "payload" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/client.py#L375-L394
train
teitei-tk/Flask-REST-Controller
flask_rest_controller/routing.py
set_routing
def set_routing(app, view_data): """ apply the routing configuration you've described example: view_data = [ ("/", "app.IndexController", "index"), ] 1. "/" is receive request path 2. "app.IndexController" is to process the received request controller class path...
python
def set_routing(app, view_data): """ apply the routing configuration you've described example: view_data = [ ("/", "app.IndexController", "index"), ] 1. "/" is receive request path 2. "app.IndexController" is to process the received request controller class path...
[ "def", "set_routing", "(", "app", ",", "view_data", ")", ":", "routing_modules", "=", "convert_routing_module", "(", "view_data", ")", "for", "module", "in", "routing_modules", ":", "view", "=", "import_string", "(", "module", ".", "import_path", ")", "app", "...
apply the routing configuration you've described example: view_data = [ ("/", "app.IndexController", "index"), ] 1. "/" is receive request path 2. "app.IndexController" is to process the received request controller class path 3. "index" string To generate a URL ...
[ "apply", "the", "routing", "configuration", "you", "ve", "described" ]
b4386b523f3d2c6550051c95d5ba74e5ff459946
https://github.com/teitei-tk/Flask-REST-Controller/blob/b4386b523f3d2c6550051c95d5ba74e5ff459946/flask_rest_controller/routing.py#L16-L34
train
aacanakin/glim
glim/command.py
CommandAdapter.retrieve_commands
def retrieve_commands(self, module): """ Function smartly imports Command type classes given module Args ---- module (module): The module which Command classes will be extracted from Returns ------- commands (list): A list of ...
python
def retrieve_commands(self, module): """ Function smartly imports Command type classes given module Args ---- module (module): The module which Command classes will be extracted from Returns ------- commands (list): A list of ...
[ "def", "retrieve_commands", "(", "self", ",", "module", ")", ":", "commands", "=", "[", "]", "for", "name", ",", "obj", "in", "inspect", ".", "getmembers", "(", "module", ")", ":", "if", "name", "!=", "'Command'", "and", "'Command'", "in", "name", ":",...
Function smartly imports Command type classes given module Args ---- module (module): The module which Command classes will be extracted from Returns ------- commands (list): A list of Command instances Note: This function ...
[ "Function", "smartly", "imports", "Command", "type", "classes", "given", "module" ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/command.py#L33-L62
train
aacanakin/glim
glim/command.py
CommandAdapter.match
def match(self, args): """ Function dispatches the active command line utility. Args ---- args (argparse.parse_args()): The parsed arguments using parser.parse_args() function. Returns ------- command (glim.command.Command): the active co...
python
def match(self, args): """ Function dispatches the active command line utility. Args ---- args (argparse.parse_args()): The parsed arguments using parser.parse_args() function. Returns ------- command (glim.command.Command): the active co...
[ "def", "match", "(", "self", ",", "args", ")", ":", "command", "=", "None", "for", "c", "in", "self", ".", "commands", ":", "if", "c", ".", "name", "==", "args", ".", "which", ":", "c", ".", "args", "=", "args", "command", "=", "c", "break", "r...
Function dispatches the active command line utility. Args ---- args (argparse.parse_args()): The parsed arguments using parser.parse_args() function. Returns ------- command (glim.command.Command): the active command object.
[ "Function", "dispatches", "the", "active", "command", "line", "utility", "." ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/command.py#L125-L144
train
aacanakin/glim
glim/command.py
CommandAdapter.dispatch
def dispatch(self, command, app): """ Function runs the active command. Args ---- command (glim.command.Command): the command object. app (glim.app.App): the glim app object. Note: Exception handling should be done in Command class itself...
python
def dispatch(self, command, app): """ Function runs the active command. Args ---- command (glim.command.Command): the command object. app (glim.app.App): the glim app object. Note: Exception handling should be done in Command class itself...
[ "def", "dispatch", "(", "self", ",", "command", ",", "app", ")", ":", "if", "self", ".", "is_glimcommand", "(", "command", ")", ":", "command", ".", "run", "(", "app", ")", "else", ":", "command", ".", "run", "(", ")" ]
Function runs the active command. Args ---- command (glim.command.Command): the command object. app (glim.app.App): the glim app object. Note: Exception handling should be done in Command class itself. If not, an unhandled exception may result ...
[ "Function", "runs", "the", "active", "command", "." ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/command.py#L160-L177
train
Kortemme-Lab/klab
klab/bio/fasta.py
FASTA.replace_sequence
def replace_sequence(self, pdb_ID, chain_id, replacement_sequence): '''Replaces a sequence with another. Typically not useful but I use it in the ResidueRelatrix to make sure that the FASTA and SEQRES sequences match.''' old_sequences = self.sequences old_unique_sequences = self.unique_sequences...
python
def replace_sequence(self, pdb_ID, chain_id, replacement_sequence): '''Replaces a sequence with another. Typically not useful but I use it in the ResidueRelatrix to make sure that the FASTA and SEQRES sequences match.''' old_sequences = self.sequences old_unique_sequences = self.unique_sequences...
[ "def", "replace_sequence", "(", "self", ",", "pdb_ID", ",", "chain_id", ",", "replacement_sequence", ")", ":", "old_sequences", "=", "self", ".", "sequences", "old_unique_sequences", "=", "self", ".", "unique_sequences", "self", ".", "sequences", "=", "[", "]", ...
Replaces a sequence with another. Typically not useful but I use it in the ResidueRelatrix to make sure that the FASTA and SEQRES sequences match.
[ "Replaces", "a", "sequence", "with", "another", ".", "Typically", "not", "useful", "but", "I", "use", "it", "in", "the", "ResidueRelatrix", "to", "make", "sure", "that", "the", "FASTA", "and", "SEQRES", "sequences", "match", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/fasta.py#L63-L75
train
Kortemme-Lab/klab
klab/bio/fasta.py
FASTA.retrieve
def retrieve(pdb_id, cache_dir = None, bio_cache = None): '''Creates a FASTA object by using a cached copy of the file if it exists or by retrieving the file from the RCSB.''' pdb_id = pdb_id.upper() if bio_cache: return FASTA(bio_cache.get_fasta_contents(pdb_id)) # Check ...
python
def retrieve(pdb_id, cache_dir = None, bio_cache = None): '''Creates a FASTA object by using a cached copy of the file if it exists or by retrieving the file from the RCSB.''' pdb_id = pdb_id.upper() if bio_cache: return FASTA(bio_cache.get_fasta_contents(pdb_id)) # Check ...
[ "def", "retrieve", "(", "pdb_id", ",", "cache_dir", "=", "None", ",", "bio_cache", "=", "None", ")", ":", "pdb_id", "=", "pdb_id", ".", "upper", "(", ")", "if", "bio_cache", ":", "return", "FASTA", "(", "bio_cache", ".", "get_fasta_contents", "(", "pdb_i...
Creates a FASTA object by using a cached copy of the file if it exists or by retrieving the file from the RCSB.
[ "Creates", "a", "FASTA", "object", "by", "using", "a", "cached", "copy", "of", "the", "file", "if", "it", "exists", "or", "by", "retrieving", "the", "file", "from", "the", "RCSB", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/fasta.py#L91-L117
train