repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
pip-services3-python/pip-services3-components-python
pip_services3_components/build/Factory.py
Factory.can_create
def can_create(self, locator): """ Checks if this factory is able to create component by given locator. This method searches for all registered components and returns a locator for component it is able to create that matches the given locator. If the factory is not able to creat...
python
def can_create(self, locator): """ Checks if this factory is able to create component by given locator. This method searches for all registered components and returns a locator for component it is able to create that matches the given locator. If the factory is not able to creat...
[ "def", "can_create", "(", "self", ",", "locator", ")", ":", "for", "registration", "in", "self", ".", "_registrations", ":", "this_locator", "=", "registration", ".", "locator", "if", "this_locator", "==", "locator", ":", "return", "this_locator", "return", "N...
Checks if this factory is able to create component by given locator. This method searches for all registered components and returns a locator for component it is able to create that matches the given locator. If the factory is not able to create a requested component is returns null. :...
[ "Checks", "if", "this", "factory", "is", "able", "to", "create", "component", "by", "given", "locator", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/build/Factory.py#L70-L86
pip-services3-python/pip-services3-components-python
pip_services3_components/build/Factory.py
Factory.create
def create(self, locator): """ Creates a component identified by given locator. :param locator: a locator to identify component to be created. :return: the created component. """ for registration in self._registrations: this_locator = registration.locator ...
python
def create(self, locator): """ Creates a component identified by given locator. :param locator: a locator to identify component to be created. :return: the created component. """ for registration in self._registrations: this_locator = registration.locator ...
[ "def", "create", "(", "self", ",", "locator", ")", ":", "for", "registration", "in", "self", ".", "_registrations", ":", "this_locator", "=", "registration", ".", "locator", "if", "this_locator", "==", "locator", ":", "try", ":", "return", "registration", "....
Creates a component identified by given locator. :param locator: a locator to identify component to be created. :return: the created component.
[ "Creates", "a", "component", "identified", "by", "given", "locator", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/build/Factory.py#L88-L109
radjkarl/fancyTools
fancytools/os/runAsAdmin.py
runAsAdmin
def runAsAdmin(cmdLine=None, target_dir='', wait=True): """ run [cmdLine] as admin specify the location from where the code is executed through [target_dir] """ if os.name != 'nt': raise RuntimeError("This function is only implemented on Windows.") # import win32api, import win32con ...
python
def runAsAdmin(cmdLine=None, target_dir='', wait=True): """ run [cmdLine] as admin specify the location from where the code is executed through [target_dir] """ if os.name != 'nt': raise RuntimeError("This function is only implemented on Windows.") # import win32api, import win32con ...
[ "def", "runAsAdmin", "(", "cmdLine", "=", "None", ",", "target_dir", "=", "''", ",", "wait", "=", "True", ")", ":", "if", "os", ".", "name", "!=", "'nt'", ":", "raise", "RuntimeError", "(", "\"This function is only implemented on Windows.\"", ")", "# import wi...
run [cmdLine] as admin specify the location from where the code is executed through [target_dir]
[ "run", "[", "cmdLine", "]", "as", "admin", "specify", "the", "location", "from", "where", "the", "code", "is", "executed", "through", "[", "target_dir", "]" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/runAsAdmin.py#L9-L61
akatrevorjay/mainline
mainline/di.py
Di.update
def update(self, catalog=None, dependencies=None, allow_overwrite=False): ''' Convenience method to update this Di instance with the specified contents. :param catalog: ICatalog supporting class or mapping :type catalog: ICatalog or collections.Mapping :param dependencies: Mappi...
python
def update(self, catalog=None, dependencies=None, allow_overwrite=False): ''' Convenience method to update this Di instance with the specified contents. :param catalog: ICatalog supporting class or mapping :type catalog: ICatalog or collections.Mapping :param dependencies: Mappi...
[ "def", "update", "(", "self", ",", "catalog", "=", "None", ",", "dependencies", "=", "None", ",", "allow_overwrite", "=", "False", ")", ":", "if", "catalog", ":", "self", ".", "_providers", ".", "update", "(", "catalog", ",", "allow_overwrite", "=", "all...
Convenience method to update this Di instance with the specified contents. :param catalog: ICatalog supporting class or mapping :type catalog: ICatalog or collections.Mapping :param dependencies: Mapping of dependencies :type dependencies: collections.Mapping :param allow_overwr...
[ "Convenience", "method", "to", "update", "this", "Di", "instance", "with", "the", "specified", "contents", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L47-L61
akatrevorjay/mainline
mainline/di.py
Di.get_missing_deps
def get_missing_deps(self, obj): ''' Returns missing dependencies for provider key. Missing meaning no instance can be provided at this time. :param key: Provider key :type key: object :return: Missing dependencies :rtype: list ''' deps = self.get...
python
def get_missing_deps(self, obj): ''' Returns missing dependencies for provider key. Missing meaning no instance can be provided at this time. :param key: Provider key :type key: object :return: Missing dependencies :rtype: list ''' deps = self.get...
[ "def", "get_missing_deps", "(", "self", ",", "obj", ")", ":", "deps", "=", "self", ".", "get_deps", "(", "obj", ")", "ret", "=", "[", "]", "for", "key", "in", "deps", ":", "provider", "=", "self", ".", "_providers", ".", "get", "(", "key", ")", "...
Returns missing dependencies for provider key. Missing meaning no instance can be provided at this time. :param key: Provider key :type key: object :return: Missing dependencies :rtype: list
[ "Returns", "missing", "dependencies", "for", "provider", "key", ".", "Missing", "meaning", "no", "instance", "can", "be", "provided", "at", "this", "time", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L74-L91
akatrevorjay/mainline
mainline/di.py
Di.iresolve
def iresolve(self, *keys): ''' Iterates over resolved instances for given provider keys. :param keys: Provider keys :type keys: tuple :return: Iterator of resolved instances :rtype: generator ''' for key in keys: missing = self.get_missing_dep...
python
def iresolve(self, *keys): ''' Iterates over resolved instances for given provider keys. :param keys: Provider keys :type keys: tuple :return: Iterator of resolved instances :rtype: generator ''' for key in keys: missing = self.get_missing_dep...
[ "def", "iresolve", "(", "self", ",", "*", "keys", ")", ":", "for", "key", "in", "keys", ":", "missing", "=", "self", ".", "get_missing_deps", "(", "key", ")", "if", "missing", ":", "raise", "UnresolvableError", "(", "\"Missing dependencies for %s: %s\"", "%"...
Iterates over resolved instances for given provider keys. :param keys: Provider keys :type keys: tuple :return: Iterator of resolved instances :rtype: generator
[ "Iterates", "over", "resolved", "instances", "for", "given", "provider", "keys", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L93-L111
akatrevorjay/mainline
mainline/di.py
Di.resolve
def resolve(self, *keys): ''' Returns resolved instances for given provider keys. If only one positional argument is given, only one is returned. :param keys: Provider keys :type keys: tuple :return: Resolved instance(s); if only one key given, otherwise list of them. ...
python
def resolve(self, *keys): ''' Returns resolved instances for given provider keys. If only one positional argument is given, only one is returned. :param keys: Provider keys :type keys: tuple :return: Resolved instance(s); if only one key given, otherwise list of them. ...
[ "def", "resolve", "(", "self", ",", "*", "keys", ")", ":", "instances", "=", "list", "(", "self", ".", "iresolve", "(", "*", "keys", ")", ")", "if", "len", "(", "keys", ")", "==", "1", ":", "return", "instances", "[", "0", "]", "return", "instanc...
Returns resolved instances for given provider keys. If only one positional argument is given, only one is returned. :param keys: Provider keys :type keys: tuple :return: Resolved instance(s); if only one key given, otherwise list of them. :rtype: object or list
[ "Returns", "resolved", "instances", "for", "given", "provider", "keys", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L113-L127
akatrevorjay/mainline
mainline/di.py
Di.resolve_deps
def resolve_deps(self, obj): ''' Returns list of resolved dependencies for given obj. :param obj: Object to lookup dependencies for :type obj: object :return: Resolved dependencies :rtype: list ''' deps = self.get_deps(obj) return list(self.iresol...
python
def resolve_deps(self, obj): ''' Returns list of resolved dependencies for given obj. :param obj: Object to lookup dependencies for :type obj: object :return: Resolved dependencies :rtype: list ''' deps = self.get_deps(obj) return list(self.iresol...
[ "def", "resolve_deps", "(", "self", ",", "obj", ")", ":", "deps", "=", "self", ".", "get_deps", "(", "obj", ")", "return", "list", "(", "self", ".", "iresolve", "(", "*", "deps", ")", ")" ]
Returns list of resolved dependencies for given obj. :param obj: Object to lookup dependencies for :type obj: object :return: Resolved dependencies :rtype: list
[ "Returns", "list", "of", "resolved", "dependencies", "for", "given", "obj", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L129-L139
akatrevorjay/mainline
mainline/di.py
Di.register_factory
def register_factory(self, key, factory=_sentinel, scope=NoneScope, allow_overwrite=False): ''' Creates and registers a provider using the given key, factory, and scope. Can also be used as a decorator. :param key: Provider key :type key: object :param factory: Factory ...
python
def register_factory(self, key, factory=_sentinel, scope=NoneScope, allow_overwrite=False): ''' Creates and registers a provider using the given key, factory, and scope. Can also be used as a decorator. :param key: Provider key :type key: object :param factory: Factory ...
[ "def", "register_factory", "(", "self", ",", "key", ",", "factory", "=", "_sentinel", ",", "scope", "=", "NoneScope", ",", "allow_overwrite", "=", "False", ")", ":", "if", "factory", "is", "_sentinel", ":", "return", "functools", ".", "partial", "(", "self...
Creates and registers a provider using the given key, factory, and scope. Can also be used as a decorator. :param key: Provider key :type key: object :param factory: Factory callable :type factory: callable :param scope: Scope key, factory, or instance :type sco...
[ "Creates", "and", "registers", "a", "provider", "using", "the", "given", "key", "factory", "and", "scope", ".", "Can", "also", "be", "used", "as", "a", "decorator", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L141-L161
akatrevorjay/mainline
mainline/di.py
Di.set_instance
def set_instance(self, key, instance, default_scope=GlobalScope): ''' Sets instance under specified provider key. If a provider for specified key does not exist, one is created without a factory using the given scope. :param key: Provider key :type key: object :param ins...
python
def set_instance(self, key, instance, default_scope=GlobalScope): ''' Sets instance under specified provider key. If a provider for specified key does not exist, one is created without a factory using the given scope. :param key: Provider key :type key: object :param ins...
[ "def", "set_instance", "(", "self", ",", "key", ",", "instance", ",", "default_scope", "=", "GlobalScope", ")", ":", "if", "key", "not", "in", "self", ".", "_providers", ":", "# We don't know how to create this kind of instance at this time, so add it without a factory.",...
Sets instance under specified provider key. If a provider for specified key does not exist, one is created without a factory using the given scope. :param key: Provider key :type key: object :param instance: Instance :type instance: object :param default_scope: Scope key...
[ "Sets", "instance", "under", "specified", "provider", "key", ".", "If", "a", "provider", "for", "specified", "key", "does", "not", "exist", "one", "is", "created", "without", "a", "factory", "using", "the", "given", "scope", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L165-L181
akatrevorjay/mainline
mainline/di.py
Di.depends_on
def depends_on(self, *keys): ''' Decorator that marks the wrapped as depending on specified provider keys. :param keys: Provider keys to mark as dependencies for wrapped :type keys: tuple :return: decorator :rtype: decorator ''' def decorator(wrapped): ...
python
def depends_on(self, *keys): ''' Decorator that marks the wrapped as depending on specified provider keys. :param keys: Provider keys to mark as dependencies for wrapped :type keys: tuple :return: decorator :rtype: decorator ''' def decorator(wrapped): ...
[ "def", "depends_on", "(", "self", ",", "*", "keys", ")", ":", "def", "decorator", "(", "wrapped", ")", ":", "if", "keys", ":", "if", "wrapped", "not", "in", "self", ".", "_dependencies", ":", "self", ".", "_dependencies", "[", "wrapped", "]", "=", "s...
Decorator that marks the wrapped as depending on specified provider keys. :param keys: Provider keys to mark as dependencies for wrapped :type keys: tuple :return: decorator :rtype: decorator
[ "Decorator", "that", "marks", "the", "wrapped", "as", "depending", "on", "specified", "provider", "keys", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L183-L200
akatrevorjay/mainline
mainline/di.py
Di.inject_classproperty
def inject_classproperty(self, key, name=None, replace_on_access=False): ''' Decorator that injects the specified key as a classproperty. If replace_on_access is True, then it replaces itself with the instance on first lookup. :param key: Provider key :type key: object ...
python
def inject_classproperty(self, key, name=None, replace_on_access=False): ''' Decorator that injects the specified key as a classproperty. If replace_on_access is True, then it replaces itself with the instance on first lookup. :param key: Provider key :type key: object ...
[ "def", "inject_classproperty", "(", "self", ",", "key", ",", "name", "=", "None", ",", "replace_on_access", "=", "False", ")", ":", "return", "ClassPropertyInjector", "(", "self", ",", "key", ",", "name", "=", "name", ",", "replace_on_access", "=", "replace_...
Decorator that injects the specified key as a classproperty. If replace_on_access is True, then it replaces itself with the instance on first lookup. :param key: Provider key :type key: object :param name: Name of classproperty, defaults to key :type name: str :param re...
[ "Decorator", "that", "injects", "the", "specified", "key", "as", "a", "classproperty", "." ]
train
https://github.com/akatrevorjay/mainline/blob/8aa7f6ef6cad4051fcd5f8d43d2ba8cdad681986/mainline/di.py#L202-L215
anentropic/factoryboy-gaendb
gaendb/factories.py
KeyProxy.get
def get(self, _create=False, **ctx_options): """ NOTE: `ctx_options` are ignored """ if _create: return self._kind_factory.create(key=self) else: return self._kind_factory(key=self)
python
def get(self, _create=False, **ctx_options): """ NOTE: `ctx_options` are ignored """ if _create: return self._kind_factory.create(key=self) else: return self._kind_factory(key=self)
[ "def", "get", "(", "self", ",", "_create", "=", "False", ",", "*", "*", "ctx_options", ")", ":", "if", "_create", ":", "return", "self", ".", "_kind_factory", ".", "create", "(", "key", "=", "self", ")", "else", ":", "return", "self", ".", "_kind_fac...
NOTE: `ctx_options` are ignored
[ "NOTE", ":", "ctx_options", "are", "ignored" ]
train
https://github.com/anentropic/factoryboy-gaendb/blob/d218311aabf214f66378e690e2154a432d4e6d9a/gaendb/factories.py#L27-L34
deifyed/vault
libconman/target.py
Target.getTarget
def getTarget(iid): ''' A static method which returns a Target object identified by iid. Returns None if a Target object was not found ''' db = getDataCommunicator() verbose('Loading target with id {}'.format(iid)) data = db.getTarget(iid) if dat...
python
def getTarget(iid): ''' A static method which returns a Target object identified by iid. Returns None if a Target object was not found ''' db = getDataCommunicator() verbose('Loading target with id {}'.format(iid)) data = db.getTarget(iid) if dat...
[ "def", "getTarget", "(", "iid", ")", ":", "db", "=", "getDataCommunicator", "(", ")", "verbose", "(", "'Loading target with id {}'", ".", "format", "(", "iid", ")", ")", "data", "=", "db", ".", "getTarget", "(", "iid", ")", "if", "data", ":", "verbose", ...
A static method which returns a Target object identified by iid. Returns None if a Target object was not found
[ "A", "static", "method", "which", "returns", "a", "Target", "object", "identified", "by", "iid", ".", "Returns", "None", "if", "a", "Target", "object", "was", "not", "found" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/target.py#L13-L28
deifyed/vault
libconman/target.py
Target.delete
def delete(self): ''' Deletes link from vault and removes database information ''' if not self._id: verbose('This target does not have an id') return False # Removes link from vault directory verbose('Removing link from vault directory') ...
python
def delete(self): ''' Deletes link from vault and removes database information ''' if not self._id: verbose('This target does not have an id') return False # Removes link from vault directory verbose('Removing link from vault directory') ...
[ "def", "delete", "(", "self", ")", ":", "if", "not", "self", ".", "_id", ":", "verbose", "(", "'This target does not have an id'", ")", "return", "False", "# Removes link from vault directory", "verbose", "(", "'Removing link from vault directory'", ")", "os", ".", ...
Deletes link from vault and removes database information
[ "Deletes", "link", "from", "vault", "and", "removes", "database", "information" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/target.py#L51-L68
deifyed/vault
libconman/target.py
Target.secure
def secure(self): ''' Creates a hard link to the target file in the vault directory and saves information about the target file in the database ''' verbose('Saving information about target into conman database') self._id = self.db.insertTarget(self.name, self.path...
python
def secure(self): ''' Creates a hard link to the target file in the vault directory and saves information about the target file in the database ''' verbose('Saving information about target into conman database') self._id = self.db.insertTarget(self.name, self.path...
[ "def", "secure", "(", "self", ")", ":", "verbose", "(", "'Saving information about target into conman database'", ")", "self", ".", "_id", "=", "self", ".", "db", ".", "insertTarget", "(", "self", ".", "name", ",", "self", ".", "path", ")", "verbose", "(", ...
Creates a hard link to the target file in the vault directory and saves information about the target file in the database
[ "Creates", "a", "hard", "link", "to", "the", "target", "file", "in", "the", "vault", "directory", "and", "saves", "information", "about", "the", "target", "file", "in", "the", "database" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/target.py#L70-L81
deifyed/vault
libconman/target.py
Target.deploy
def deploy(self): ''' Creates a link at the original path of this target ''' if not os.path.exists(self.path): makedirs(self.path) link(self.vault_path, self.real_path)
python
def deploy(self): ''' Creates a link at the original path of this target ''' if not os.path.exists(self.path): makedirs(self.path) link(self.vault_path, self.real_path)
[ "def", "deploy", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "makedirs", "(", "self", ".", "path", ")", "link", "(", "self", ".", "vault_path", ",", "self", ".", "real_path", ")" ]
Creates a link at the original path of this target
[ "Creates", "a", "link", "at", "the", "original", "path", "of", "this", "target" ]
train
https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/target.py#L83-L90
riccardocagnasso/useless
src/useless/common/__init__.py
parse_cstring
def parse_cstring(stream, offset): """ parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support ...
python
def parse_cstring(stream, offset): """ parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support ...
[ "def", "parse_cstring", "(", "stream", ",", "offset", ")", ":", "stream", ".", "seek", "(", "offset", ")", "string", "=", "\"\"", "while", "True", ":", "char", "=", "struct", ".", "unpack", "(", "'c'", ",", "stream", ".", "read", "(", "1", ")", ")"...
parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support
[ "parse_cstring", "will", "parse", "a", "null", "-", "terminated", "string", "in", "a", "bytestream", "." ]
train
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/common/__init__.py#L29-L48
lambdalisue/maidenhair
src/maidenhair/classification/unite.py
unite_dataset
def unite_dataset(dataset, basecolumn, fn=None): """ Unite dataset via fn Parameters ---------- dataset : list A list of data basecolumn : int A number of column which will be respected in uniting dataset fn : function A function which recieve :attr:`data` and return...
python
def unite_dataset(dataset, basecolumn, fn=None): """ Unite dataset via fn Parameters ---------- dataset : list A list of data basecolumn : int A number of column which will be respected in uniting dataset fn : function A function which recieve :attr:`data` and return...
[ "def", "unite_dataset", "(", "dataset", ",", "basecolumn", ",", "fn", "=", "None", ")", ":", "# create default unite_fn", "if", "fn", "is", "None", ":", "fn", "=", "default_unite_function", "# classify dataset via unite_fn", "united_dataset", "=", "OrderedDict", "("...
Unite dataset via fn Parameters ---------- dataset : list A list of data basecolumn : int A number of column which will be respected in uniting dataset fn : function A function which recieve :attr:`data` and return classification string. It if is None, a function whi...
[ "Unite", "dataset", "via", "fn" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/classification/unite.py#L32-L70
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient._get_data
def _get_data(self, file_url, file_name='', method_title='', argument_title=''): ''' a helper method to retrieve data buffer for a file url :param file_url: string with url to file :param file_name: [optional] string with name to affix to file buffer :param method_title: [optiona...
python
def _get_data(self, file_url, file_name='', method_title='', argument_title=''): ''' a helper method to retrieve data buffer for a file url :param file_url: string with url to file :param file_name: [optional] string with name to affix to file buffer :param method_title: [optiona...
[ "def", "_get_data", "(", "self", ",", "file_url", ",", "file_name", "=", "''", ",", "method_title", "=", "''", ",", "argument_title", "=", "''", ")", ":", "# https://docs.python.org/3/library/io.html#io.BytesIO\r", "import", "io", "import", "requests", "# fill empty...
a helper method to retrieve data buffer for a file url :param file_url: string with url to file :param file_name: [optional] string with name to affix to file buffer :param method_title: [optional] string with name of class method calling :param argument_title: [optional] string wi...
[ "a", "helper", "method", "to", "retrieve", "data", "buffer", "for", "a", "file", "url", ":", "param", "file_url", ":", "string", "with", "url", "to", "file", ":", "param", "file_name", ":", "[", "optional", "]", "string", "with", "name", "to", "affix", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L110-L149
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient._create_folder
def _create_folder(self): ''' a helper method for creating a temporary audio clip folder ''' # import dependencies import os from labpack.platforms.localhost import localhostClient from labpack.records.id import labID # create folder in user app data record_i...
python
def _create_folder(self): ''' a helper method for creating a temporary audio clip folder ''' # import dependencies import os from labpack.platforms.localhost import localhostClient from labpack.records.id import labID # create folder in user app data record_i...
[ "def", "_create_folder", "(", "self", ")", ":", "# import dependencies\r", "import", "os", "from", "labpack", ".", "platforms", ".", "localhost", "import", "localhostClient", "from", "labpack", ".", "records", ".", "id", "import", "labID", "# create folder in user a...
a helper method for creating a temporary audio clip folder
[ "a", "helper", "method", "for", "creating", "a", "temporary", "audio", "clip", "folder" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L151-L172
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient._transcribe_files
def _transcribe_files(self, file_list, file_mimetype): ''' a helper method for multi-processing file transcription ''' # import dependencies import queue from threading import Thread # define multithreading function def _recognize_file(file_path, file_mimetype, queue)...
python
def _transcribe_files(self, file_list, file_mimetype): ''' a helper method for multi-processing file transcription ''' # import dependencies import queue from threading import Thread # define multithreading function def _recognize_file(file_path, file_mimetype, queue)...
[ "def", "_transcribe_files", "(", "self", ",", "file_list", ",", "file_mimetype", ")", ":", "# import dependencies\r", "import", "queue", "from", "threading", "import", "Thread", "# define multithreading function\r", "def", "_recognize_file", "(", "file_path", ",", "file...
a helper method for multi-processing file transcription
[ "a", "helper", "method", "for", "multi", "-", "processing", "file", "transcription" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L174-L226
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient.convert_audio
def convert_audio(self, file_path, new_mimetype, overwrite=False): ''' a method to convert an audio file into a different codec :param file_path: string with path to file on localhost :param new_mimetype: string with mimetype for new file :param overwrit...
python
def convert_audio(self, file_path, new_mimetype, overwrite=False): ''' a method to convert an audio file into a different codec :param file_path: string with path to file on localhost :param new_mimetype: string with mimetype for new file :param overwrit...
[ "def", "convert_audio", "(", "self", ",", "file_path", ",", "new_mimetype", ",", "overwrite", "=", "False", ")", ":", "title", "=", "'%s.convert_audio'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs\r", "input_fields", "=", "{", "'file_path...
a method to convert an audio file into a different codec :param file_path: string with path to file on localhost :param new_mimetype: string with mimetype for new file :param overwrite: [optional] boolean to overwrite existing file :return: string with path to new file...
[ "a", "method", "to", "convert", "an", "audio", "file", "into", "a", "different", "codec", ":", "param", "file_path", ":", "string", "with", "path", "to", "file", "on", "localhost", ":", "param", "new_mimetype", ":", "string", "with", "mimetype", "for", "ne...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L228-L290
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient.transcribe_file
def transcribe_file(self, file_path, clip_length=10, compress=True): ''' a method to transcribe the text from an audio file EXAMPLE: https://github.com/dannguyen/watson-word-watcher :param file_path: string with path to audio file on localhost :para...
python
def transcribe_file(self, file_path, clip_length=10, compress=True): ''' a method to transcribe the text from an audio file EXAMPLE: https://github.com/dannguyen/watson-word-watcher :param file_path: string with path to audio file on localhost :para...
[ "def", "transcribe_file", "(", "self", ",", "file_path", ",", "clip_length", "=", "10", ",", "compress", "=", "True", ")", ":", "title", "=", "'%s.transcribe_file'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs\r", "input_fields", "=", "{...
a method to transcribe the text from an audio file EXAMPLE: https://github.com/dannguyen/watson-word-watcher :param file_path: string with path to audio file on localhost :param clip_length: [optional] integer with seconds to divide clips into :param compress: [op...
[ "a", "method", "to", "transcribe", "the", "text", "from", "an", "audio", "file", "EXAMPLE", ":", "https", ":", "//", "github", ".", "com", "/", "dannguyen", "/", "watson", "-", "word", "-", "watcher", ":", "param", "file_path", ":", "string", "with", "...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L292-L400
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient.transcribe_url
def transcribe_url(self, file_url, clip_length=None, compress=True): ''' a method to transcribe the text from an audio url :param file_path: string with url to audio file on web :param clip_length: [optional] integer with seconds to divide clips into :param compress:...
python
def transcribe_url(self, file_url, clip_length=None, compress=True): ''' a method to transcribe the text from an audio url :param file_path: string with url to audio file on web :param clip_length: [optional] integer with seconds to divide clips into :param compress:...
[ "def", "transcribe_url", "(", "self", ",", "file_url", ",", "clip_length", "=", "None", ",", "compress", "=", "True", ")", ":", "title", "=", "'%s.transcribe_url'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs\r", "input_fields", "=", "{"...
a method to transcribe the text from an audio url :param file_path: string with url to audio file on web :param clip_length: [optional] integer with seconds to divide clips into :param compress: [optional] boolean to convert file to audio/ogg :return: dictionary with transcribed te...
[ "a", "method", "to", "transcribe", "the", "text", "from", "an", "audio", "url", ":", "param", "file_path", ":", "string", "with", "url", "to", "audio", "file", "on", "web", ":", "param", "clip_length", ":", "[", "optional", "]", "integer", "with", "secon...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L402-L552
collectiveacuity/labPack
labpack/speech/watson.py
watsonSpeechClient.transcribe_bytes
def transcribe_bytes(self, byte_data, clip_length=None, audio_mimetype='', compress=True): ''' a method to transcribe text from audio byte data :param byte_data: byte data in buffer with audio data :param clip_length: [optional] integer with seconds to divide cli...
python
def transcribe_bytes(self, byte_data, clip_length=None, audio_mimetype='', compress=True): ''' a method to transcribe text from audio byte data :param byte_data: byte data in buffer with audio data :param clip_length: [optional] integer with seconds to divide cli...
[ "def", "transcribe_bytes", "(", "self", ",", "byte_data", ",", "clip_length", "=", "None", ",", "audio_mimetype", "=", "''", ",", "compress", "=", "True", ")", ":", "title", "=", "'%s.transcribe_bytes'", "%", "self", ".", "__class__", ".", "__name__", "bytes...
a method to transcribe text from audio byte data :param byte_data: byte data in buffer with audio data :param clip_length: [optional] integer with seconds to divide clips into :param compress: [optional] boolean to convert file to audio/ogg :param audio_mimetype: [opti...
[ "a", "method", "to", "transcribe", "text", "from", "audio", "byte", "data", ":", "param", "byte_data", ":", "byte", "data", "in", "buffer", "with", "audio", "data", ":", "param", "clip_length", ":", "[", "optional", "]", "integer", "with", "seconds", "to",...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L554-L694
mbodenhamer/syn
syn/sets/b/base.py
SetNode.lazy_enumerate
def lazy_enumerate(self, **kwargs): '''Enumerate without evaluating any sets. ''' kwargs['lazy'] = True for item in self.enumerate(**kwargs): yield item
python
def lazy_enumerate(self, **kwargs): '''Enumerate without evaluating any sets. ''' kwargs['lazy'] = True for item in self.enumerate(**kwargs): yield item
[ "def", "lazy_enumerate", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'lazy'", "]", "=", "True", "for", "item", "in", "self", ".", "enumerate", "(", "*", "*", "kwargs", ")", ":", "yield", "item" ]
Enumerate without evaluating any sets.
[ "Enumerate", "without", "evaluating", "any", "sets", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/sets/b/base.py#L95-L100
theirc/rapidsms-multitenancy
multitenancy/views.py
group_selection
def group_selection(request): """Allow user to select a TenantGroup if they have more than one.""" groups = get_user_groups(request.user) count = len(groups) if count == 1: # Redirect to the detail page for this group return redirect(groups[0]) context = { 'groups': groups, ...
python
def group_selection(request): """Allow user to select a TenantGroup if they have more than one.""" groups = get_user_groups(request.user) count = len(groups) if count == 1: # Redirect to the detail page for this group return redirect(groups[0]) context = { 'groups': groups, ...
[ "def", "group_selection", "(", "request", ")", ":", "groups", "=", "get_user_groups", "(", "request", ".", "user", ")", "count", "=", "len", "(", "groups", ")", "if", "count", "==", "1", ":", "# Redirect to the detail page for this group", "return", "redirect", ...
Allow user to select a TenantGroup if they have more than one.
[ "Allow", "user", "to", "select", "a", "TenantGroup", "if", "they", "have", "more", "than", "one", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/views.py#L8-L20
theirc/rapidsms-multitenancy
multitenancy/views.py
group_dashboard
def group_dashboard(request, group_slug): """Dashboard for managing a TenantGroup.""" groups = get_user_groups(request.user) group = get_object_or_404(groups, slug=group_slug) tenants = get_user_tenants(request.user, group) can_edit_group = request.user.has_perm('multitenancy.change_tenantgroup', gr...
python
def group_dashboard(request, group_slug): """Dashboard for managing a TenantGroup.""" groups = get_user_groups(request.user) group = get_object_or_404(groups, slug=group_slug) tenants = get_user_tenants(request.user, group) can_edit_group = request.user.has_perm('multitenancy.change_tenantgroup', gr...
[ "def", "group_dashboard", "(", "request", ",", "group_slug", ")", ":", "groups", "=", "get_user_groups", "(", "request", ".", "user", ")", "group", "=", "get_object_or_404", "(", "groups", ",", "slug", "=", "group_slug", ")", "tenants", "=", "get_user_tenants"...
Dashboard for managing a TenantGroup.
[ "Dashboard", "for", "managing", "a", "TenantGroup", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/views.py#L24-L40
theirc/rapidsms-multitenancy
multitenancy/views.py
tenant_dashboard
def tenant_dashboard(request, group_slug, tenant_slug): """Dashboard for managing a tenant.""" groups = get_user_groups(request.user) group = get_object_or_404(groups, slug=group_slug) tenants = get_user_tenants(request.user, group) tenant = get_object_or_404(tenants, slug=tenant_slug) can_edit_...
python
def tenant_dashboard(request, group_slug, tenant_slug): """Dashboard for managing a tenant.""" groups = get_user_groups(request.user) group = get_object_or_404(groups, slug=group_slug) tenants = get_user_tenants(request.user, group) tenant = get_object_or_404(tenants, slug=tenant_slug) can_edit_...
[ "def", "tenant_dashboard", "(", "request", ",", "group_slug", ",", "tenant_slug", ")", ":", "groups", "=", "get_user_groups", "(", "request", ".", "user", ")", "group", "=", "get_object_or_404", "(", "groups", ",", "slug", "=", "group_slug", ")", "tenants", ...
Dashboard for managing a tenant.
[ "Dashboard", "for", "managing", "a", "tenant", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/views.py#L44-L56
pip-services3-python/pip-services3-components-python
pip_services3_components/connect/MemoryDiscovery.py
MemoryDiscovery.read_connections
def read_connections(self, connections): """ Reads connections from configuration parameters. Each section represents an individual Connectionparams :param connections: configuration parameters to be read """ del self._items[:] for key in connections.get_key_name...
python
def read_connections(self, connections): """ Reads connections from configuration parameters. Each section represents an individual Connectionparams :param connections: configuration parameters to be read """ del self._items[:] for key in connections.get_key_name...
[ "def", "read_connections", "(", "self", ",", "connections", ")", ":", "del", "self", ".", "_items", "[", ":", "]", "for", "key", "in", "connections", ".", "get_key_names", "(", ")", ":", "item", "=", "DiscoveryItem", "(", ")", "item", ".", "key", "=", ...
Reads connections from configuration parameters. Each section represents an individual Connectionparams :param connections: configuration parameters to be read
[ "Reads", "connections", "from", "configuration", "parameters", ".", "Each", "section", "represents", "an", "individual", "Connectionparams" ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/connect/MemoryDiscovery.py#L67-L80
pip-services3-python/pip-services3-components-python
pip_services3_components/connect/MemoryDiscovery.py
MemoryDiscovery.register
def register(self, correlation_id, key, connection): """ Registers connection parameters into the discovery service. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection parameters. :param...
python
def register(self, correlation_id, key, connection): """ Registers connection parameters into the discovery service. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection parameters. :param...
[ "def", "register", "(", "self", ",", "correlation_id", ",", "key", ",", "connection", ")", ":", "item", "=", "DiscoveryItem", "(", ")", "item", ".", "key", "=", "key", "item", ".", "connection", "=", "connection", "self", ".", "_items", ".", "append", ...
Registers connection parameters into the discovery service. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection parameters. :param connection: a connection to be registered.
[ "Registers", "connection", "parameters", "into", "the", "discovery", "service", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/connect/MemoryDiscovery.py#L82-L95
pip-services3-python/pip-services3-components-python
pip_services3_components/connect/MemoryDiscovery.py
MemoryDiscovery.resolve_one
def resolve_one(self, correlation_id, key): """ Resolves a single connection parameters by its key. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection. :return: a resolved connection. ...
python
def resolve_one(self, correlation_id, key): """ Resolves a single connection parameters by its key. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection. :return: a resolved connection. ...
[ "def", "resolve_one", "(", "self", ",", "correlation_id", ",", "key", ")", ":", "connection", "=", "None", "for", "item", "in", "self", ".", "_items", ":", "if", "item", ".", "key", "==", "key", "and", "item", ".", "connection", "!=", "None", ":", "c...
Resolves a single connection parameters by its key. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection. :return: a resolved connection.
[ "Resolves", "a", "single", "connection", "parameters", "by", "its", "key", "." ]
train
https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/connect/MemoryDiscovery.py#L97-L112
nefarioustim/parker
parker/stringops.py
generate_chunks
def generate_chunks(string, num_chars): """Yield num_chars-character chunks from string.""" for start in range(0, len(string), num_chars): yield string[start:start+num_chars]
python
def generate_chunks(string, num_chars): """Yield num_chars-character chunks from string.""" for start in range(0, len(string), num_chars): yield string[start:start+num_chars]
[ "def", "generate_chunks", "(", "string", ",", "num_chars", ")", ":", "for", "start", "in", "range", "(", "0", ",", "len", "(", "string", ")", ",", "num_chars", ")", ":", "yield", "string", "[", "start", ":", "start", "+", "num_chars", "]" ]
Yield num_chars-character chunks from string.
[ "Yield", "num_chars", "-", "character", "chunks", "from", "string", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/stringops.py#L5-L8
aechiara/python-cep
buscacep.py
busca_cep_correios
def busca_cep_correios(cep): ''' Pesquisa o CEP informado no site dos correios ''' if cep is None or not isinstance(cep, str): raise AttributeError("O CEP deve ser do tipo string!") elif not cep.isdigit() or len(cep) != 8: raise AttributeError("O CEP deve conter apenas 8 dígitos!") url...
python
def busca_cep_correios(cep): ''' Pesquisa o CEP informado no site dos correios ''' if cep is None or not isinstance(cep, str): raise AttributeError("O CEP deve ser do tipo string!") elif not cep.isdigit() or len(cep) != 8: raise AttributeError("O CEP deve conter apenas 8 dígitos!") url...
[ "def", "busca_cep_correios", "(", "cep", ")", ":", "if", "cep", "is", "None", "or", "not", "isinstance", "(", "cep", ",", "str", ")", ":", "raise", "AttributeError", "(", "\"O CEP deve ser do tipo string!\"", ")", "elif", "not", "cep", ".", "isdigit", "(", ...
Pesquisa o CEP informado no site dos correios
[ "Pesquisa", "o", "CEP", "informado", "no", "site", "dos", "correios" ]
train
https://github.com/aechiara/python-cep/blob/99f6f03aca8107d17fb2822a0d19e46f9b8a0e23/buscacep.py#L20-L47
rosenbrockc/acorn
acorn/importer.py
_load_package_config
def _load_package_config(reload_=False): """Loads the package configurations from the global `acorn.cfg` file. """ global _packages from acorn.config import settings packset = settings("acorn", reload_) if packset.has_section("acorn.packages"): for package, value in packset.items("acorn....
python
def _load_package_config(reload_=False): """Loads the package configurations from the global `acorn.cfg` file. """ global _packages from acorn.config import settings packset = settings("acorn", reload_) if packset.has_section("acorn.packages"): for package, value in packset.items("acorn....
[ "def", "_load_package_config", "(", "reload_", "=", "False", ")", ":", "global", "_packages", "from", "acorn", ".", "config", "import", "settings", "packset", "=", "settings", "(", "\"acorn\"", ",", "reload_", ")", "if", "packset", ".", "has_section", "(", "...
Loads the package configurations from the global `acorn.cfg` file.
[ "Loads", "the", "package", "configurations", "from", "the", "global", "acorn", ".", "cfg", "file", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/importer.py#L14-L22
rosenbrockc/acorn
acorn/importer.py
load_decorate
def load_decorate(package): """Imports and decorates the package with the specified name. """ # We import the decoration logic from acorn and then overwrite the sys.module # for this package with the decorated, original pandas package. from acorn.logging.decoration import set_decorating, decorating ...
python
def load_decorate(package): """Imports and decorates the package with the specified name. """ # We import the decoration logic from acorn and then overwrite the sys.module # for this package with the decorated, original pandas package. from acorn.logging.decoration import set_decorating, decorating ...
[ "def", "load_decorate", "(", "package", ")", ":", "# We import the decoration logic from acorn and then overwrite the sys.module", "# for this package with the decorated, original pandas package.", "from", "acorn", ".", "logging", ".", "decoration", "import", "set_decorating", ",", ...
Imports and decorates the package with the specified name.
[ "Imports", "and", "decorates", "the", "package", "with", "the", "specified", "name", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/importer.py#L73-L100
radjkarl/fancyTools
fancytools/spatial/closestNonZeroIndex.py
closestNonZeroIndex
def closestNonZeroIndex(pt, arr, kSize=21): """ return the index closest to point [pt] in an array [arr] within a given kernel size [kSize] that is not zero """ assert kSize % 2 == 1, 'need odd kernel size' hk = int(kSize / 2) ipt = np.asarray(pt, dtype=int) # array slice of shape kSize...
python
def closestNonZeroIndex(pt, arr, kSize=21): """ return the index closest to point [pt] in an array [arr] within a given kernel size [kSize] that is not zero """ assert kSize % 2 == 1, 'need odd kernel size' hk = int(kSize / 2) ipt = np.asarray(pt, dtype=int) # array slice of shape kSize...
[ "def", "closestNonZeroIndex", "(", "pt", ",", "arr", ",", "kSize", "=", "21", ")", ":", "assert", "kSize", "%", "2", "==", "1", ",", "'need odd kernel size'", "hk", "=", "int", "(", "kSize", "/", "2", ")", "ipt", "=", "np", ".", "asarray", "(", "pt...
return the index closest to point [pt] in an array [arr] within a given kernel size [kSize] that is not zero
[ "return", "the", "index", "closest", "to", "point", "[", "pt", "]", "in", "an", "array", "[", "arr", "]", "within", "a", "given", "kernel", "size", "[", "kSize", "]", "that", "is", "not", "zero" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/spatial/closestNonZeroIndex.py#L8-L33
RonenNess/Fileter
fileter/iterators/remove_files.py
RemoveFiles.process_file
def process_file(self, path, dryrun): """ Remove files and return filename. """ # if dryrun just return file path if dryrun: return path # remove and return file if self.__force or raw_input("Remove file '%s'? [y/N]" % path).lower() == "y": ...
python
def process_file(self, path, dryrun): """ Remove files and return filename. """ # if dryrun just return file path if dryrun: return path # remove and return file if self.__force or raw_input("Remove file '%s'? [y/N]" % path).lower() == "y": ...
[ "def", "process_file", "(", "self", ",", "path", ",", "dryrun", ")", ":", "# if dryrun just return file path", "if", "dryrun", ":", "return", "path", "# remove and return file", "if", "self", ".", "__force", "or", "raw_input", "(", "\"Remove file '%s'? [y/N]\"", "%"...
Remove files and return filename.
[ "Remove", "files", "and", "return", "filename", "." ]
train
https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/iterators/remove_files.py#L27-L38
maxfischer2781/include
include/base/import_hook.py
BaseIncludeLoader.module2uri
def module2uri(self, module_name): """Convert an encoded module name to an unencoded source uri""" assert module_name.startswith(self.module_prefix), 'incompatible module name' path = module_name[len(self.module_prefix):] path = path.replace('&#DOT', '.') return path.replace('&#S...
python
def module2uri(self, module_name): """Convert an encoded module name to an unencoded source uri""" assert module_name.startswith(self.module_prefix), 'incompatible module name' path = module_name[len(self.module_prefix):] path = path.replace('&#DOT', '.') return path.replace('&#S...
[ "def", "module2uri", "(", "self", ",", "module_name", ")", ":", "assert", "module_name", ".", "startswith", "(", "self", ".", "module_prefix", ")", ",", "'incompatible module name'", "path", "=", "module_name", "[", "len", "(", "self", ".", "module_prefix", ")...
Convert an encoded module name to an unencoded source uri
[ "Convert", "an", "encoded", "module", "name", "to", "an", "unencoded", "source", "uri" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/base/import_hook.py#L47-L52
maxfischer2781/include
include/base/import_hook.py
BaseIncludeLoader.uri2module
def uri2module(self, uri): """Convert an unencoded source uri to an encoded module name""" module_name = uri.replace('.', '&#DOT') module_name = module_name.replace(os.sep, '&#SEP') return self.module_prefix + module_name
python
def uri2module(self, uri): """Convert an unencoded source uri to an encoded module name""" module_name = uri.replace('.', '&#DOT') module_name = module_name.replace(os.sep, '&#SEP') return self.module_prefix + module_name
[ "def", "uri2module", "(", "self", ",", "uri", ")", ":", "module_name", "=", "uri", ".", "replace", "(", "'.'", ",", "'&#DOT'", ")", "module_name", "=", "module_name", ".", "replace", "(", "os", ".", "sep", ",", "'&#SEP'", ")", "return", "self", ".", ...
Convert an unencoded source uri to an encoded module name
[ "Convert", "an", "unencoded", "source", "uri", "to", "an", "encoded", "module", "name" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/base/import_hook.py#L54-L58
maxfischer2781/include
include/base/import_hook.py
BaseIncludeLoader.find_module
def find_module(self, fullname, path=None): """ Find the appropriate loader for module ``name`` :param fullname: ``__name__`` of the module to import :type fullname: str :param path: ``__path__`` of the *parent* package already imported :type path: str or None ""...
python
def find_module(self, fullname, path=None): """ Find the appropriate loader for module ``name`` :param fullname: ``__name__`` of the module to import :type fullname: str :param path: ``__path__`` of the *parent* package already imported :type path: str or None ""...
[ "def", "find_module", "(", "self", ",", "fullname", ",", "path", "=", "None", ")", ":", "# path points to the top-level package path if any", "# and we can only import sub-modules/-packages", "if", "path", "is", "None", ":", "return", "if", "fullname", ".", "startswith"...
Find the appropriate loader for module ``name`` :param fullname: ``__name__`` of the module to import :type fullname: str :param path: ``__path__`` of the *parent* package already imported :type path: str or None
[ "Find", "the", "appropriate", "loader", "for", "module", "name" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/base/import_hook.py#L69-L85
sprockets/sprockets
sprockets/cli.py
CLI.run
def run(self): """Evaluate the command line arguments, performing the appropriate actions so the application can be started. """ # The list command prevents any other processing of args if self._args.list: self._print_installed_apps(self._args.controller) ...
python
def run(self): """Evaluate the command line arguments, performing the appropriate actions so the application can be started. """ # The list command prevents any other processing of args if self._args.list: self._print_installed_apps(self._args.controller) ...
[ "def", "run", "(", "self", ")", ":", "# The list command prevents any other processing of args", "if", "self", ".", "_args", ".", "list", ":", "self", ".", "_print_installed_apps", "(", "self", ".", "_args", ".", "controller", ")", "sys", ".", "exit", "(", "0"...
Evaluate the command line arguments, performing the appropriate actions so the application can be started.
[ "Evaluate", "the", "command", "line", "arguments", "performing", "the", "appropriate", "actions", "so", "the", "application", "can", "be", "started", "." ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L85-L119
sprockets/sprockets
sprockets/cli.py
CLI._add_cli_args
def _add_cli_args(self): """Add the cli arguments to the argument parser.""" # Optional cli arguments self._arg_parser.add_argument('-l', '--list', action='store_true', help='List installed sprockets apps') sel...
python
def _add_cli_args(self): """Add the cli arguments to the argument parser.""" # Optional cli arguments self._arg_parser.add_argument('-l', '--list', action='store_true', help='List installed sprockets apps') sel...
[ "def", "_add_cli_args", "(", "self", ")", ":", "# Optional cli arguments", "self", ".", "_arg_parser", ".", "add_argument", "(", "'-l'", ",", "'--list'", ",", "action", "=", "'store_true'", ",", "help", "=", "'List installed sprockets apps'", ")", "self", ".", "...
Add the cli arguments to the argument parser.
[ "Add", "the", "cli", "arguments", "to", "the", "argument", "parser", "." ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L121-L158
sprockets/sprockets
sprockets/cli.py
CLI._configure_logging
def _configure_logging(application, verbosity=0, syslog=False): """Configure logging for the application, setting the appropriate verbosity and adding syslog if it's enabled. :param str application: The application module/package name :param int verbosity: 1 == INFO, 2 == DEBUG ...
python
def _configure_logging(application, verbosity=0, syslog=False): """Configure logging for the application, setting the appropriate verbosity and adding syslog if it's enabled. :param str application: The application module/package name :param int verbosity: 1 == INFO, 2 == DEBUG ...
[ "def", "_configure_logging", "(", "application", ",", "verbosity", "=", "0", ",", "syslog", "=", "False", ")", ":", "# Create a new copy of the logging config that will be modified", "config", "=", "dict", "(", "LOGGING", ")", "# Increase the logging verbosity", "if", "...
Configure logging for the application, setting the appropriate verbosity and adding syslog if it's enabled. :param str application: The application module/package name :param int verbosity: 1 == INFO, 2 == DEBUG :param bool syslog: Enable the syslog handler
[ "Configure", "logging", "for", "the", "application", "setting", "the", "appropriate", "verbosity", "and", "adding", "syslog", "if", "it", "s", "enabled", "." ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L161-L187
sprockets/sprockets
sprockets/cli.py
CLI._get_application_module
def _get_application_module(self, controller, application): """Return the module for an application. If it's a entry-point registered application name, return the module name from the entry points data. If not, the passed in application name is returned. :param str controller: The contr...
python
def _get_application_module(self, controller, application): """Return the module for an application. If it's a entry-point registered application name, return the module name from the entry points data. If not, the passed in application name is returned. :param str controller: The contr...
[ "def", "_get_application_module", "(", "self", ",", "controller", ",", "application", ")", ":", "for", "pkg", "in", "self", ".", "_get_applications", "(", "controller", ")", ":", "if", "pkg", ".", "name", "==", "application", ":", "return", "pkg", ".", "mo...
Return the module for an application. If it's a entry-point registered application name, return the module name from the entry points data. If not, the passed in application name is returned. :param str controller: The controller type :param str application: The application name or modu...
[ "Return", "the", "module", "for", "an", "application", ".", "If", "it", "s", "a", "entry", "-", "point", "registered", "application", "name", "return", "the", "module", "name", "from", "the", "entry", "points", "data", ".", "If", "not", "the", "passed", ...
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L189-L202
sprockets/sprockets
sprockets/cli.py
CLI._get_controllers
def _get_controllers(self): """Iterate through the installed controller entry points and import the module and assign the handle to the CLI._controllers dict. :return: dict """ controllers = dict() for pkg in pkg_resources.iter_entry_points(group=self.CONTROLLERS): ...
python
def _get_controllers(self): """Iterate through the installed controller entry points and import the module and assign the handle to the CLI._controllers dict. :return: dict """ controllers = dict() for pkg in pkg_resources.iter_entry_points(group=self.CONTROLLERS): ...
[ "def", "_get_controllers", "(", "self", ")", ":", "controllers", "=", "dict", "(", ")", "for", "pkg", "in", "pkg_resources", ".", "iter_entry_points", "(", "group", "=", "self", ".", "CONTROLLERS", ")", ":", "LOGGER", ".", "debug", "(", "'Loading %s controll...
Iterate through the installed controller entry points and import the module and assign the handle to the CLI._controllers dict. :return: dict
[ "Iterate", "through", "the", "installed", "controller", "entry", "points", "and", "import", "the", "module", "and", "assign", "the", "handle", "to", "the", "CLI", ".", "_controllers", "dict", "." ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L225-L236
sprockets/sprockets
sprockets/cli.py
CLI._get_controller_help
def _get_controller_help(self, controller): """Return the value of the HELP attribute for a controller that should describe the functionality of the controller. :rtype: str|None """ if hasattr(self._controllers[controller], 'HELP'): return self._controllers[controll...
python
def _get_controller_help(self, controller): """Return the value of the HELP attribute for a controller that should describe the functionality of the controller. :rtype: str|None """ if hasattr(self._controllers[controller], 'HELP'): return self._controllers[controll...
[ "def", "_get_controller_help", "(", "self", ",", "controller", ")", ":", "if", "hasattr", "(", "self", ".", "_controllers", "[", "controller", "]", ",", "'HELP'", ")", ":", "return", "self", ".", "_controllers", "[", "controller", "]", ".", "HELP", "return...
Return the value of the HELP attribute for a controller that should describe the functionality of the controller. :rtype: str|None
[ "Return", "the", "value", "of", "the", "HELP", "attribute", "for", "a", "controller", "that", "should", "describe", "the", "functionality", "of", "the", "controller", "." ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L238-L247
sprockets/sprockets
sprockets/cli.py
CLI._print_installed_apps
def _print_installed_apps(self, controller): """Print out a list of installed sprockets applications :param str controller: The name of the controller to get apps for """ print('\nInstalled Sprockets %s Apps\n' % controller.upper()) print("{0:<25} {1:>25}".format('Name', 'Module...
python
def _print_installed_apps(self, controller): """Print out a list of installed sprockets applications :param str controller: The name of the controller to get apps for """ print('\nInstalled Sprockets %s Apps\n' % controller.upper()) print("{0:<25} {1:>25}".format('Name', 'Module...
[ "def", "_print_installed_apps", "(", "self", ",", "controller", ")", ":", "print", "(", "'\\nInstalled Sprockets %s Apps\\n'", "%", "controller", ".", "upper", "(", ")", ")", "print", "(", "\"{0:<25} {1:>25}\"", ".", "format", "(", "'Name'", ",", "'Module'", ")"...
Print out a list of installed sprockets applications :param str controller: The name of the controller to get apps for
[ "Print", "out", "a", "list", "of", "installed", "sprockets", "applications" ]
train
https://github.com/sprockets/sprockets/blob/089dbaf04da54afd95645fce31f4ff9c8bdd8fae/sprockets/cli.py#L249-L259
kankiri/pabiana
pabiana/abcs.py
Node.rslv
def rslv(self, interface: str, name: str=None) -> Tuple[str, int, Optional[str]]: """Return the IP address, port and optionally host IP for one of this Nodes interfaces.""" if name is None: name = self.name key = '{}-{}'.format(name, interface) host = None if 'host' in self.interfaces[key]: host = self....
python
def rslv(self, interface: str, name: str=None) -> Tuple[str, int, Optional[str]]: """Return the IP address, port and optionally host IP for one of this Nodes interfaces.""" if name is None: name = self.name key = '{}-{}'.format(name, interface) host = None if 'host' in self.interfaces[key]: host = self....
[ "def", "rslv", "(", "self", ",", "interface", ":", "str", ",", "name", ":", "str", "=", "None", ")", "->", "Tuple", "[", "str", ",", "int", ",", "Optional", "[", "str", "]", "]", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", ...
Return the IP address, port and optionally host IP for one of this Nodes interfaces.
[ "Return", "the", "IP", "address", "port", "and", "optionally", "host", "IP", "for", "one", "of", "this", "Nodes", "interfaces", "." ]
train
https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/pabiana/abcs.py#L23-L31
kankiri/pabiana
pabiana/abcs.py
Area.trigger
def trigger(self, target: str, trigger: str, parameters: Dict[str, Any]={}): """Calls the specified Trigger of another Area with the optionally given parameters. Args: target: The name of the target Area. trigger: The name of the Trigger. parameters: The parameters of the function call. """ pass
python
def trigger(self, target: str, trigger: str, parameters: Dict[str, Any]={}): """Calls the specified Trigger of another Area with the optionally given parameters. Args: target: The name of the target Area. trigger: The name of the Trigger. parameters: The parameters of the function call. """ pass
[ "def", "trigger", "(", "self", ",", "target", ":", "str", ",", "trigger", ":", "str", ",", "parameters", ":", "Dict", "[", "str", ",", "Any", "]", "=", "{", "}", ")", ":", "pass" ]
Calls the specified Trigger of another Area with the optionally given parameters. Args: target: The name of the target Area. trigger: The name of the Trigger. parameters: The parameters of the function call.
[ "Calls", "the", "specified", "Trigger", "of", "another", "Area", "with", "the", "optionally", "given", "parameters", "." ]
train
https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/pabiana/abcs.py#L69-L77
iskandr/tinytimer
microbench/__init__.py
benchmark
def benchmark(f, n_repeats=3, warmup=True, name=""): """ Run the given function f repeatedly, return the average elapsed time. """ if warmup: f() total_time = 0 for i in range(n_repeats): iter_name = "%s (iter #%d)" % (name, i + 1,) with Timer(iter_name) as t: ...
python
def benchmark(f, n_repeats=3, warmup=True, name=""): """ Run the given function f repeatedly, return the average elapsed time. """ if warmup: f() total_time = 0 for i in range(n_repeats): iter_name = "%s (iter #%d)" % (name, i + 1,) with Timer(iter_name) as t: ...
[ "def", "benchmark", "(", "f", ",", "n_repeats", "=", "3", ",", "warmup", "=", "True", ",", "name", "=", "\"\"", ")", ":", "if", "warmup", ":", "f", "(", ")", "total_time", "=", "0", "for", "i", "in", "range", "(", "n_repeats", ")", ":", "iter_nam...
Run the given function f repeatedly, return the average elapsed time.
[ "Run", "the", "given", "function", "f", "repeatedly", "return", "the", "average", "elapsed", "time", "." ]
train
https://github.com/iskandr/tinytimer/blob/ddedd6099e51bdccb2c506f34d31ff08aef15685/microbench/__init__.py#L41-L54
MakerReduxCorp/PLOD
PLOD/internal.py
convert_to_dict
def convert_to_dict(item): '''Examine an item of any type and return a true dictionary. If the item is already a dictionary, then the item is returned as-is. Easy. Otherwise, it attempts to interpret it. So far, this routine can handle: * a class, function, or anything with a .__dict__ entry ...
python
def convert_to_dict(item): '''Examine an item of any type and return a true dictionary. If the item is already a dictionary, then the item is returned as-is. Easy. Otherwise, it attempts to interpret it. So far, this routine can handle: * a class, function, or anything with a .__dict__ entry ...
[ "def", "convert_to_dict", "(", "item", ")", ":", "# get type", "actual_type", "=", "detect_type", "(", "item", ")", "# given the type, do conversion", "if", "actual_type", "==", "\"dict\"", ":", "return", "item", "elif", "actual_type", "==", "\"list\"", ":", "temp...
Examine an item of any type and return a true dictionary. If the item is already a dictionary, then the item is returned as-is. Easy. Otherwise, it attempts to interpret it. So far, this routine can handle: * a class, function, or anything with a .__dict__ entry * a legacy mongoEngine document (a...
[ "Examine", "an", "item", "of", "any", "type", "and", "return", "a", "true", "dictionary", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L22-L70
MakerReduxCorp/PLOD
PLOD/internal.py
dict_crawl
def dict_crawl(entry, key): ''' returns a triple tuple representing the location of the key/key-list. returns: (parent_dictionary, final_key, value_found) If unable to locate the key, then (None, None, None) is returned. ''' value = None key_list = make_list(key) try: result = None ...
python
def dict_crawl(entry, key): ''' returns a triple tuple representing the location of the key/key-list. returns: (parent_dictionary, final_key, value_found) If unable to locate the key, then (None, None, None) is returned. ''' value = None key_list = make_list(key) try: result = None ...
[ "def", "dict_crawl", "(", "entry", ",", "key", ")", ":", "value", "=", "None", "key_list", "=", "make_list", "(", "key", ")", "try", ":", "result", "=", "None", "success_flag", "=", "True", "temp", "=", "entry", "for", "next_key", "in", "key_list", ":"...
returns a triple tuple representing the location of the key/key-list. returns: (parent_dictionary, final_key, value_found) If unable to locate the key, then (None, None, None) is returned.
[ "returns", "a", "triple", "tuple", "representing", "the", "location", "of", "the", "key", "/", "key", "-", "list", ".", "returns", ":", "(", "parent_dictionary", "final_key", "value_found", ")", "If", "unable", "to", "locate", "the", "key", "then", "(", "N...
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L135-L181
MakerReduxCorp/PLOD
PLOD/internal.py
modify_member
def modify_member(row, key, value): ''' properly modifies a dict or class attribute ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: target[tkey] = value return row
python
def modify_member(row, key, value): ''' properly modifies a dict or class attribute ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: target[tkey] = value return row
[ "def", "modify_member", "(", "row", ",", "key", ",", "value", ")", ":", "(", "target", ",", "tkey", ",", "tvalue", ")", "=", "dict_crawl", "(", "row", ",", "key", ")", "if", "target", ":", "target", "[", "tkey", "]", "=", "value", "return", "row" ]
properly modifies a dict or class attribute
[ "properly", "modifies", "a", "dict", "or", "class", "attribute" ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L183-L188
MakerReduxCorp/PLOD
PLOD/internal.py
remove_member
def remove_member(row, key): ''' properly modifies a dict or class attribute ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: del target[tkey] return row
python
def remove_member(row, key): ''' properly modifies a dict or class attribute ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: del target[tkey] return row
[ "def", "remove_member", "(", "row", ",", "key", ")", ":", "(", "target", ",", "tkey", ",", "tvalue", ")", "=", "dict_crawl", "(", "row", ",", "key", ")", "if", "target", ":", "del", "target", "[", "tkey", "]", "return", "row" ]
properly modifies a dict or class attribute
[ "properly", "modifies", "a", "dict", "or", "class", "attribute" ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L190-L195
MakerReduxCorp/PLOD
PLOD/internal.py
detect_member
def detect_member(row, key): ''' properly detects if a an attribute exists ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: return True return False
python
def detect_member(row, key): ''' properly detects if a an attribute exists ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: return True return False
[ "def", "detect_member", "(", "row", ",", "key", ")", ":", "(", "target", ",", "tkey", ",", "tvalue", ")", "=", "dict_crawl", "(", "row", ",", "key", ")", "if", "target", ":", "return", "True", "return", "False" ]
properly detects if a an attribute exists
[ "properly", "detects", "if", "a", "an", "attribute", "exists" ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L197-L202
MakerReduxCorp/PLOD
PLOD/internal.py
get_member
def get_member(row, key): ''' properly detects if a an attribute exists ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: return tvalue return None
python
def get_member(row, key): ''' properly detects if a an attribute exists ''' (target, tkey, tvalue) = dict_crawl(row, key) if target: return tvalue return None
[ "def", "get_member", "(", "row", ",", "key", ")", ":", "(", "target", ",", "tkey", ",", "tvalue", ")", "=", "dict_crawl", "(", "row", ",", "key", ")", "if", "target", ":", "return", "tvalue", "return", "None" ]
properly detects if a an attribute exists
[ "properly", "detects", "if", "a", "an", "attribute", "exists" ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L204-L209
MakerReduxCorp/PLOD
PLOD/internal.py
do_op
def do_op(field, op, value): ''' used for comparisons ''' if op==NOOP: return True if field==None: if value==None: return True else: return False if value==None: return False if op==LESS: return (field < value) if op==LESSorEQUAL: ...
python
def do_op(field, op, value): ''' used for comparisons ''' if op==NOOP: return True if field==None: if value==None: return True else: return False if value==None: return False if op==LESS: return (field < value) if op==LESSorEQUAL: ...
[ "def", "do_op", "(", "field", ",", "op", ",", "value", ")", ":", "if", "op", "==", "NOOP", ":", "return", "True", "if", "field", "==", "None", ":", "if", "value", "==", "None", ":", "return", "True", "else", ":", "return", "False", "if", "value", ...
used for comparisons
[ "used", "for", "comparisons" ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L212-L261
MakerReduxCorp/PLOD
PLOD/internal.py
get_index
def get_index(table, field_name, op, value): ''' Returns the index of the first list entry that matches. If no matches are found, it returns None NOTE: it is not returning a list. It is returning an integer in range 0..LEN(target) NOTE: both 'None' and 0 evaluate as False in python. So, if you are ...
python
def get_index(table, field_name, op, value): ''' Returns the index of the first list entry that matches. If no matches are found, it returns None NOTE: it is not returning a list. It is returning an integer in range 0..LEN(target) NOTE: both 'None' and 0 evaluate as False in python. So, if you are ...
[ "def", "get_index", "(", "table", ",", "field_name", ",", "op", ",", "value", ")", ":", "counter", "=", "0", "for", "row", "in", "table", ":", "dict_row", "=", "convert_to_dict", "(", "row", ")", "if", "do_op", "(", "dict_row", ".", "get", "(", "fiel...
Returns the index of the first list entry that matches. If no matches are found, it returns None NOTE: it is not returning a list. It is returning an integer in range 0..LEN(target) NOTE: both 'None' and 0 evaluate as False in python. So, if you are checking for a None being returned, be explicit. "i...
[ "Returns", "the", "index", "of", "the", "first", "list", "entry", "that", "matches", ".", "If", "no", "matches", "are", "found", "it", "returns", "None", "NOTE", ":", "it", "is", "not", "returning", "a", "list", ".", "It", "is", "returning", "an", "int...
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L263-L277
MakerReduxCorp/PLOD
PLOD/internal.py
get_value
def get_value(row, field_name): ''' Returns the value found in the field_name attribute of the row dictionary. ''' result = None dict_row = convert_to_dict(row) if detect_list(field_name): temp = row for field in field_name: dict_temp = convert_to_dict(temp) ...
python
def get_value(row, field_name): ''' Returns the value found in the field_name attribute of the row dictionary. ''' result = None dict_row = convert_to_dict(row) if detect_list(field_name): temp = row for field in field_name: dict_temp = convert_to_dict(temp) ...
[ "def", "get_value", "(", "row", ",", "field_name", ")", ":", "result", "=", "None", "dict_row", "=", "convert_to_dict", "(", "row", ")", "if", "detect_list", "(", "field_name", ")", ":", "temp", "=", "row", "for", "field", "in", "field_name", ":", "dict_...
Returns the value found in the field_name attribute of the row dictionary.
[ "Returns", "the", "value", "found", "in", "the", "field_name", "attribute", "of", "the", "row", "dictionary", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L280-L294
MakerReduxCorp/PLOD
PLOD/internal.py
select
def select(table, index_track, field_name, op, value, includeMissing): '''Modifies the table and index_track lists based on the comparison. ''' result = [] result_index = [] counter = 0 for row in table: if detect_fields(field_name, convert_to_dict(row)): final_value = get_va...
python
def select(table, index_track, field_name, op, value, includeMissing): '''Modifies the table and index_track lists based on the comparison. ''' result = [] result_index = [] counter = 0 for row in table: if detect_fields(field_name, convert_to_dict(row)): final_value = get_va...
[ "def", "select", "(", "table", ",", "index_track", ",", "field_name", ",", "op", ",", "value", ",", "includeMissing", ")", ":", "result", "=", "[", "]", "result_index", "=", "[", "]", "counter", "=", "0", "for", "row", "in", "table", ":", "if", "dete...
Modifies the table and index_track lists based on the comparison.
[ "Modifies", "the", "table", "and", "index_track", "lists", "based", "on", "the", "comparison", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/internal.py#L312-L331
pudo-attic/loadkit
loadkit/logger.py
capture
def capture(package, prefix, modules=[], level=logging.DEBUG): """ Capture log messages for the given modules and archive them to a ``LogFile`` resource. """ handler = LogFileHandler(package, prefix) formatter = logging.Formatter(FORMAT) handler.setFormatter(formatter) modules = set(modules + ['...
python
def capture(package, prefix, modules=[], level=logging.DEBUG): """ Capture log messages for the given modules and archive them to a ``LogFile`` resource. """ handler = LogFileHandler(package, prefix) formatter = logging.Formatter(FORMAT) handler.setFormatter(formatter) modules = set(modules + ['...
[ "def", "capture", "(", "package", ",", "prefix", ",", "modules", "=", "[", "]", ",", "level", "=", "logging", ".", "DEBUG", ")", ":", "handler", "=", "LogFileHandler", "(", "package", ",", "prefix", ")", "formatter", "=", "logging", ".", "Formatter", "...
Capture log messages for the given modules and archive them to a ``LogFile`` resource.
[ "Capture", "log", "messages", "for", "the", "given", "modules", "and", "archive", "them", "to", "a", "LogFile", "resource", "." ]
train
https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/logger.py#L32-L46
pudo-attic/loadkit
loadkit/logger.py
load
def load(package, prefix, offset=0, limit=1000): """ Load lines from the log file with pagination support. """ logs = package.all(LogFile, unicode(prefix)) logs = sorted(logs, key=lambda l: l.name, reverse=True) seen = 0 record = None tmp = tempfile.NamedTemporaryFile(suffix='.log') for log ...
python
def load(package, prefix, offset=0, limit=1000): """ Load lines from the log file with pagination support. """ logs = package.all(LogFile, unicode(prefix)) logs = sorted(logs, key=lambda l: l.name, reverse=True) seen = 0 record = None tmp = tempfile.NamedTemporaryFile(suffix='.log') for log ...
[ "def", "load", "(", "package", ",", "prefix", ",", "offset", "=", "0", ",", "limit", "=", "1000", ")", ":", "logs", "=", "package", ".", "all", "(", "LogFile", ",", "unicode", "(", "prefix", ")", ")", "logs", "=", "sorted", "(", "logs", ",", "key...
Load lines from the log file with pagination support.
[ "Load", "lines", "from", "the", "log", "file", "with", "pagination", "support", "." ]
train
https://github.com/pudo-attic/loadkit/blob/1fb17e69e2ffaf3dac4f40b574c3b7afb2198b7c/loadkit/logger.py#L49-L77
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient._validate_type
def _validate_type(self, file_name, extension_map, method_title, argument_title): ''' a helper method to validate extension type of file :param file_name: string with file name to test :param extension_map: dictionary with extensions names and regex patterns :param method_title: ...
python
def _validate_type(self, file_name, extension_map, method_title, argument_title): ''' a helper method to validate extension type of file :param file_name: string with file name to test :param extension_map: dictionary with extensions names and regex patterns :param method_title: ...
[ "def", "_validate_type", "(", "self", ",", "file_name", ",", "extension_map", ",", "method_title", ",", "argument_title", ")", ":", "# validate file extension\r", "from", "labpack", ".", "parsing", ".", "regex", "import", "labRegex", "file_extension", "=", "''", "...
a helper method to validate extension type of file :param file_name: string with file name to test :param extension_map: dictionary with extensions names and regex patterns :param method_title: string with title of feeder method :param argument_title: string with title of argument ...
[ "a", "helper", "method", "to", "validate", "extension", "type", "of", "file", ":", "param", "file_name", ":", "string", "with", "file", "name", "to", "test", ":", "param", "extension_map", ":", "dictionary", "with", "extensions", "names", "and", "regex", "pa...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L229-L254
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient._compile_buttons
def _compile_buttons(self, button_list, small_buttons, persist_buttons): ''' a helper method to compile buttons to telegram api format :param button_list: list of strings with button values :param small_buttons: boolean to resize buttons to fit text size :param persist_buttons: b...
python
def _compile_buttons(self, button_list, small_buttons, persist_buttons): ''' a helper method to compile buttons to telegram api format :param button_list: list of strings with button values :param small_buttons: boolean to resize buttons to fit text size :param persist_buttons: b...
[ "def", "_compile_buttons", "(", "self", ",", "button_list", ",", "small_buttons", ",", "persist_buttons", ")", ":", "import", "json", "keyboard_list", "=", "[", "]", "for", "item", "in", "button_list", ":", "keyboard_list", ".", "append", "(", "[", "{", "'te...
a helper method to compile buttons to telegram api format :param button_list: list of strings with button values :param small_buttons: boolean to resize buttons to fit text size :param persist_buttons: boolean to keep buttons around after exiting :return: string in json serial form...
[ "a", "helper", "method", "to", "compile", "buttons", "to", "telegram", "api", "format", ":", "param", "button_list", ":", "list", "of", "strings", "with", "button", "values", ":", "param", "small_buttons", ":", "boolean", "to", "resize", "buttons", "to", "fi...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L256-L276
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient._compile_keypad
def _compile_keypad(self, keypad_type, persist_buttons): ''' a helper method to compile keypad buttons to telegram api format :param keypad_type: string with type of keypad to emulate :param persist_buttons: boolean to keep buttons around after exiting :return: string in ...
python
def _compile_keypad(self, keypad_type, persist_buttons): ''' a helper method to compile keypad buttons to telegram api format :param keypad_type: string with type of keypad to emulate :param persist_buttons: boolean to keep buttons around after exiting :return: string in ...
[ "def", "_compile_keypad", "(", "self", ",", "keypad_type", ",", "persist_buttons", ")", ":", "import", "json", "keyboard_list", "=", "[", "]", "if", "keypad_type", "==", "'phone'", ":", "row_list", "=", "[", "{", "'text'", ":", "'1'", "}", ",", "{", "'te...
a helper method to compile keypad buttons to telegram api format :param keypad_type: string with type of keypad to emulate :param persist_buttons: boolean to keep buttons around after exiting :return: string in json serial format
[ "a", "helper", "method", "to", "compile", "keypad", "buttons", "to", "telegram", "api", "format", ":", "param", "keypad_type", ":", "string", "with", "type", "of", "keypad", "to", "emulate", ":", "param", "persist_buttons", ":", "boolean", "to", "keep", "but...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L278-L313
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient._post_request
def _post_request(self, url, data=None, files=None): ''' a helper method for sending post requests to telegram api https://core.telegram.org/bots/api#making-requests https://requests.readthedocs.io/en/master/user/quickstart/ :param url: string with url for post request ...
python
def _post_request(self, url, data=None, files=None): ''' a helper method for sending post requests to telegram api https://core.telegram.org/bots/api#making-requests https://requests.readthedocs.io/en/master/user/quickstart/ :param url: string with url for post request ...
[ "def", "_post_request", "(", "self", ",", "url", ",", "data", "=", "None", ",", "files", "=", "None", ")", ":", "import", "requests", "# construct request fields\r", "request_kwargs", "=", "{", "'url'", ":", "url", "}", "if", "data", ":", "request_kwargs", ...
a helper method for sending post requests to telegram api https://core.telegram.org/bots/api#making-requests https://requests.readthedocs.io/en/master/user/quickstart/ :param url: string with url for post request :param data: [optional] dictionary with data to add to request ...
[ "a", "helper", "method", "for", "sending", "post", "requests", "to", "telegram", "api", "https", ":", "//", "core", ".", "telegram", ".", "org", "/", "bots", "/", "api#making", "-", "requests", "https", ":", "//", "requests", ".", "readthedocs", ".", "io...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L315-L353
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.get_me
def get_me(self): ''' a method to retrieve details about the bot from telegram api :return: dictionary of response details with bot details in 'json' key { 'headers': { ... }, 'url': 'https://api.telegram.org/bot.../getUpdates', 'code': 200, ...
python
def get_me(self): ''' a method to retrieve details about the bot from telegram api :return: dictionary of response details with bot details in 'json' key { 'headers': { ... }, 'url': 'https://api.telegram.org/bot.../getUpdates', 'code': 200, ...
[ "def", "get_me", "(", "self", ")", ":", "# construct request fields\r", "url", "=", "'%s/getMe?test=me'", "%", "self", ".", "api_endpoint", "# send request\r", "response_details", "=", "self", ".", "_post_request", "(", "url", ")", "return", "response_details" ]
a method to retrieve details about the bot from telegram api :return: dictionary of response details with bot details in 'json' key { 'headers': { ... }, 'url': 'https://api.telegram.org/bot.../getUpdates', 'code': 200, 'error': '', ...
[ "a", "method", "to", "retrieve", "details", "about", "the", "bot", "from", "telegram", "api", ":", "return", ":", "dictionary", "of", "response", "details", "with", "bot", "details", "in", "json", "key", "{", "headers", ":", "{", "...", "}", "url", ":", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L355-L383
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.get_updates
def get_updates(self, last_update=0): ''' a method to retrieve messages for bot from telegram api :param last_update: integer with update id of last message received :return: dictionary of response details with update list in [json][result] { 'headers': { ... }, ...
python
def get_updates(self, last_update=0): ''' a method to retrieve messages for bot from telegram api :param last_update: integer with update id of last message received :return: dictionary of response details with update list in [json][result] { 'headers': { ... }, ...
[ "def", "get_updates", "(", "self", ",", "last_update", "=", "0", ")", ":", "title", "=", "'%s.get_updates'", "%", "self", ".", "__class__", ".", "__name__", "# construct request fields\r", "request_kwargs", "=", "{", "'url'", ":", "'%s/getUpdates'", "%", "self",...
a method to retrieve messages for bot from telegram api :param last_update: integer with update id of last message received :return: dictionary of response details with update list in [json][result] { 'headers': { ... }, 'url': 'https://api.telegram.org/bot.../ge...
[ "a", "method", "to", "retrieve", "messages", "for", "bot", "from", "telegram", "api", ":", "param", "last_update", ":", "integer", "with", "update", "id", "of", "last", "message", "received", ":", "return", ":", "dictionary", "of", "response", "details", "wi...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L449-L636
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.get_route
def get_route(self, file_id): ''' a method to retrieve route information for file on telegram api :param file_id: string with id of file in a message send to bot :return: dictionary of response details with route details in [json][result] ''' title = '%s.get_route' % s...
python
def get_route(self, file_id): ''' a method to retrieve route information for file on telegram api :param file_id: string with id of file in a message send to bot :return: dictionary of response details with route details in [json][result] ''' title = '%s.get_route' % s...
[ "def", "get_route", "(", "self", ",", "file_id", ")", ":", "title", "=", "'%s.get_route'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs\r", "input_fields", "=", "{", "'file_id'", ":", "file_id", ",", "}", "for", "key", ",", "value", "...
a method to retrieve route information for file on telegram api :param file_id: string with id of file in a message send to bot :return: dictionary of response details with route details in [json][result]
[ "a", "method", "to", "retrieve", "route", "information", "for", "file", "on", "telegram", "api", ":", "param", "file_id", ":", "string", "with", "id", "of", "file", "in", "a", "message", "send", "to", "bot", ":", "return", ":", "dictionary", "of", "respo...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L638-L668
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.get_file
def get_file(self, file_route, file_name=''): ''' a method to retrieve data for a file housed on telegram api :param file_route: string with route to file endpoint on telegram api :return: byte data stream with file data ''' title = '%s.get_file' % self.__class__.__nam...
python
def get_file(self, file_route, file_name=''): ''' a method to retrieve data for a file housed on telegram api :param file_route: string with route to file endpoint on telegram api :return: byte data stream with file data ''' title = '%s.get_file' % self.__class__.__nam...
[ "def", "get_file", "(", "self", ",", "file_route", ",", "file_name", "=", "''", ")", ":", "title", "=", "'%s.get_file'", "%", "self", ".", "__class__", ".", "__name__", "# construct file url\r", "file_url", "=", "'%s%s'", "%", "(", "self", ".", "file_endpoin...
a method to retrieve data for a file housed on telegram api :param file_route: string with route to file endpoint on telegram api :return: byte data stream with file data
[ "a", "method", "to", "retrieve", "data", "for", "a", "file", "housed", "on", "telegram", "api", ":", "param", "file_route", ":", "string", "with", "route", "to", "file", "endpoint", "on", "telegram", "api", ":", "return", ":", "byte", "data", "stream", "...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L670-L686
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.send_message
def send_message(self, user_id, message_text, message_style='', button_list=None, small_buttons=True, persist_buttons=False, link_preview=True): ''' a method to send a message using telegram api :param user_id: integer with id of telegram user :param message_text: string with message to u...
python
def send_message(self, user_id, message_text, message_style='', button_list=None, small_buttons=True, persist_buttons=False, link_preview=True): ''' a method to send a message using telegram api :param user_id: integer with id of telegram user :param message_text: string with message to u...
[ "def", "send_message", "(", "self", ",", "user_id", ",", "message_text", ",", "message_style", "=", "''", ",", "button_list", "=", "None", ",", "small_buttons", "=", "True", ",", "persist_buttons", "=", "False", ",", "link_preview", "=", "True", ")", ":", ...
a method to send a message using telegram api :param user_id: integer with id of telegram user :param message_text: string with message to user :param message_style: [optional] string with style to apply to text, only 'markdown' :param button_list: [optional] list of string to incl...
[ "a", "method", "to", "send", "a", "message", "using", "telegram", "api", ":", "param", "user_id", ":", "integer", "with", "id", "of", "telegram", "user", ":", "param", "message_text", ":", "string", "with", "message", "to", "user", ":", "param", "message_s...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L688-L765
collectiveacuity/labPack
labpack/messaging/telegram.py
telegramBotClient.send_photo
def send_photo(self, user_id, photo_id='', photo_path='', photo_url='', caption_text='', button_list=None, small_buttons=True, persist_buttons=False): ''' a method to send a photo using telegram api :param user_id: integer with id of telegram user :param photo_id: [optional] string with i...
python
def send_photo(self, user_id, photo_id='', photo_path='', photo_url='', caption_text='', button_list=None, small_buttons=True, persist_buttons=False): ''' a method to send a photo using telegram api :param user_id: integer with id of telegram user :param photo_id: [optional] string with i...
[ "def", "send_photo", "(", "self", ",", "user_id", ",", "photo_id", "=", "''", ",", "photo_path", "=", "''", ",", "photo_url", "=", "''", ",", "caption_text", "=", "''", ",", "button_list", "=", "None", ",", "small_buttons", "=", "True", ",", "persist_but...
a method to send a photo using telegram api :param user_id: integer with id of telegram user :param photo_id: [optional] string with id of file stored with telegram api :param photo_path: [optional] string with local path to file :param photo_url: [optional] string with url of file...
[ "a", "method", "to", "send", "a", "photo", "using", "telegram", "api", ":", "param", "user_id", ":", "integer", "with", "id", "of", "telegram", "user", ":", "param", "photo_id", ":", "[", "optional", "]", "string", "with", "id", "of", "file", "stored", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/messaging/telegram.py#L767-L881
limpyd/redis-limpyd-jobs
example.py
clean
def clean(): """ Clean data created by this script """ for queue in MyQueue.collection().instances(): queue.delete() for job in MyJob.collection().instances(): job.delete() for person in Person.collection().instances(): person.delete()
python
def clean(): """ Clean data created by this script """ for queue in MyQueue.collection().instances(): queue.delete() for job in MyJob.collection().instances(): job.delete() for person in Person.collection().instances(): person.delete()
[ "def", "clean", "(", ")", ":", "for", "queue", "in", "MyQueue", ".", "collection", "(", ")", ".", "instances", "(", ")", ":", "queue", ".", "delete", "(", ")", "for", "job", "in", "MyJob", ".", "collection", "(", ")", ".", "instances", "(", ")", ...
Clean data created by this script
[ "Clean", "data", "created", "by", "this", "script" ]
train
https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/example.py#L164-L173
limpyd/redis-limpyd-jobs
example.py
MyJob.run
def run(self, queue): """ Create the fullname, and store a a message serving as result in the job """ # add some random time to simulate a long job time.sleep(random.random()) # compute the fullname obj = self.get_object() obj.fullname.hset('%s %s' % tupl...
python
def run(self, queue): """ Create the fullname, and store a a message serving as result in the job """ # add some random time to simulate a long job time.sleep(random.random()) # compute the fullname obj = self.get_object() obj.fullname.hset('%s %s' % tupl...
[ "def", "run", "(", "self", ",", "queue", ")", ":", "# add some random time to simulate a long job", "time", ".", "sleep", "(", "random", ".", "random", "(", ")", ")", "# compute the fullname", "obj", "=", "self", ".", "get_object", "(", ")", "obj", ".", "ful...
Create the fullname, and store a a message serving as result in the job
[ "Create", "the", "fullname", "and", "store", "a", "a", "message", "serving", "as", "result", "in", "the", "job" ]
train
https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/example.py#L58-L76
limpyd/redis-limpyd-jobs
example.py
FullNameWorker.job_success
def job_success(self, job, queue, job_result): """ Update the queue's dates and number of jobs managed, and save into the job the result received by the callback. """ # display what was done obj = job.get_object() message = '[%s|%s] %s [%s]' % (queue.name.hget(),...
python
def job_success(self, job, queue, job_result): """ Update the queue's dates and number of jobs managed, and save into the job the result received by the callback. """ # display what was done obj = job.get_object() message = '[%s|%s] %s [%s]' % (queue.name.hget(),...
[ "def", "job_success", "(", "self", ",", "job", ",", "queue", ",", "job_result", ")", ":", "# display what was done", "obj", "=", "job", ".", "get_object", "(", ")", "message", "=", "'[%s|%s] %s [%s]'", "%", "(", "queue", ".", "name", ".", "hget", "(", ")...
Update the queue's dates and number of jobs managed, and save into the job the result received by the callback.
[ "Update", "the", "queue", "s", "dates", "and", "number", "of", "jobs", "managed", "and", "save", "into", "the", "job", "the", "result", "received", "by", "the", "callback", "." ]
train
https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/example.py#L122-L151
quasipedia/swaggery
swaggery/introspection/introspection.py
ResourceListing.resource_listing
def resource_listing(cls, request) -> [(200, 'Ok', ResourceListingModel)]: '''Return the list of all available resources on the system. Resources are filtered according to the permission system, so querying this resource as different users may bare different results.''' apis = [api.get_...
python
def resource_listing(cls, request) -> [(200, 'Ok', ResourceListingModel)]: '''Return the list of all available resources on the system. Resources are filtered according to the permission system, so querying this resource as different users may bare different results.''' apis = [api.get_...
[ "def", "resource_listing", "(", "cls", ",", "request", ")", "->", "[", "(", "200", ",", "'Ok'", ",", "ResourceListingModel", ")", "]", ":", "apis", "=", "[", "api", ".", "get_swagger_fragment", "(", ")", "for", "api", "in", "Api", "if", "not", "api", ...
Return the list of all available resources on the system. Resources are filtered according to the permission system, so querying this resource as different users may bare different results.
[ "Return", "the", "list", "of", "all", "available", "resources", "on", "the", "system", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/introspection/introspection.py#L45-L55
quasipedia/swaggery
swaggery/introspection/introspection.py
ApiDeclaration._extract_models
def _extract_models(cls, apis): '''An helper function to extract all used models from the apis.''' # TODO: This would probably be much better if the info would be # extracted from the classes, rather than from the swagger # representation... models = set() for api in apis...
python
def _extract_models(cls, apis): '''An helper function to extract all used models from the apis.''' # TODO: This would probably be much better if the info would be # extracted from the classes, rather than from the swagger # representation... models = set() for api in apis...
[ "def", "_extract_models", "(", "cls", ",", "apis", ")", ":", "# TODO: This would probably be much better if the info would be", "# extracted from the classes, rather than from the swagger", "# representation...", "models", "=", "set", "(", ")", "for", "api", "in", "apis", ":"...
An helper function to extract all used models from the apis.
[ "An", "helper", "function", "to", "extract", "all", "used", "models", "from", "the", "apis", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/introspection/introspection.py#L68-L90
quasipedia/swaggery
swaggery/introspection/introspection.py
ApiDeclaration.api_declaration
def api_declaration( cls, request, api_path: (Ptypes.path, String('The path for the info on the resource.'))) -> [ (200, 'Ok', ApiDeclarationModel), (404, 'Not a valid resource.')]: '''Return the complete specification of a single API. ...
python
def api_declaration( cls, request, api_path: (Ptypes.path, String('The path for the info on the resource.'))) -> [ (200, 'Ok', ApiDeclarationModel), (404, 'Not a valid resource.')]: '''Return the complete specification of a single API. ...
[ "def", "api_declaration", "(", "cls", ",", "request", ",", "api_path", ":", "(", "Ptypes", ".", "path", ",", "String", "(", "'The path for the info on the resource.'", ")", ")", ")", "->", "[", "(", "200", ",", "'Ok'", ",", "ApiDeclarationModel", ")", ",", ...
Return the complete specification of a single API. Resources are filtered according to the permission system, so querying this resource as different users may bare different results.
[ "Return", "the", "complete", "specification", "of", "a", "single", "API", "." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/swaggery/introspection/introspection.py#L93-L121
ppo/django-guitar
guitar/middlewares.py
GuitarMiddleware._get_route_info
def _get_route_info(self, request): """Return information about the current URL.""" resolve_match = resolve(request.path) app_name = resolve_match.app_name # The application namespace for the URL pattern that matches the URL. namespace = resolve_match.namespace # The instance namesp...
python
def _get_route_info(self, request): """Return information about the current URL.""" resolve_match = resolve(request.path) app_name = resolve_match.app_name # The application namespace for the URL pattern that matches the URL. namespace = resolve_match.namespace # The instance namesp...
[ "def", "_get_route_info", "(", "self", ",", "request", ")", ":", "resolve_match", "=", "resolve", "(", "request", ".", "path", ")", "app_name", "=", "resolve_match", ".", "app_name", "# The application namespace for the URL pattern that matches the URL.", "namespace", "...
Return information about the current URL.
[ "Return", "information", "about", "the", "current", "URL", "." ]
train
https://github.com/ppo/django-guitar/blob/857282219c0c4ff5907c3ad04ef012281d245348/guitar/middlewares.py#L24-L38
delfick/aws_syncr
aws_syncr/amazon/amazon.py
Amazon.validate_account
def validate_account(self): """Make sure we are able to connect to the right account""" self._validating = True with self.catch_invalid_credentials(): log.info("Finding a role to check the account id") a_role = list(self.iam.resource.roles.limit(1)) if not a_r...
python
def validate_account(self): """Make sure we are able to connect to the right account""" self._validating = True with self.catch_invalid_credentials(): log.info("Finding a role to check the account id") a_role = list(self.iam.resource.roles.limit(1)) if not a_r...
[ "def", "validate_account", "(", "self", ")", ":", "self", ".", "_validating", "=", "True", "with", "self", ".", "catch_invalid_credentials", "(", ")", ":", "log", ".", "info", "(", "\"Finding a role to check the account id\"", ")", "a_role", "=", "list", "(", ...
Make sure we are able to connect to the right account
[ "Make", "sure", "we", "are", "able", "to", "connect", "to", "the", "right", "account" ]
train
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/amazon/amazon.py#L46-L61
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
_Dispatch
def _Dispatch(ps, server, SendResponse, SendFault, post, action, nsdict={}, **kw): '''Send ParsedSoap instance to ServiceContainer, which dispatches to appropriate service via post, and method via action. Response is a self-describing pyobj, which is passed to a SoapWriter. Call SendResponse or SendFa...
python
def _Dispatch(ps, server, SendResponse, SendFault, post, action, nsdict={}, **kw): '''Send ParsedSoap instance to ServiceContainer, which dispatches to appropriate service via post, and method via action. Response is a self-describing pyobj, which is passed to a SoapWriter. Call SendResponse or SendFa...
[ "def", "_Dispatch", "(", "ps", ",", "server", ",", "SendResponse", ",", "SendFault", ",", "post", ",", "action", ",", "nsdict", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "localURL", "=", "'http://%s:%d%s'", "%", "(", "server", ".", "server_name", ...
Send ParsedSoap instance to ServiceContainer, which dispatches to appropriate service via post, and method via action. Response is a self-describing pyobj, which is passed to a SoapWriter. Call SendResponse or SendFault to send the reply back, appropriately. server -- ServiceContainer instance
[ "Send", "ParsedSoap", "instance", "to", "ServiceContainer", "which", "dispatches", "to", "appropriate", "service", "via", "post", "and", "method", "via", "action", ".", "Response", "is", "a", "self", "-", "describing", "pyobj", "which", "is", "passed", "to", "...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L60-L141
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
AsServer
def AsServer(port=80, services=()): '''port -- services -- list of service instances ''' address = ('', port) sc = ServiceContainer(address, services) sc.serve_forever()
python
def AsServer(port=80, services=()): '''port -- services -- list of service instances ''' address = ('', port) sc = ServiceContainer(address, services) sc.serve_forever()
[ "def", "AsServer", "(", "port", "=", "80", ",", "services", "=", "(", ")", ")", ":", "address", "=", "(", "''", ",", "port", ")", "sc", "=", "ServiceContainer", "(", "address", ",", "services", ")", "sc", ".", "serve_forever", "(", ")" ]
port -- services -- list of service instances
[ "port", "--", "services", "--", "list", "of", "service", "instances" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L144-L150
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
ServiceInterface.getOperation
def getOperation(self, ps, action): '''Returns a method of class. action -- soapAction value ''' opName = self.getOperationName(ps, action) return getattr(self, opName)
python
def getOperation(self, ps, action): '''Returns a method of class. action -- soapAction value ''' opName = self.getOperationName(ps, action) return getattr(self, opName)
[ "def", "getOperation", "(", "self", ",", "ps", ",", "action", ")", ":", "opName", "=", "self", ".", "getOperationName", "(", "ps", ",", "action", ")", "return", "getattr", "(", "self", ",", "opName", ")" ]
Returns a method of class. action -- soapAction value
[ "Returns", "a", "method", "of", "class", ".", "action", "--", "soapAction", "value" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L191-L196
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
ServiceInterface.getOperationName
def getOperationName(self, ps, action): '''Returns operation name. action -- soapAction value ''' method = self.root.get(_get_element_nsuri_name(ps.body_root)) or \ self.soapAction.get(action) if method is None: raise UnknownRequestException, \ ...
python
def getOperationName(self, ps, action): '''Returns operation name. action -- soapAction value ''' method = self.root.get(_get_element_nsuri_name(ps.body_root)) or \ self.soapAction.get(action) if method is None: raise UnknownRequestException, \ ...
[ "def", "getOperationName", "(", "self", ",", "ps", ",", "action", ")", ":", "method", "=", "self", ".", "root", ".", "get", "(", "_get_element_nsuri_name", "(", "ps", ".", "body_root", ")", ")", "or", "self", ".", "soapAction", ".", "get", "(", "action...
Returns operation name. action -- soapAction value
[ "Returns", "operation", "name", ".", "action", "--", "soapAction", "value" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L198-L207
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
WSAResource.getOperation
def getOperation(self, ps, address): '''Returns a method of class. address -- ws-address ''' action = address.getAction() opName = self.getOperationName(ps, action) return getattr(self, opName)
python
def getOperation(self, ps, address): '''Returns a method of class. address -- ws-address ''' action = address.getAction() opName = self.getOperationName(ps, action) return getattr(self, opName)
[ "def", "getOperation", "(", "self", ",", "ps", ",", "address", ")", ":", "action", "=", "address", ".", "getAction", "(", ")", "opName", "=", "self", ".", "getOperationName", "(", "ps", ",", "action", ")", "return", "getattr", "(", "self", ",", "opName...
Returns a method of class. address -- ws-address
[ "Returns", "a", "method", "of", "class", ".", "address", "--", "ws", "-", "address" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L249-L255
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
WSAResource.getResponseAction
def getResponseAction(self, ps, action): '''Returns response WS-Action if available action -- request WS-Action value. ''' opName = self.getOperationName(ps, action) if self.wsAction.has_key(opName) is False: raise WSActionNotSpecified, 'wsAction dictionary missing...
python
def getResponseAction(self, ps, action): '''Returns response WS-Action if available action -- request WS-Action value. ''' opName = self.getOperationName(ps, action) if self.wsAction.has_key(opName) is False: raise WSActionNotSpecified, 'wsAction dictionary missing...
[ "def", "getResponseAction", "(", "self", ",", "ps", ",", "action", ")", ":", "opName", "=", "self", ".", "getOperationName", "(", "ps", ",", "action", ")", "if", "self", ".", "wsAction", ".", "has_key", "(", "opName", ")", "is", "False", ":", "raise", ...
Returns response WS-Action if available action -- request WS-Action value.
[ "Returns", "response", "WS", "-", "Action", "if", "available", "action", "--", "request", "WS", "-", "Action", "value", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L257-L264
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
WSAResource.do_POST
def do_POST(self): '''The POST command. This is called by HTTPServer, not twisted. action -- SOAPAction(HTTP header) or wsa:Action(SOAP:Header) ''' global _contexts soapAction = self.headers.getheader('SOAPAction') post = self.path if not post: raise...
python
def do_POST(self): '''The POST command. This is called by HTTPServer, not twisted. action -- SOAPAction(HTTP header) or wsa:Action(SOAP:Header) ''' global _contexts soapAction = self.headers.getheader('SOAPAction') post = self.path if not post: raise...
[ "def", "do_POST", "(", "self", ")", ":", "global", "_contexts", "soapAction", "=", "self", ".", "headers", ".", "getheader", "(", "'SOAPAction'", ")", "post", "=", "self", ".", "path", "if", "not", "post", ":", "raise", "PostNotSpecified", ",", "'HTTP POST...
The POST command. This is called by HTTPServer, not twisted. action -- SOAPAction(HTTP header) or wsa:Action(SOAP:Header)
[ "The", "POST", "command", ".", "This", "is", "called", "by", "HTTPServer", "not", "twisted", ".", "action", "--", "SOAPAction", "(", "HTTP", "header", ")", "or", "wsa", ":", "Action", "(", "SOAP", ":", "Header", ")" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L266-L308
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
SOAPRequestHandler.do_GET
def do_GET(self): '''The GET command. ''' if self.path.lower().endswith("?wsdl"): service_path = self.path[:-5] service = self.server.getNode(service_path) if hasattr(service, "_wsdl"): wsdl = service._wsdl # update the soap:location t...
python
def do_GET(self): '''The GET command. ''' if self.path.lower().endswith("?wsdl"): service_path = self.path[:-5] service = self.server.getNode(service_path) if hasattr(service, "_wsdl"): wsdl = service._wsdl # update the soap:location t...
[ "def", "do_GET", "(", "self", ")", ":", "if", "self", ".", "path", ".", "lower", "(", ")", ".", "endswith", "(", "\"?wsdl\"", ")", ":", "service_path", "=", "self", ".", "path", "[", ":", "-", "5", "]", "service", "=", "self", ".", "server", ".",...
The GET command.
[ "The", "GET", "command", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L357-L382
rameshg87/pyremotevbox
pyremotevbox/ZSI/ServiceContainer.py
SimpleWSResource.getCallBack
def getCallBack(self, ps, post, action): '''post -- POST HTTP value action -- SOAP Action value ''' node = self.getNode(post) if node is None: raise NoSuchFunction if node.authorize(None, post, action): return node.getOperation(ps, action) ...
python
def getCallBack(self, ps, post, action): '''post -- POST HTTP value action -- SOAP Action value ''' node = self.getNode(post) if node is None: raise NoSuchFunction if node.authorize(None, post, action): return node.getOperation(ps, action) ...
[ "def", "getCallBack", "(", "self", ",", "ps", ",", "post", ",", "action", ")", ":", "node", "=", "self", ".", "getNode", "(", "post", ")", "if", "node", "is", "None", ":", "raise", "NoSuchFunction", "if", "node", ".", "authorize", "(", "None", ",", ...
post -- POST HTTP value action -- SOAP Action value
[ "post", "--", "POST", "HTTP", "value", "action", "--", "SOAP", "Action", "value" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/ServiceContainer.py#L484-L494
laurenceputra/mongo_notebook_manager
mongo_notebook_manager/__init__.py
MongoNotebookManager.get_notebook_names
def get_notebook_names(self, path=''): """List all notebook names in the notebook dir and path.""" path = path.strip('/') spec = {'path': path, 'type': 'notebook'} fields = {'name': 1} notebooks = list(self._connect_collection(self.notebook_collection).find(spec,f...
python
def get_notebook_names(self, path=''): """List all notebook names in the notebook dir and path.""" path = path.strip('/') spec = {'path': path, 'type': 'notebook'} fields = {'name': 1} notebooks = list(self._connect_collection(self.notebook_collection).find(spec,f...
[ "def", "get_notebook_names", "(", "self", ",", "path", "=", "''", ")", ":", "path", "=", "path", ".", "strip", "(", "'/'", ")", "spec", "=", "{", "'path'", ":", "path", ",", "'type'", ":", "'notebook'", "}", "fields", "=", "{", "'name'", ":", "1", ...
List all notebook names in the notebook dir and path.
[ "List", "all", "notebook", "names", "in", "the", "notebook", "dir", "and", "path", "." ]
train
https://github.com/laurenceputra/mongo_notebook_manager/blob/d7f4031e236ff19b8f0658f8ad1fcd1b51815251/mongo_notebook_manager/__init__.py#L65-L73
laurenceputra/mongo_notebook_manager
mongo_notebook_manager/__init__.py
MongoNotebookManager.path_exists
def path_exists(self, path): """Does the API-style path (directory) actually exist? Parameters ---------- path : string The path to check. This is an API path (`/` separated, relative to base notebook-dir). Returns ------- exists : bool ...
python
def path_exists(self, path): """Does the API-style path (directory) actually exist? Parameters ---------- path : string The path to check. This is an API path (`/` separated, relative to base notebook-dir). Returns ------- exists : bool ...
[ "def", "path_exists", "(", "self", ",", "path", ")", ":", "path", "=", "path", ".", "strip", "(", "'/'", ")", "if", "path", "!=", "''", ":", "spec", "=", "{", "'path'", ":", "path", "}", "count", "=", "self", ".", "_connect_collection", "(", "self"...
Does the API-style path (directory) actually exist? Parameters ---------- path : string The path to check. This is an API path (`/` separated, relative to base notebook-dir). Returns ------- exists : bool Whether the path is indeed a ...
[ "Does", "the", "API", "-", "style", "path", "(", "directory", ")", "actually", "exist?" ]
train
https://github.com/laurenceputra/mongo_notebook_manager/blob/d7f4031e236ff19b8f0658f8ad1fcd1b51815251/mongo_notebook_manager/__init__.py#L75-L96
laurenceputra/mongo_notebook_manager
mongo_notebook_manager/__init__.py
MongoNotebookManager.create_notebook
def create_notebook(self, model=None, path=''): """Create a new notebook and return its model with no content.""" path = path.strip('/') if model is None: model = {} if 'content' not in model: metadata = current.new_metadata(name=u'') model['content'] ...
python
def create_notebook(self, model=None, path=''): """Create a new notebook and return its model with no content.""" path = path.strip('/') if model is None: model = {} if 'content' not in model: metadata = current.new_metadata(name=u'') model['content'] ...
[ "def", "create_notebook", "(", "self", ",", "model", "=", "None", ",", "path", "=", "''", ")", ":", "path", "=", "path", ".", "strip", "(", "'/'", ")", "if", "model", "is", "None", ":", "model", "=", "{", "}", "if", "'content'", "not", "in", "mod...
Create a new notebook and return its model with no content.
[ "Create", "a", "new", "notebook", "and", "return", "its", "model", "with", "no", "content", "." ]
train
https://github.com/laurenceputra/mongo_notebook_manager/blob/d7f4031e236ff19b8f0658f8ad1fcd1b51815251/mongo_notebook_manager/__init__.py#L202-L217
mweb/appconfig
appconfig/appconfig.py
_get_type
def _get_type(stype): ''' Get the python type for a given string describtion for a type. @param stype: The string representing the type to return @return: The python type if available ''' stype = stype.lower() if stype == 'str': return str if stype == 'unicode': if P...
python
def _get_type(stype): ''' Get the python type for a given string describtion for a type. @param stype: The string representing the type to return @return: The python type if available ''' stype = stype.lower() if stype == 'str': return str if stype == 'unicode': if P...
[ "def", "_get_type", "(", "stype", ")", ":", "stype", "=", "stype", ".", "lower", "(", ")", "if", "stype", "==", "'str'", ":", "return", "str", "if", "stype", "==", "'unicode'", ":", "if", "PY2", ":", "return", "unicode", "else", ":", "return", "str",...
Get the python type for a given string describtion for a type. @param stype: The string representing the type to return @return: The python type if available
[ "Get", "the", "python", "type", "for", "a", "given", "string", "describtion", "for", "a", "type", "." ]
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L347-L367
mweb/appconfig
appconfig/appconfig.py
_format_message
def _format_message(value, line_length, indent="", first_indent=None): ''' Return a string with newlines so that the given string fits into this line length. At the start of the line the indent is added. This can be used for commenting the message out within a file or to indent your text. ...
python
def _format_message(value, line_length, indent="", first_indent=None): ''' Return a string with newlines so that the given string fits into this line length. At the start of the line the indent is added. This can be used for commenting the message out within a file or to indent your text. ...
[ "def", "_format_message", "(", "value", ",", "line_length", ",", "indent", "=", "\"\"", ",", "first_indent", "=", "None", ")", ":", "if", "indent", ".", "find", "(", "'\\t'", ")", ":", "indent", "=", "indent", ".", "replace", "(", "'\\t'", ",", "' '...
Return a string with newlines so that the given string fits into this line length. At the start of the line the indent is added. This can be used for commenting the message out within a file or to indent your text. All \\t will be replaced with 4 spaces. @param value: The strin...
[ "Return", "a", "string", "with", "newlines", "so", "that", "the", "given", "string", "fits", "into", "this", "line", "length", ".", "At", "the", "start", "of", "the", "line", "the", "indent", "is", "added", ".", "This", "can", "be", "used", "for", "com...
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L370-L407
mweb/appconfig
appconfig/appconfig.py
AppConfig.init_default_config
def init_default_config(self, path): ''' Initialize the config object and load the default configuration. The path to the config file must be provided. The name of the application is read from the config file. The config file stores the description and the default values for ...
python
def init_default_config(self, path): ''' Initialize the config object and load the default configuration. The path to the config file must be provided. The name of the application is read from the config file. The config file stores the description and the default values for ...
[ "def", "init_default_config", "(", "self", ",", "path", ")", ":", "if", "not", "(", "os", ".", "path", ".", "exists", "(", "path", ")", "and", "os", ".", "path", ".", "isfile", "(", "path", ")", ")", ":", "raise", "AppConfigValueException", "(", "'Th...
Initialize the config object and load the default configuration. The path to the config file must be provided. The name of the application is read from the config file. The config file stores the description and the default values for all configurations including the appl...
[ "Initialize", "the", "config", "object", "and", "load", "the", "default", "configuration", ".", "The", "path", "to", "the", "config", "file", "must", "be", "provided", ".", "The", "name", "of", "the", "application", "is", "read", "from", "the", "config", "...
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L77-L102
mweb/appconfig
appconfig/appconfig.py
AppConfig.get_description
def get_description(self, section, key): ''' Get the description of a config key. If it does not exist an Exception will be thrown. @param section: the section where the key is stored. @param key: the key to get the description for. @return: A tuple with thre...
python
def get_description(self, section, key): ''' Get the description of a config key. If it does not exist an Exception will be thrown. @param section: the section where the key is stored. @param key: the key to get the description for. @return: A tuple with thre...
[ "def", "get_description", "(", "self", ",", "section", ",", "key", ")", ":", "if", "section", "in", "self", ".", "config_description", ":", "if", "key", "in", "self", ".", "config_description", "[", "section", "]", ":", "desc", ",", "value_type", ",", "d...
Get the description of a config key. If it does not exist an Exception will be thrown. @param section: the section where the key is stored. @param key: the key to get the description for. @return: A tuple with three elements (description, type, default)
[ "Get", "the", "description", "of", "a", "config", "key", ".", "If", "it", "does", "not", "exist", "an", "Exception", "will", "be", "thrown", "." ]
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L104-L134
mweb/appconfig
appconfig/appconfig.py
AppConfig.load_default
def load_default(self): ''' Load the default config files. First the global config file then the user config file. ''' appdir = AppDirs(self.application_name, self.application_author, version=self.application_version) file_name = os.path.join(appdir.site_data_...
python
def load_default(self): ''' Load the default config files. First the global config file then the user config file. ''' appdir = AppDirs(self.application_name, self.application_author, version=self.application_version) file_name = os.path.join(appdir.site_data_...
[ "def", "load_default", "(", "self", ")", ":", "appdir", "=", "AppDirs", "(", "self", ".", "application_name", ",", "self", ".", "application_author", ",", "version", "=", "self", ".", "application_version", ")", "file_name", "=", "os", ".", "path", ".", "j...
Load the default config files. First the global config file then the user config file.
[ "Load", "the", "default", "config", "files", ".", "First", "the", "global", "config", "file", "then", "the", "user", "config", "file", "." ]
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L136-L150
mweb/appconfig
appconfig/appconfig.py
AppConfig.load
def load(self, filename): ''' Load the given config file. @param filename: the filename including the path to load. ''' if not os.path.exists(filename): #print 'Could not load config file [%s]' % (filename) raise AppConfigValueException('Could not load config...
python
def load(self, filename): ''' Load the given config file. @param filename: the filename including the path to load. ''' if not os.path.exists(filename): #print 'Could not load config file [%s]' % (filename) raise AppConfigValueException('Could not load config...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "#print 'Could not load config file [%s]' % (filename)", "raise", "AppConfigValueException", "(", "'Could not load config file {0}'", ".", ...
Load the given config file. @param filename: the filename including the path to load.
[ "Load", "the", "given", "config", "file", "." ]
train
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L152-L166