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
radjkarl/fancyTools
fancytools/render/GridRender.py
GridRender.averageValues
def averageValues(self): """ return the averaged values in the grid """ assert self.opts['record_density'] and self.opts['method'] == 'sum' # dont increase value of partly filled cells (density 0..1): filled = self.density > 1 v = self.values.copy() v[fill...
python
def averageValues(self): """ return the averaged values in the grid """ assert self.opts['record_density'] and self.opts['method'] == 'sum' # dont increase value of partly filled cells (density 0..1): filled = self.density > 1 v = self.values.copy() v[fill...
[ "def", "averageValues", "(", "self", ")", ":", "assert", "self", ".", "opts", "[", "'record_density'", "]", "and", "self", ".", "opts", "[", "'method'", "]", "==", "'sum'", "# dont increase value of partly filled cells (density 0..1):", "filled", "=", "self", ".",...
return the averaged values in the grid
[ "return", "the", "averaged", "values", "in", "the", "grid" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/render/GridRender.py#L99-L111
radjkarl/fancyTools
fancytools/render/GridRender.py
GridRender.add
def add(self, point, value): """ Assign all self.merge_values to the self._mergeMatrix Get the position/intensity of a value """ # check range for p, r in zip(point, self.range): if p < r[0] or p > r[1]: return # check nan if is...
python
def add(self, point, value): """ Assign all self.merge_values to the self._mergeMatrix Get the position/intensity of a value """ # check range for p, r in zip(point, self.range): if p < r[0] or p > r[1]: return # check nan if is...
[ "def", "add", "(", "self", ",", "point", ",", "value", ")", ":", "# check range", "for", "p", ",", "r", "in", "zip", "(", "point", ",", "self", ".", "range", ")", ":", "if", "p", "<", "r", "[", "0", "]", "or", "p", ">", "r", "[", "1", "]", ...
Assign all self.merge_values to the self._mergeMatrix Get the position/intensity of a value
[ "Assign", "all", "self", ".", "merge_values", "to", "the", "self", ".", "_mergeMatrix", "Get", "the", "position", "/", "intensity", "of", "a", "value" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/render/GridRender.py#L113-L148
incuna/incuna-auth
incuna_auth/middleware/permission.py
BasePermissionMiddleware.deny_access
def deny_access(self, request, **kwargs): """ Standard failure behaviour. Returns HTTP 403 (Forbidden) for non-GET requests. For GET requests, returns HTTP 302 (Redirect) pointing at either a URL specified in the class's unauthorised_redirect attribute, if one exists, or / if n...
python
def deny_access(self, request, **kwargs): """ Standard failure behaviour. Returns HTTP 403 (Forbidden) for non-GET requests. For GET requests, returns HTTP 302 (Redirect) pointing at either a URL specified in the class's unauthorised_redirect attribute, if one exists, or / if n...
[ "def", "deny_access", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "# Raise a 403 for POST/DELETE etc.", "if", "request", ".", "method", "!=", "'GET'", ":", "return", "HttpResponseForbidden", "(", ")", "# Add a message, if one has been defined.", ...
Standard failure behaviour. Returns HTTP 403 (Forbidden) for non-GET requests. For GET requests, returns HTTP 302 (Redirect) pointing at either a URL specified in the class's unauthorised_redirect attribute, if one exists, or / if not. This version also adds a (translated) message if o...
[ "Standard", "failure", "behaviour", "." ]
train
https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission.py#L64-L85
incuna/incuna-auth
incuna_auth/middleware/permission.py
BasePermissionMiddleware.process_request
def process_request(self, request): """ The actual middleware method, called on all incoming requests. This default implementation will ignore the middleware (return None) if the conditions specified in is_resource_protected aren't met. If they are, it then tests to see if the u...
python
def process_request(self, request): """ The actual middleware method, called on all incoming requests. This default implementation will ignore the middleware (return None) if the conditions specified in is_resource_protected aren't met. If they are, it then tests to see if the u...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "if", "not", "self", ".", "is_resource_protected", "(", "request", ")", ":", "return", "if", "self", ".", "deny_access_condition", "(", "request", ")", ":", "return", "self", ".", "deny_access"...
The actual middleware method, called on all incoming requests. This default implementation will ignore the middleware (return None) if the conditions specified in is_resource_protected aren't met. If they are, it then tests to see if the user should be denied access via the denied_access_condit...
[ "The", "actual", "middleware", "method", "called", "on", "all", "incoming", "requests", "." ]
train
https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission.py#L87-L100
incuna/incuna-auth
incuna_auth/middleware/permission.py
UrlPermissionMiddleware.is_resource_protected
def is_resource_protected(self, request, **kwargs): """ Returns true if and only if the resource's URL is *not* exempt and *is* protected. """ exempt_urls = self.get_exempt_url_patterns() protected_urls = self.get_protected_url_patterns() path = request.path_info.lstrip('...
python
def is_resource_protected(self, request, **kwargs): """ Returns true if and only if the resource's URL is *not* exempt and *is* protected. """ exempt_urls = self.get_exempt_url_patterns() protected_urls = self.get_protected_url_patterns() path = request.path_info.lstrip('...
[ "def", "is_resource_protected", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "exempt_urls", "=", "self", ".", "get_exempt_url_patterns", "(", ")", "protected_urls", "=", "self", ".", "get_protected_url_patterns", "(", ")", "path", "=", "requ...
Returns true if and only if the resource's URL is *not* exempt and *is* protected.
[ "Returns", "true", "if", "and", "only", "if", "the", "resource", "s", "URL", "is", "*", "not", "*", "exempt", "and", "*", "is", "*", "protected", "." ]
train
https://github.com/incuna/incuna-auth/blob/949ccd922da15a4b5de17b9595cc8f5114d5385c/incuna_auth/middleware/permission.py#L156-L172
ajk8/workdir-python
workdir/__init__.py
as_cwd
def as_cwd(): """ Use workdir.options.path as a temporary working directory """ _set_log_level() owd = os.getcwd() logger.debug('entering working directory: ' + options.path) os.chdir(os.path.expanduser(options.path)) yield logger.debug('returning to original directory: ' + owd) os.chdir...
python
def as_cwd(): """ Use workdir.options.path as a temporary working directory """ _set_log_level() owd = os.getcwd() logger.debug('entering working directory: ' + options.path) os.chdir(os.path.expanduser(options.path)) yield logger.debug('returning to original directory: ' + owd) os.chdir...
[ "def", "as_cwd", "(", ")", ":", "_set_log_level", "(", ")", "owd", "=", "os", ".", "getcwd", "(", ")", "logger", ".", "debug", "(", "'entering working directory: '", "+", "options", ".", "path", ")", "os", ".", "chdir", "(", "os", ".", "path", ".", "...
Use workdir.options.path as a temporary working directory
[ "Use", "workdir", ".", "options", ".", "path", "as", "a", "temporary", "working", "directory" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L38-L46
ajk8/workdir-python
workdir/__init__.py
_gitignore_entry_to_regex
def _gitignore_entry_to_regex(entry): """ Take a path that you might find in a .gitignore file and turn it into a regex """ ret = entry.strip() ret = ret.replace('.', '\.') ret = ret.replace('*', '.*') return ret
python
def _gitignore_entry_to_regex(entry): """ Take a path that you might find in a .gitignore file and turn it into a regex """ ret = entry.strip() ret = ret.replace('.', '\.') ret = ret.replace('*', '.*') return ret
[ "def", "_gitignore_entry_to_regex", "(", "entry", ")", ":", "ret", "=", "entry", ".", "strip", "(", ")", "ret", "=", "ret", ".", "replace", "(", "'.'", ",", "'\\.'", ")", "ret", "=", "ret", ".", "replace", "(", "'*'", ",", "'.*'", ")", "return", "r...
Take a path that you might find in a .gitignore file and turn it into a regex
[ "Take", "a", "path", "that", "you", "might", "find", "in", "a", ".", "gitignore", "file", "and", "turn", "it", "into", "a", "regex" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L49-L54
ajk8/workdir-python
workdir/__init__.py
sync
def sync(sourcedir=None, exclude_gitignore_entries=None, exclude_regex_list=None): """ Create and populate workdir.options.path, memoized so that it only runs once """ _set_log_level() sourcedir = sourcedir or options.sync_sourcedir or os.getcwd() if exclude_gitignore_entries is None: exclude_gi...
python
def sync(sourcedir=None, exclude_gitignore_entries=None, exclude_regex_list=None): """ Create and populate workdir.options.path, memoized so that it only runs once """ _set_log_level() sourcedir = sourcedir or options.sync_sourcedir or os.getcwd() if exclude_gitignore_entries is None: exclude_gi...
[ "def", "sync", "(", "sourcedir", "=", "None", ",", "exclude_gitignore_entries", "=", "None", ",", "exclude_regex_list", "=", "None", ")", ":", "_set_log_level", "(", ")", "sourcedir", "=", "sourcedir", "or", "options", ".", "sync_sourcedir", "or", "os", ".", ...
Create and populate workdir.options.path, memoized so that it only runs once
[ "Create", "and", "populate", "workdir", ".", "options", ".", "path", "memoized", "so", "that", "it", "only", "runs", "once" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L57-L84
ajk8/workdir-python
workdir/__init__.py
create
def create(): """ Create workdir.options.path """ if not os.path.isdir(options.path): logger.info('creating working directory: ' + options.path) os.makedirs(options.path)
python
def create(): """ Create workdir.options.path """ if not os.path.isdir(options.path): logger.info('creating working directory: ' + options.path) os.makedirs(options.path)
[ "def", "create", "(", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "options", ".", "path", ")", ":", "logger", ".", "info", "(", "'creating working directory: '", "+", "options", ".", "path", ")", "os", ".", "makedirs", "(", "options", ...
Create workdir.options.path
[ "Create", "workdir", ".", "options", ".", "path" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L87-L91
ajk8/workdir-python
workdir/__init__.py
clean
def clean(): """ Remove all of the files contained in workdir.options.path """ if os.path.isdir(options.path): logger.info('cleaning working directory: ' + options.path) for filename in os.listdir(options.path): filepath = os.path.join(options.path, filename) if os.path.i...
python
def clean(): """ Remove all of the files contained in workdir.options.path """ if os.path.isdir(options.path): logger.info('cleaning working directory: ' + options.path) for filename in os.listdir(options.path): filepath = os.path.join(options.path, filename) if os.path.i...
[ "def", "clean", "(", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "options", ".", "path", ")", ":", "logger", ".", "info", "(", "'cleaning working directory: '", "+", "options", ".", "path", ")", "for", "filename", "in", "os", ".", "listdir", ...
Remove all of the files contained in workdir.options.path
[ "Remove", "all", "of", "the", "files", "contained", "in", "workdir", ".", "options", ".", "path" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L94-L103
ajk8/workdir-python
workdir/__init__.py
remove
def remove(): """ Remove workdir.options.path """ if os.path.isdir(options.path): logger.info('removing working directory: ' + options.path) shutil.rmtree(options.path)
python
def remove(): """ Remove workdir.options.path """ if os.path.isdir(options.path): logger.info('removing working directory: ' + options.path) shutil.rmtree(options.path)
[ "def", "remove", "(", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "options", ".", "path", ")", ":", "logger", ".", "info", "(", "'removing working directory: '", "+", "options", ".", "path", ")", "shutil", ".", "rmtree", "(", "options", ".", ...
Remove workdir.options.path
[ "Remove", "workdir", ".", "options", ".", "path" ]
train
https://github.com/ajk8/workdir-python/blob/44a62f45cefb9a1b834d23191e88340b790a553e/workdir/__init__.py#L106-L110
observerss/yamo
yamo/document.py
MapperMixin.query
def query(cls, *args, **kwargs): """ Same as collection.find, but return Document then dict """ for doc in cls._coll.find(*args, **kwargs): yield cls.from_storage(doc)
python
def query(cls, *args, **kwargs): """ Same as collection.find, but return Document then dict """ for doc in cls._coll.find(*args, **kwargs): yield cls.from_storage(doc)
[ "def", "query", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "doc", "in", "cls", ".", "_coll", ".", "find", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "yield", "cls", ".", "from_storage", "(", "doc", ")" ]
Same as collection.find, but return Document then dict
[ "Same", "as", "collection", ".", "find", "but", "return", "Document", "then", "dict" ]
train
https://github.com/observerss/yamo/blob/ef0ab1ab7be2ecbc452d55ac9b367eb4c0d88646/yamo/document.py#L171-L174
observerss/yamo
yamo/document.py
MapperMixin.query_one
def query_one(cls, *args, **kwargs): """ Same as collection.find_one, but return Document then dict """ doc = cls._coll.find_one(*args, **kwargs) if doc: return cls.from_storage(doc)
python
def query_one(cls, *args, **kwargs): """ Same as collection.find_one, but return Document then dict """ doc = cls._coll.find_one(*args, **kwargs) if doc: return cls.from_storage(doc)
[ "def", "query_one", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "doc", "=", "cls", ".", "_coll", ".", "find_one", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "doc", ":", "return", "cls", ".", "from_storage", "(", ...
Same as collection.find_one, but return Document then dict
[ "Same", "as", "collection", ".", "find_one", "but", "return", "Document", "then", "dict" ]
train
https://github.com/observerss/yamo/blob/ef0ab1ab7be2ecbc452d55ac9b367eb4c0d88646/yamo/document.py#L177-L181
observerss/yamo
yamo/document.py
MapperMixin.upsert
def upsert(self, null=False): """ Insert or Update Document :param null: whether update null values Wisely select unique field values as filter, Update with upsert=True """ self._pre_save() self.validate() filter_ = self._upsert_filter() if filte...
python
def upsert(self, null=False): """ Insert or Update Document :param null: whether update null values Wisely select unique field values as filter, Update with upsert=True """ self._pre_save() self.validate() filter_ = self._upsert_filter() if filte...
[ "def", "upsert", "(", "self", ",", "null", "=", "False", ")", ":", "self", ".", "_pre_save", "(", ")", "self", ".", "validate", "(", ")", "filter_", "=", "self", ".", "_upsert_filter", "(", ")", "if", "filter_", ":", "update", "=", "self", ".", "_u...
Insert or Update Document :param null: whether update null values Wisely select unique field values as filter, Update with upsert=True
[ "Insert", "or", "Update", "Document" ]
train
https://github.com/observerss/yamo/blob/ef0ab1ab7be2ecbc452d55ac9b367eb4c0d88646/yamo/document.py#L188-L208
observerss/yamo
yamo/document.py
MapperMixin.cached
def cached(cls, timeout=60, cache_none=False): """ Cache queries :param timeout: cache timeout :param cache_none: cache None result Usage:: >>> Model.cached(60).query({...}) """ return CachedModel(cls=cls, timeout=timeout, cache_none=cache_none)
python
def cached(cls, timeout=60, cache_none=False): """ Cache queries :param timeout: cache timeout :param cache_none: cache None result Usage:: >>> Model.cached(60).query({...}) """ return CachedModel(cls=cls, timeout=timeout, cache_none=cache_none)
[ "def", "cached", "(", "cls", ",", "timeout", "=", "60", ",", "cache_none", "=", "False", ")", ":", "return", "CachedModel", "(", "cls", "=", "cls", ",", "timeout", "=", "timeout", ",", "cache_none", "=", "cache_none", ")" ]
Cache queries :param timeout: cache timeout :param cache_none: cache None result Usage:: >>> Model.cached(60).query({...})
[ "Cache", "queries" ]
train
https://github.com/observerss/yamo/blob/ef0ab1ab7be2ecbc452d55ac9b367eb4c0d88646/yamo/document.py#L253-L263
radjkarl/fancyTools
fancytools/utils/statusBar.py
statusBar
def statusBar(step, total, bar_len=20, onlyReturn=False): """ print a ASCI-art statusbar of variable length e.g.showing 25%: >>> step = 25 >>> total = 100 >>> print( statusBar(step, total, bar_len=20, onlyReturn=True) ) \r[=====o---------------]25% as default onlyReturn is set to False ...
python
def statusBar(step, total, bar_len=20, onlyReturn=False): """ print a ASCI-art statusbar of variable length e.g.showing 25%: >>> step = 25 >>> total = 100 >>> print( statusBar(step, total, bar_len=20, onlyReturn=True) ) \r[=====o---------------]25% as default onlyReturn is set to False ...
[ "def", "statusBar", "(", "step", ",", "total", ",", "bar_len", "=", "20", ",", "onlyReturn", "=", "False", ")", ":", "norm", "=", "100.0", "/", "total", "step", "*=", "norm", "step", "=", "int", "(", "step", ")", "increment", "=", "100", "//", "bar...
print a ASCI-art statusbar of variable length e.g.showing 25%: >>> step = 25 >>> total = 100 >>> print( statusBar(step, total, bar_len=20, onlyReturn=True) ) \r[=====o---------------]25% as default onlyReturn is set to False in this case the last printed line would be flushed every time when ...
[ "print", "a", "ASCI", "-", "art", "statusbar", "of", "variable", "length", "e", ".", "g", ".", "showing", "25%", ":" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/utils/statusBar.py#L7-L32
delfick/aws_syncr
aws_syncr/amazon/apigateway.py
ApiGateway.load_info
def load_info(self, client, info): """Fill out information about the gateway""" if 'identity' in info: info['stages'] = client.get_stages(restApiId=info['identity'])['item'] info['resources'] = client.get_resources(restApiId=info['identity'])['items'] for resource in ...
python
def load_info(self, client, info): """Fill out information about the gateway""" if 'identity' in info: info['stages'] = client.get_stages(restApiId=info['identity'])['item'] info['resources'] = client.get_resources(restApiId=info['identity'])['items'] for resource in ...
[ "def", "load_info", "(", "self", ",", "client", ",", "info", ")", ":", "if", "'identity'", "in", "info", ":", "info", "[", "'stages'", "]", "=", "client", ".", "get_stages", "(", "restApiId", "=", "info", "[", "'identity'", "]", ")", "[", "'item'", "...
Fill out information about the gateway
[ "Fill", "out", "information", "about", "the", "gateway" ]
train
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/amazon/apigateway.py#L38-L57
stephanepechard/projy
projy/templates/PythonPackageTemplate.py
PythonPackageTemplate.files
def files(self): """ Return the names of files to be created. """ files_description = [ [ self.project_name, 'bootstrap', 'BootstrapScriptFileTemplate' ], [ self.project_name, 'CHANGES.txt', 'PythonPackageCHANGESFileTemplate...
python
def files(self): """ Return the names of files to be created. """ files_description = [ [ self.project_name, 'bootstrap', 'BootstrapScriptFileTemplate' ], [ self.project_name, 'CHANGES.txt', 'PythonPackageCHANGESFileTemplate...
[ "def", "files", "(", "self", ")", ":", "files_description", "=", "[", "[", "self", ".", "project_name", ",", "'bootstrap'", ",", "'BootstrapScriptFileTemplate'", "]", ",", "[", "self", ".", "project_name", ",", "'CHANGES.txt'", ",", "'PythonPackageCHANGESFileTempl...
Return the names of files to be created.
[ "Return", "the", "names", "of", "files", "to", "be", "created", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/PythonPackageTemplate.py#L30-L58
stephanepechard/projy
projy/templates/PythonPackageTemplate.py
PythonPackageTemplate.substitutes
def substitutes(self): """ Return the substitutions for the templating replacements. """ author_collector = AuthorCollector() mail_collector = AuthorMailCollector() substitute_dict = dict( project = self.project_name, project_lower = self.project_name.lower(), ...
python
def substitutes(self): """ Return the substitutions for the templating replacements. """ author_collector = AuthorCollector() mail_collector = AuthorMailCollector() substitute_dict = dict( project = self.project_name, project_lower = self.project_name.lower(), ...
[ "def", "substitutes", "(", "self", ")", ":", "author_collector", "=", "AuthorCollector", "(", ")", "mail_collector", "=", "AuthorMailCollector", "(", ")", "substitute_dict", "=", "dict", "(", "project", "=", "self", ".", "project_name", ",", "project_lower", "="...
Return the substitutions for the templating replacements.
[ "Return", "the", "substitutions", "for", "the", "templating", "replacements", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/PythonPackageTemplate.py#L61-L72
maxfischer2781/include
include/encoded/import_hook.py
EncodedModuleLoader.module2uri
def module2uri(self, module_name): """Convert an encoded module name to an unencoded source uri""" encoded_str = super(EncodedModuleLoader, self).module2uri(module_name) encoded = encoded_str.encode('ASCII') compressed = base64.b64decode(encoded, b'+&') return zlib.decompress(com...
python
def module2uri(self, module_name): """Convert an encoded module name to an unencoded source uri""" encoded_str = super(EncodedModuleLoader, self).module2uri(module_name) encoded = encoded_str.encode('ASCII') compressed = base64.b64decode(encoded, b'+&') return zlib.decompress(com...
[ "def", "module2uri", "(", "self", ",", "module_name", ")", ":", "encoded_str", "=", "super", "(", "EncodedModuleLoader", ",", "self", ")", ".", "module2uri", "(", "module_name", ")", "encoded", "=", "encoded_str", ".", "encode", "(", "'ASCII'", ")", "compres...
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/encoded/import_hook.py#L17-L22
maxfischer2781/include
include/encoded/import_hook.py
EncodedModuleLoader.uri2module
def uri2module(self, uri): """Convert an unencoded source uri to an encoded module name""" # uri is the source code of the module compressed = zlib.compress(uri) encoded = base64.b64encode(compressed, b'+&') encoded_str = encoded.decode('ASCII') return super(EncodedModule...
python
def uri2module(self, uri): """Convert an unencoded source uri to an encoded module name""" # uri is the source code of the module compressed = zlib.compress(uri) encoded = base64.b64encode(compressed, b'+&') encoded_str = encoded.decode('ASCII') return super(EncodedModule...
[ "def", "uri2module", "(", "self", ",", "uri", ")", ":", "# uri is the source code of the module", "compressed", "=", "zlib", ".", "compress", "(", "uri", ")", "encoded", "=", "base64", ".", "b64encode", "(", "compressed", ",", "b'+&'", ")", "encoded_str", "=",...
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/encoded/import_hook.py#L24-L30
maxfischer2781/include
include/encoded/import_hook.py
EncodedModuleLoader.load_module
def load_module(self, name): """ Load and return a module Always returns the corresponding module. If the module is already loaded, the existing module is returned. """ if name in sys.modules: return sys.modules[name] module_source = self.module2uri(n...
python
def load_module(self, name): """ Load and return a module Always returns the corresponding module. If the module is already loaded, the existing module is returned. """ if name in sys.modules: return sys.modules[name] module_source = self.module2uri(n...
[ "def", "load_module", "(", "self", ",", "name", ")", ":", "if", "name", "in", "sys", ".", "modules", ":", "return", "sys", ".", "modules", "[", "name", "]", "module_source", "=", "self", ".", "module2uri", "(", "name", ")", "module_container", "=", "te...
Load and return a module Always returns the corresponding module. If the module is already loaded, the existing module is returned.
[ "Load", "and", "return", "a", "module" ]
train
https://github.com/maxfischer2781/include/blob/d8b0404f4996b6abcd39fdebf282b31fad8bb6f5/include/encoded/import_hook.py#L32-L50
django-py/django-doberman
doberman/__init__.py
Doberman.get_user_ip
def get_user_ip(self, request): """ get the client IP address bassed on a HTTPRequest """ client_ip_address = None # searching the IP address for key in self.configuration.network.ip_meta_precedence_order: ip_meta_value = request.META.get(key, '').strip() ...
python
def get_user_ip(self, request): """ get the client IP address bassed on a HTTPRequest """ client_ip_address = None # searching the IP address for key in self.configuration.network.ip_meta_precedence_order: ip_meta_value = request.META.get(key, '').strip() ...
[ "def", "get_user_ip", "(", "self", ",", "request", ")", ":", "client_ip_address", "=", "None", "# searching the IP address", "for", "key", "in", "self", ".", "configuration", ".", "network", ".", "ip_meta_precedence_order", ":", "ip_meta_value", "=", "request", "....
get the client IP address bassed on a HTTPRequest
[ "get", "the", "client", "IP", "address", "bassed", "on", "a", "HTTPRequest" ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/__init__.py#L63-L100
radjkarl/fancyTools
fancytools/os/PathStr.py
PathStr.raw
def raw(self): """Try to transform str to raw str" ... this will not work every time """ escape_dict = {'\a': r'\a', '\b': r'\b', '\c': r'\c', '\f': r'\f', '\n': r'\n', '\r'...
python
def raw(self): """Try to transform str to raw str" ... this will not work every time """ escape_dict = {'\a': r'\a', '\b': r'\b', '\c': r'\c', '\f': r'\f', '\n': r'\n', '\r'...
[ "def", "raw", "(", "self", ")", ":", "escape_dict", "=", "{", "'\\a'", ":", "r'\\a'", ",", "'\\b'", ":", "r'\\b'", ",", "'\\c'", ":", "r'\\c'", ",", "'\\f'", ":", "r'\\f'", ",", "'\\n'", ":", "r'\\n'", ",", "'\\r'", ":", "r'\\r'", ",", "'\\t'", ":"...
Try to transform str to raw str" ... this will not work every time
[ "Try", "to", "transform", "str", "to", "raw", "str", "...", "this", "will", "not", "work", "every", "time" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/PathStr.py#L33-L64
radjkarl/fancyTools
fancytools/os/PathStr.py
PathStr.getcwd
def getcwd(moduleName=None): """ get current path either from the temp folder used by pyinstaller: * apps 'sys._MEIPASS' if packed with --onefile option or * os.getcwd() """ try: p = PathStr(sys._MEIPASS) if moduleName is not Non...
python
def getcwd(moduleName=None): """ get current path either from the temp folder used by pyinstaller: * apps 'sys._MEIPASS' if packed with --onefile option or * os.getcwd() """ try: p = PathStr(sys._MEIPASS) if moduleName is not Non...
[ "def", "getcwd", "(", "moduleName", "=", "None", ")", ":", "try", ":", "p", "=", "PathStr", "(", "sys", ".", "_MEIPASS", ")", "if", "moduleName", "is", "not", "None", ":", "# pyinstaller create one temp folder", "# to separate e.g. media directories from each packag...
get current path either from the temp folder used by pyinstaller: * apps 'sys._MEIPASS' if packed with --onefile option or * os.getcwd()
[ "get", "current", "path", "either", "from", "the", "temp", "folder", "used", "by", "pyinstaller", ":" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/PathStr.py#L68-L88
radjkarl/fancyTools
fancytools/os/PathStr.py
PathStr.load
def load(self, size): """open and read the file is existent""" if self.exists() and self.isfile(): return eval(open(self).read(size))
python
def load(self, size): """open and read the file is existent""" if self.exists() and self.isfile(): return eval(open(self).read(size))
[ "def", "load", "(", "self", ",", "size", ")", ":", "if", "self", ".", "exists", "(", ")", "and", "self", ".", "isfile", "(", ")", ":", "return", "eval", "(", "open", "(", "self", ")", ".", "read", "(", "size", ")", ")" ]
open and read the file is existent
[ "open", "and", "read", "the", "file", "is", "existent" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/PathStr.py#L101-L104
radjkarl/fancyTools
fancytools/os/PathStr.py
PathStr.move
def move(self, dst): """move this file/folder the [dst]""" shutil.move(self, dst) self = PathStr(dst).join(self.basename()) return self
python
def move(self, dst): """move this file/folder the [dst]""" shutil.move(self, dst) self = PathStr(dst).join(self.basename()) return self
[ "def", "move", "(", "self", ",", "dst", ")", ":", "shutil", ".", "move", "(", "self", ",", "dst", ")", "self", "=", "PathStr", "(", "dst", ")", ".", "join", "(", "self", ".", "basename", "(", ")", ")", "return", "self" ]
move this file/folder the [dst]
[ "move", "this", "file", "/", "folder", "the", "[", "dst", "]" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/PathStr.py#L112-L116
radjkarl/fancyTools
fancytools/os/PathStr.py
PathStr.files
def files(self, ftype=None): """ return a first of path to all files within that folder """ a = [self.join(i) for i in self] if ftype is not None: return [i for i in a if i.isfile() and i.filetype() == ftype] return [i for i in a if i.isfile()]
python
def files(self, ftype=None): """ return a first of path to all files within that folder """ a = [self.join(i) for i in self] if ftype is not None: return [i for i in a if i.isfile() and i.filetype() == ftype] return [i for i in a if i.isfile()]
[ "def", "files", "(", "self", ",", "ftype", "=", "None", ")", ":", "a", "=", "[", "self", ".", "join", "(", "i", ")", "for", "i", "in", "self", "]", "if", "ftype", "is", "not", "None", ":", "return", "[", "i", "for", "i", "in", "a", "if", "i...
return a first of path to all files within that folder
[ "return", "a", "first", "of", "path", "to", "all", "files", "within", "that", "folder" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/PathStr.py#L181-L188
radjkarl/fancyTools
fancytools/math/rotation.py
rotMatrix2AxisAndAngle
def rotMatrix2AxisAndAngle(R): """ stackoverflow.com/questions/12463487/obtain-rotation-axis-from-rotation-matrix-and-translation-vector-in-opencv R : 3x3 rotation matrix returns axis, angle """ angle = np.arccos((R[0, 0] + R[1, 1] + R[2, 2] - 1)/ 2) axis = np.array([ # x (...
python
def rotMatrix2AxisAndAngle(R): """ stackoverflow.com/questions/12463487/obtain-rotation-axis-from-rotation-matrix-and-translation-vector-in-opencv R : 3x3 rotation matrix returns axis, angle """ angle = np.arccos((R[0, 0] + R[1, 1] + R[2, 2] - 1)/ 2) axis = np.array([ # x (...
[ "def", "rotMatrix2AxisAndAngle", "(", "R", ")", ":", "angle", "=", "np", ".", "arccos", "(", "(", "R", "[", "0", ",", "0", "]", "+", "R", "[", "1", ",", "1", "]", "+", "R", "[", "2", ",", "2", "]", "-", "1", ")", "/", "2", ")", "axis", ...
stackoverflow.com/questions/12463487/obtain-rotation-axis-from-rotation-matrix-and-translation-vector-in-opencv R : 3x3 rotation matrix returns axis, angle
[ "stackoverflow", ".", "com", "/", "questions", "/", "12463487", "/", "obtain", "-", "rotation", "-", "axis", "-", "from", "-", "rotation", "-", "matrix", "-", "and", "-", "translation", "-", "vector", "-", "in", "-", "opencv" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/rotation.py#L10-L29
Nixiware/viper
nx/viper/config.py
Config.mergeDictionaries
def mergeDictionaries(sourceDictionary, destinationDictionary): """ Deep merge dictionaries recursively. :param sourceDictionary: <dict> first dictionary with data :param destinationDictionary: <dict> second dictionary with data :return: <dict> merged dictionary """ ...
python
def mergeDictionaries(sourceDictionary, destinationDictionary): """ Deep merge dictionaries recursively. :param sourceDictionary: <dict> first dictionary with data :param destinationDictionary: <dict> second dictionary with data :return: <dict> merged dictionary """ ...
[ "def", "mergeDictionaries", "(", "sourceDictionary", ",", "destinationDictionary", ")", ":", "log", "=", "Logger", "(", ")", "varNamePattern", "=", "re", ".", "compile", "(", "r\"^((__((ENV)|(FILE))__[A-Z]{3,})|(__((ENV)|(FILE))))__(?P<name>.*)$\"", ")", "varTypePattern", ...
Deep merge dictionaries recursively. :param sourceDictionary: <dict> first dictionary with data :param destinationDictionary: <dict> second dictionary with data :return: <dict> merged dictionary
[ "Deep", "merge", "dictionaries", "recursively", "." ]
train
https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/config.py#L70-L167
fusionapp/fusion-util
fusion_util/defer.py
timeout_deferred
def timeout_deferred(deferred, timeout, clock, deferred_description=None): """ Time out a deferred - schedule for it to be canceling it after ``timeout`` seconds from now, as per the clock. If it gets timed out, it errbacks with a :class:`TimedOutError`, unless a cancelable function is passed to the...
python
def timeout_deferred(deferred, timeout, clock, deferred_description=None): """ Time out a deferred - schedule for it to be canceling it after ``timeout`` seconds from now, as per the clock. If it gets timed out, it errbacks with a :class:`TimedOutError`, unless a cancelable function is passed to the...
[ "def", "timeout_deferred", "(", "deferred", ",", "timeout", ",", "clock", ",", "deferred_description", "=", "None", ")", ":", "timed_out", "=", "[", "False", "]", "def", "time_it_out", "(", ")", ":", "timed_out", "[", "0", "]", "=", "True", "deferred", "...
Time out a deferred - schedule for it to be canceling it after ``timeout`` seconds from now, as per the clock. If it gets timed out, it errbacks with a :class:`TimedOutError`, unless a cancelable function is passed to the ``Deferred``'s initialization and it callbacks or errbacks with something else whe...
[ "Time", "out", "a", "deferred", "-", "schedule", "for", "it", "to", "be", "canceling", "it", "after", "timeout", "seconds", "from", "now", "as", "per", "the", "clock", ".", "If", "it", "gets", "timed", "out", "it", "errbacks", "with", "a", ":", "class"...
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/defer.py#L18-L62
emory-libraries/eulcommon
eulcommon/binfile/eudora.py
Toc.messages
def messages(self): '''a generator yielding the :class:`Message` structures in the index''' # the file contains the fixed-size file header followed by # fixed-size message structures. start after the file header and # then simply return the message structures in sequence until the ...
python
def messages(self): '''a generator yielding the :class:`Message` structures in the index''' # the file contains the fixed-size file header followed by # fixed-size message structures. start after the file header and # then simply return the message structures in sequence until the ...
[ "def", "messages", "(", "self", ")", ":", "# the file contains the fixed-size file header followed by", "# fixed-size message structures. start after the file header and", "# then simply return the message structures in sequence until the", "# end of the file.", "offset", "=", "self", ".",...
a generator yielding the :class:`Message` structures in the index
[ "a", "generator", "yielding", "the", ":", "class", ":", "Message", "structures", "in", "the", "index" ]
train
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/binfile/eudora.py#L85-L96
Saledddar/pyunet
pyunet/util.py
add_to_path
def add_to_path(p): ''' Adds a path to python paths and removes it after the 'with' block ends ''' old_path = sys.path if p not in sys.path: sys.path = sys.path[:] sys.path.insert(0, p) try: yield finally: sys.path = old_path
python
def add_to_path(p): ''' Adds a path to python paths and removes it after the 'with' block ends ''' old_path = sys.path if p not in sys.path: sys.path = sys.path[:] sys.path.insert(0, p) try: yield finally: sys.path = old_path
[ "def", "add_to_path", "(", "p", ")", ":", "old_path", "=", "sys", ".", "path", "if", "p", "not", "in", "sys", ".", "path", ":", "sys", ".", "path", "=", "sys", ".", "path", "[", ":", "]", "sys", ".", "path", ".", "insert", "(", "0", ",", "p",...
Adds a path to python paths and removes it after the 'with' block ends
[ "Adds", "a", "path", "to", "python", "paths", "and", "removes", "it", "after", "the", "with", "block", "ends" ]
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L20-L31
Saledddar/pyunet
pyunet/util.py
find_file_regex
def find_file_regex(root_dir,re_expression,return_abs_path = True,search_sub_directories = True): ''' Finds all the files with the specified root directory with the name matching the regex expression. Args : root_dir : The root directory. re_expression ...
python
def find_file_regex(root_dir,re_expression,return_abs_path = True,search_sub_directories = True): ''' Finds all the files with the specified root directory with the name matching the regex expression. Args : root_dir : The root directory. re_expression ...
[ "def", "find_file_regex", "(", "root_dir", ",", "re_expression", ",", "return_abs_path", "=", "True", ",", "search_sub_directories", "=", "True", ")", ":", "compiled", "=", "re", ".", "compile", "(", "re_expression", ")", "result", "=", "[", "]", "for", "dir...
Finds all the files with the specified root directory with the name matching the regex expression. Args : root_dir : The root directory. re_expression : The regex expression. return_abs_path : If set to true, returns the absolute path of th...
[ "Finds", "all", "the", "files", "with", "the", "specified", "root", "directory", "with", "the", "name", "matching", "the", "regex", "expression", ".", "Args", ":", "root_dir", ":", "The", "root", "directory", ".", "re_expression", ":", "The", "regex", "expre...
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L33-L54
Saledddar/pyunet
pyunet/util.py
load_module
def load_module(path): ''' Imports the module specified by the path. Args : path : The path to the source file. ''' with add_to_path(os.path.dirname(path)): spec = importlib.util.spec_from_file_location(os.path.basename(path).replace('.py',''), path) modu...
python
def load_module(path): ''' Imports the module specified by the path. Args : path : The path to the source file. ''' with add_to_path(os.path.dirname(path)): spec = importlib.util.spec_from_file_location(os.path.basename(path).replace('.py',''), path) modu...
[ "def", "load_module", "(", "path", ")", ":", "with", "add_to_path", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ")", ":", "spec", "=", "importlib", ".", "util", ".", "spec_from_file_location", "(", "os", ".", "path", ".", "basename", "(",...
Imports the module specified by the path. Args : path : The path to the source file.
[ "Imports", "the", "module", "specified", "by", "the", "path", ".", "Args", ":", "path", ":", "The", "path", "to", "the", "source", "file", "." ]
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L56-L66
Saledddar/pyunet
pyunet/util.py
find_modules_with_decorators
def find_modules_with_decorators(path,decorator_module,decorator_name): ''' Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will be scanned. decorato...
python
def find_modules_with_decorators(path,decorator_module,decorator_name): ''' Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will be scanned. decorato...
[ "def", "find_modules_with_decorators", "(", "path", ",", "decorator_module", ",", "decorator_name", ")", ":", "modules_paths", "=", "[", "]", "#If a path to a module file", "if", "path", "[", "-", "3", ":", "]", "==", "'.py'", ":", "modules_paths", ".", "append"...
Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will be scanned. decorator_module : Then full name of the module defining the decorator. decorator...
[ "Finds", "all", "the", "modules", "decorated", "with", "the", "specified", "decorator", "in", "the", "path", "file", "or", "module", "specified", ".", "Args", ":", "path", ":", "All", "modules", "in", "the", "directory", "and", "its", "sub", "-", "director...
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L68-L87
Saledddar/pyunet
pyunet/util.py
is_module_has_decorated
def is_module_has_decorated(path,decorator_module,decorator_name): ''' Finds out if a python module uses a given decorator. Args : loaded_module : The loaded module to be scanned. decorator_module : Then name of the module defining the decorator. decora...
python
def is_module_has_decorated(path,decorator_module,decorator_name): ''' Finds out if a python module uses a given decorator. Args : loaded_module : The loaded module to be scanned. decorator_module : Then name of the module defining the decorator. decora...
[ "def", "is_module_has_decorated", "(", "path", ",", "decorator_module", ",", "decorator_name", ")", ":", "#Regular expression for finding decoration in source code", "expression", "=", "'(?:\\s*@({}\\.)?{}\\s*\\()'", ".", "format", "(", "decorator_module", ",", "decorator_name"...
Finds out if a python module uses a given decorator. Args : loaded_module : The loaded module to be scanned. decorator_module : Then name of the module defining the decorator. decorator_name : The name of the decorator.
[ "Finds", "out", "if", "a", "python", "module", "uses", "a", "given", "decorator", ".", "Args", ":", "loaded_module", ":", "The", "loaded", "module", "to", "be", "scanned", ".", "decorator_module", ":", "Then", "name", "of", "the", "module", "defining", "th...
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L89-L105
Saledddar/pyunet
pyunet/util.py
nested_join
def nested_join(array, o_str= '{', c_str= '}'): ''' Builds a string out of a given nested list. Args : array : An array retruned by pyparsing nestedExpr. o_str : Opening str. c_str : Closing str. ''' result = '' for x in array : if typ...
python
def nested_join(array, o_str= '{', c_str= '}'): ''' Builds a string out of a given nested list. Args : array : An array retruned by pyparsing nestedExpr. o_str : Opening str. c_str : Closing str. ''' result = '' for x in array : if typ...
[ "def", "nested_join", "(", "array", ",", "o_str", "=", "'{'", ",", "c_str", "=", "'}'", ")", ":", "result", "=", "''", "for", "x", "in", "array", ":", "if", "type", "(", "x", ")", "==", "type", "(", "[", "]", ")", ":", "result", "+=", "o_str", ...
Builds a string out of a given nested list. Args : array : An array retruned by pyparsing nestedExpr. o_str : Opening str. c_str : Closing str.
[ "Builds", "a", "string", "out", "of", "a", "given", "nested", "list", ".", "Args", ":", "array", ":", "An", "array", "retruned", "by", "pyparsing", "nestedExpr", ".", "o_str", ":", "Opening", "str", ".", "c_str", ":", "Closing", "str", "." ]
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L107-L121
Saledddar/pyunet
pyunet/util.py
get_decorated_names
def get_decorated_names(path,decorator_module, decorator_name): ''' Get the name of fumctions or methods decorated with the specified decorator. If a method, the name will be as class_name.method_name. Args : path : The path to the module. decorator_mod...
python
def get_decorated_names(path,decorator_module, decorator_name): ''' Get the name of fumctions or methods decorated with the specified decorator. If a method, the name will be as class_name.method_name. Args : path : The path to the module. decorator_mod...
[ "def", "get_decorated_names", "(", "path", ",", "decorator_module", ",", "decorator_name", ")", ":", "#Read the source", "with", "open", "(", "path", ")", "as", "f", ":", "module_source", "=", "f", ".", "read", "(", ")", "expression", "=", "'\\s*@(?:{}\\.)?{}[...
Get the name of fumctions or methods decorated with the specified decorator. If a method, the name will be as class_name.method_name. Args : path : The path to the module. decorator_module : The name of the module defining the decorator. decorator_na...
[ "Get", "the", "name", "of", "fumctions", "or", "methods", "decorated", "with", "the", "specified", "decorator", ".", "If", "a", "method", "the", "name", "will", "be", "as", "class_name", ".", "method_name", ".", "Args", ":", "path", ":", "The", "path", "...
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L123-L166
Saledddar/pyunet
pyunet/util.py
load_method
def load_method(path,method,class_name = None,instance_creator = None): ''' Returns an instance of the method specified. Args : path : The path to the module contianing the method or function. method : The name of the function. class_name ...
python
def load_method(path,method,class_name = None,instance_creator = None): ''' Returns an instance of the method specified. Args : path : The path to the module contianing the method or function. method : The name of the function. class_name ...
[ "def", "load_method", "(", "path", ",", "method", ",", "class_name", "=", "None", ",", "instance_creator", "=", "None", ")", ":", "#Load the module", "module", "=", "load_module", "(", "path", ")", "if", "class_name", ":", "#If a class, Create an instance", "cla...
Returns an instance of the method specified. Args : path : The path to the module contianing the method or function. method : The name of the function. class_name : The name of the class if the funtion is a method. instance_creator: The na...
[ "Returns", "an", "instance", "of", "the", "method", "specified", ".", "Args", ":", "path", ":", "The", "path", "to", "the", "module", "contianing", "the", "method", "or", "function", ".", "method", ":", "The", "name", "of", "the", "function", ".", "class...
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L168-L193
Saledddar/pyunet
pyunet/util.py
fn_name
def fn_name(fn): ''' Gets a funtion fully quaified name. Args : fn : The function. Returns : The name of the function. ''' expression = '(\S+) (?:of|at)' #Checks if the function is a mehtod and should have the self argument passed is_method = inspect.ism...
python
def fn_name(fn): ''' Gets a funtion fully quaified name. Args : fn : The function. Returns : The name of the function. ''' expression = '(\S+) (?:of|at)' #Checks if the function is a mehtod and should have the self argument passed is_method = inspect.ism...
[ "def", "fn_name", "(", "fn", ")", ":", "expression", "=", "'(\\S+) (?:of|at)'", "#Checks if the function is a mehtod and should have the self argument passed", "is_method", "=", "inspect", ".", "ismethod", "(", "fn", ")", "#Builds the name of the method,module.class.method or mod...
Gets a funtion fully quaified name. Args : fn : The function. Returns : The name of the function.
[ "Gets", "a", "funtion", "fully", "quaified", "name", ".", "Args", ":", "fn", ":", "The", "function", ".", "Returns", ":", "The", "name", "of", "the", "function", "." ]
train
https://github.com/Saledddar/pyunet/blob/ca5ccc32588fae8da43f968e7747d3f3da509507/pyunet/util.py#L195-L209
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.getTypesModuleName
def getTypesModuleName(self): '''return module name. ''' assert self.wsdl is not None, 'initialize, call fromWSDL' if self.types_module_name is not None: return self.types_module_name wsm = WriteServiceModule(self.wsdl) return wsm.getTypesModuleName()
python
def getTypesModuleName(self): '''return module name. ''' assert self.wsdl is not None, 'initialize, call fromWSDL' if self.types_module_name is not None: return self.types_module_name wsm = WriteServiceModule(self.wsdl) return wsm.getTypesModuleName()
[ "def", "getTypesModuleName", "(", "self", ")", ":", "assert", "self", ".", "wsdl", "is", "not", "None", ",", "'initialize, call fromWSDL'", "if", "self", ".", "types_module_name", "is", "not", "None", ":", "return", "self", ".", "types_module_name", "wsm", "="...
return module name.
[ "return", "module", "name", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L98-L106
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.getServiceModuleName
def getServiceModuleName(self): '''return module name. ''' name = GetModuleBaseNameFromWSDL(self.wsdl) if not name: raise WsdlGeneratorError, 'could not determine a service name' if self.server_module_suffix is None: return name return '%s...
python
def getServiceModuleName(self): '''return module name. ''' name = GetModuleBaseNameFromWSDL(self.wsdl) if not name: raise WsdlGeneratorError, 'could not determine a service name' if self.server_module_suffix is None: return name return '%s...
[ "def", "getServiceModuleName", "(", "self", ")", ":", "name", "=", "GetModuleBaseNameFromWSDL", "(", "self", ".", "wsdl", ")", "if", "not", "name", ":", "raise", "WsdlGeneratorError", ",", "'could not determine a service name'", "if", "self", ".", "server_module_suf...
return module name.
[ "return", "module", "name", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L108-L117
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.setUpImports
def setUpImports(self): '''set import statements ''' i = self.imports print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD' print >>i, 'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct' module = self.getTypesModuleName() package = self.getTypesModu...
python
def setUpImports(self): '''set import statements ''' i = self.imports print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD' print >>i, 'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct' module = self.getTypesModuleName() package = self.getTypesModu...
[ "def", "setUpImports", "(", "self", ")", ":", "i", "=", "self", ".", "imports", "print", ">>", "i", ",", "'from pyremotevbox.ZSI.schema import GED, GTD'", "print", ">>", "i", ",", "'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct'", "module", "=", "self", ...
set import statements
[ "set", "import", "statements" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L143-L157
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.setUpInitDef
def setUpInitDef(self, service): '''set __init__ function ''' assert isinstance(service, WSDLTools.Service), \ 'expecting WSDLTools.Service instance.' sd = self._services[service.name] d = sd.initdef if sd.location is not None: schem...
python
def setUpInitDef(self, service): '''set __init__ function ''' assert isinstance(service, WSDLTools.Service), \ 'expecting WSDLTools.Service instance.' sd = self._services[service.name] d = sd.initdef if sd.location is not None: schem...
[ "def", "setUpInitDef", "(", "self", ",", "service", ")", ":", "assert", "isinstance", "(", "service", ",", "WSDLTools", ".", "Service", ")", ",", "'expecting WSDLTools.Service instance.'", "sd", "=", "self", ".", "_services", "[", "service", ".", "name", "]", ...
set __init__ function
[ "set", "__init__", "function" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L159-L180
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.setUpMethods
def setUpMethods(self, port): '''set up all methods representing the port operations. Parameters: port -- Port that defines the operations. ''' assert isinstance(port, WSDLTools.Port), \ 'expecting WSDLTools.Port not: ' %type(port) sd = self._services.get...
python
def setUpMethods(self, port): '''set up all methods representing the port operations. Parameters: port -- Port that defines the operations. ''' assert isinstance(port, WSDLTools.Port), \ 'expecting WSDLTools.Port not: ' %type(port) sd = self._services.get...
[ "def", "setUpMethods", "(", "self", ",", "port", ")", ":", "assert", "isinstance", "(", "port", ",", "WSDLTools", ".", "Port", ")", ",", "'expecting WSDLTools.Port not: '", "%", "type", "(", "port", ")", "sd", "=", "self", ".", "_services", ".", "get", "...
set up all methods representing the port operations. Parameters: port -- Port that defines the operations.
[ "set", "up", "all", "methods", "representing", "the", "port", "operations", ".", "Parameters", ":", "port", "--", "Port", "that", "defines", "the", "operations", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L188-L243
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.write
def write(self, fd=sys.stdout): '''write out to file descriptor, should not need to override. ''' print >>fd, self.header.getvalue() print >>fd, self.imports.getvalue() print >>fd, '# Messages ', for m in self.messages: print >>fd, m ...
python
def write(self, fd=sys.stdout): '''write out to file descriptor, should not need to override. ''' print >>fd, self.header.getvalue() print >>fd, self.imports.getvalue() print >>fd, '# Messages ', for m in self.messages: print >>fd, m ...
[ "def", "write", "(", "self", ",", "fd", "=", "sys", ".", "stdout", ")", ":", "print", ">>", "fd", ",", "self", ".", "header", ".", "getvalue", "(", ")", "print", ">>", "fd", ",", "self", ".", "imports", ".", "getvalue", "(", ")", "print", ">>", ...
write out to file descriptor, should not need to override.
[ "write", "out", "to", "file", "descriptor", "should", "not", "need", "to", "override", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L254-L272
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
ServiceModuleWriter.fromWSDL
def fromWSDL(self, wsdl): '''setup the service description from WSDL, should not need to override. ''' assert isinstance(wsdl, WSDLTools.WSDL), 'expecting WSDL instance' if len(wsdl.services) == 0: raise WsdlGeneratorError, 'No service defined' s...
python
def fromWSDL(self, wsdl): '''setup the service description from WSDL, should not need to override. ''' assert isinstance(wsdl, WSDLTools.WSDL), 'expecting WSDL instance' if len(wsdl.services) == 0: raise WsdlGeneratorError, 'No service defined' s...
[ "def", "fromWSDL", "(", "self", ",", "wsdl", ")", ":", "assert", "isinstance", "(", "wsdl", ",", "WSDLTools", ".", "WSDL", ")", ",", "'expecting WSDL instance'", "if", "len", "(", "wsdl", ".", "services", ")", "==", "0", ":", "raise", "WsdlGeneratorError",...
setup the service description from WSDL, should not need to override.
[ "setup", "the", "service", "description", "from", "WSDL", "should", "not", "need", "to", "override", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L274-L315
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
WSAServiceModuleWriter.createMethodBody
def createMethodBody(msgInName, msgOutName, **kw): '''return a tuple of strings containing the body of a method. msgInName -- None or a str msgOutName -- None or a str ''' body = [] if msgInName is not None: body.append('request = ps.Parse(%s.typecode)' %msgI...
python
def createMethodBody(msgInName, msgOutName, **kw): '''return a tuple of strings containing the body of a method. msgInName -- None or a str msgOutName -- None or a str ''' body = [] if msgInName is not None: body.append('request = ps.Parse(%s.typecode)' %msgI...
[ "def", "createMethodBody", "(", "msgInName", ",", "msgOutName", ",", "*", "*", "kw", ")", ":", "body", "=", "[", "]", "if", "msgInName", "is", "not", "None", ":", "body", ".", "append", "(", "'request = ps.Parse(%s.typecode)'", "%", "msgInName", ")", "if",...
return a tuple of strings containing the body of a method. msgInName -- None or a str msgOutName -- None or a str
[ "return", "a", "tuple", "of", "strings", "containing", "the", "body", "of", "a", "method", ".", "msgInName", "--", "None", "or", "a", "str", "msgOutName", "--", "None", "or", "a", "str" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L330-L344
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
WSAServiceModuleWriter.setUpClassDef
def setUpClassDef(self, service): '''use soapAction dict for WS-Action input, setup wsAction dict for grabbing WS-Action output values. ''' assert isinstance(service, WSDLTools.Service), \ 'expecting WSDLTools.Service instance' s = self._services[service.name].classd...
python
def setUpClassDef(self, service): '''use soapAction dict for WS-Action input, setup wsAction dict for grabbing WS-Action output values. ''' assert isinstance(service, WSDLTools.Service), \ 'expecting WSDLTools.Service instance' s = self._services[service.name].classd...
[ "def", "setUpClassDef", "(", "self", ",", "service", ")", ":", "assert", "isinstance", "(", "service", ",", "WSDLTools", ".", "Service", ")", ",", "'expecting WSDLTools.Service instance'", "s", "=", "self", ".", "_services", "[", "service", ".", "name", "]", ...
use soapAction dict for WS-Action input, setup wsAction dict for grabbing WS-Action output values.
[ "use", "soapAction", "dict", "for", "WS", "-", "Action", "input", "setup", "wsAction", "dict", "for", "grabbing", "WS", "-", "Action", "output", "values", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L347-L358
rameshg87/pyremotevbox
pyremotevbox/ZSI/generate/wsdl2dispatch.py
WSAServiceModuleWriter.setUpMethods
def setUpMethods(self, port): '''set up all methods representing the port operations. Parameters: port -- Port that defines the operations. ''' assert isinstance(port, WSDLTools.Port), \ 'expecting WSDLTools.Port not: ' %type(port) binding = port.getBindi...
python
def setUpMethods(self, port): '''set up all methods representing the port operations. Parameters: port -- Port that defines the operations. ''' assert isinstance(port, WSDLTools.Port), \ 'expecting WSDLTools.Port not: ' %type(port) binding = port.getBindi...
[ "def", "setUpMethods", "(", "self", ",", "port", ")", ":", "assert", "isinstance", "(", "port", ",", "WSDLTools", ".", "Port", ")", ",", "'expecting WSDLTools.Port not: '", "%", "type", "(", "port", ")", "binding", "=", "port", ".", "getBinding", "(", ")",...
set up all methods representing the port operations. Parameters: port -- Port that defines the operations.
[ "set", "up", "all", "methods", "representing", "the", "port", "operations", ".", "Parameters", ":", "port", "--", "Port", "that", "defines", "the", "operations", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/generate/wsdl2dispatch.py#L360-L422
TC01/calcpkg
calcrepo/repos/__init__.py
createRepoObjects
def createRepoObjects(): """Imports each 'plugin' in this package and creates a repo file from it""" repositories = {} repodir = os.path.join(getScriptLocation()) for importer, name, ispkg in pkgutil.iter_modules([repodir]): module = importer.find_module(name).load_module(name) repo_name = module.name if modu...
python
def createRepoObjects(): """Imports each 'plugin' in this package and creates a repo file from it""" repositories = {} repodir = os.path.join(getScriptLocation()) for importer, name, ispkg in pkgutil.iter_modules([repodir]): module = importer.find_module(name).load_module(name) repo_name = module.name if modu...
[ "def", "createRepoObjects", "(", ")", ":", "repositories", "=", "{", "}", "repodir", "=", "os", ".", "path", ".", "join", "(", "getScriptLocation", "(", ")", ")", "for", "importer", ",", "name", ",", "ispkg", "in", "pkgutil", ".", "iter_modules", "(", ...
Imports each 'plugin' in this package and creates a repo file from it
[ "Imports", "each", "plugin", "in", "this", "package", "and", "creates", "a", "repo", "file", "from", "it" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/repos/__init__.py#L7-L17
sliem/barrett
barrett/posterior.py
twoD.credibleregions
def credibleregions(self, probs): """ Calculates the credible regions. """ return [brentq(lambda l: self.pdf[self.pdf > l].sum() - p, 0.0, 1.0) for p in probs]
python
def credibleregions(self, probs): """ Calculates the credible regions. """ return [brentq(lambda l: self.pdf[self.pdf > l].sum() - p, 0.0, 1.0) for p in probs]
[ "def", "credibleregions", "(", "self", ",", "probs", ")", ":", "return", "[", "brentq", "(", "lambda", "l", ":", "self", ".", "pdf", "[", "self", ".", "pdf", ">", "l", "]", ".", "sum", "(", ")", "-", "p", ",", "0.0", ",", "1.0", ")", "for", "...
Calculates the credible regions.
[ "Calculates", "the", "credible", "regions", "." ]
train
https://github.com/sliem/barrett/blob/d48e96591577d1fcecd50c21a9be71573218cde7/barrett/posterior.py#L134-L138
rameshg87/pyremotevbox
pyremotevbox/ZSI/twisted/reverse.py
CallbackHandler.processRequest
def processRequest(cls, ps, **kw): """invokes callback that should return a (request,response) tuple. representing the SOAP request and response respectively. ps -- ParsedSoap instance representing HTTP Body. request -- twisted.web.server.Request """ resource = kw['resour...
python
def processRequest(cls, ps, **kw): """invokes callback that should return a (request,response) tuple. representing the SOAP request and response respectively. ps -- ParsedSoap instance representing HTTP Body. request -- twisted.web.server.Request """ resource = kw['resour...
[ "def", "processRequest", "(", "cls", ",", "ps", ",", "*", "*", "kw", ")", ":", "resource", "=", "kw", "[", "'resource'", "]", "request", "=", "kw", "[", "'request'", "]", "method", "=", "getattr", "(", "resource", ",", "'soap_%s'", "%", "_get_element_n...
invokes callback that should return a (request,response) tuple. representing the SOAP request and response respectively. ps -- ParsedSoap instance representing HTTP Body. request -- twisted.web.server.Request
[ "invokes", "callback", "that", "should", "return", "a", "(", "request", "response", ")", "tuple", ".", "representing", "the", "SOAP", "request", "and", "response", "respectively", ".", "ps", "--", "ParsedSoap", "instance", "representing", "HTTP", "Body", ".", ...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/twisted/reverse.py#L37-L53
dossier/dossier.models
dossier/models/linker/model.py
extract
def extract(positive_fcs, negative_fcs, features=None): '''Takes a labeled set of feature collections (positive and negative) and the features wanted. And trains a Naive Bayes classifier on the underlying keys of the set of selected features features. If no features are selected, all are used. ...
python
def extract(positive_fcs, negative_fcs, features=None): '''Takes a labeled set of feature collections (positive and negative) and the features wanted. And trains a Naive Bayes classifier on the underlying keys of the set of selected features features. If no features are selected, all are used. ...
[ "def", "extract", "(", "positive_fcs", ",", "negative_fcs", ",", "features", "=", "None", ")", ":", "# Vector of labels", "labels", "=", "np", ".", "array", "(", "[", "1", "]", "*", "len", "(", "positive_fcs", ")", "+", "[", "0", "]", "*", "len", "("...
Takes a labeled set of feature collections (positive and negative) and the features wanted. And trains a Naive Bayes classifier on the underlying keys of the set of selected features features. If no features are selected, all are used. Returns two list of (keywords, strength) tuples ordered...
[ "Takes", "a", "labeled", "set", "of", "feature", "collections", "(", "positive", "and", "negative", ")", "and", "the", "features", "wanted", ".", "And", "trains", "a", "Naive", "Bayes", "classifier", "on", "the", "underlying", "keys", "of", "the", "set", "...
train
https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/linker/model.py#L50-L111
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/parser_yaml.py
decode
def decode(data): """ Handles decoding of the YAML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data. """ decoded = None try: decoded = yaml.load(data) except Exception, e: e = e.message if e.message else s...
python
def decode(data): """ Handles decoding of the YAML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data. """ decoded = None try: decoded = yaml.load(data) except Exception, e: e = e.message if e.message else s...
[ "def", "decode", "(", "data", ")", ":", "decoded", "=", "None", "try", ":", "decoded", "=", "yaml", ".", "load", "(", "data", ")", "except", "Exception", ",", "e", ":", "e", "=", "e", ".", "message", "if", "e", ".", "message", "else", "str", "(",...
Handles decoding of the YAML `data`. Args: data (str): Data which will be decoded. Returns: dict: Dictionary with decoded data.
[ "Handles", "decoding", "of", "the", "YAML", "data", "." ]
train
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/parser_yaml.py#L32-L51
tomi77/python-t77-date
t77_date/datetime.py
start_of_day
def start_of_day(val): """ Return a new datetime.datetime object with values that represent a start of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) r...
python
def start_of_day(val): """ Return a new datetime.datetime object with values that represent a start of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) r...
[ "def", "start_of_day", "(", "val", ")", ":", "if", "type", "(", "val", ")", "==", "date", ":", "val", "=", "datetime", ".", "fromordinal", "(", "val", ".", "toordinal", "(", ")", ")", "return", "val", ".", "replace", "(", "hour", "=", "0", ",", "...
Return a new datetime.datetime object with values that represent a start of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime
[ "Return", "a", "new", "datetime", ".", "datetime", "object", "with", "values", "that", "represent", "a", "start", "of", "a", "day", ".", ":", "param", "val", ":", "Date", "to", "...", ":", "type", "val", ":", "datetime", ".", "datetime", "|", "datetime...
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L6-L16
tomi77/python-t77-date
t77_date/datetime.py
end_of_day
def end_of_day(val): """ Return a new datetime.datetime object with values that represent a end of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) retur...
python
def end_of_day(val): """ Return a new datetime.datetime object with values that represent a end of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) retur...
[ "def", "end_of_day", "(", "val", ")", ":", "if", "type", "(", "val", ")", "==", "date", ":", "val", "=", "datetime", ".", "fromordinal", "(", "val", ".", "toordinal", "(", ")", ")", "return", "start_of_day", "(", "val", ")", "+", "timedelta", "(", ...
Return a new datetime.datetime object with values that represent a end of a day. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime
[ "Return", "a", "new", "datetime", ".", "datetime", "object", "with", "values", "that", "represent", "a", "end", "of", "a", "day", ".", ":", "param", "val", ":", "Date", "to", "...", ":", "type", "val", ":", "datetime", ".", "datetime", "|", "datetime",...
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L19-L29
tomi77/python-t77-date
t77_date/datetime.py
start_of_month
def start_of_month(val): """ Return a new datetime.datetime object with values that represent a start of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) ...
python
def start_of_month(val): """ Return a new datetime.datetime object with values that represent a start of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) ...
[ "def", "start_of_month", "(", "val", ")", ":", "if", "type", "(", "val", ")", "==", "date", ":", "val", "=", "datetime", ".", "fromordinal", "(", "val", ".", "toordinal", "(", ")", ")", "return", "start_of_day", "(", "val", ")", ".", "replace", "(", ...
Return a new datetime.datetime object with values that represent a start of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime
[ "Return", "a", "new", "datetime", ".", "datetime", "object", "with", "values", "that", "represent", "a", "start", "of", "a", "month", ".", ":", "param", "val", ":", "Date", "to", "...", ":", "type", "val", ":", "datetime", ".", "datetime", "|", "dateti...
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L32-L42
tomi77/python-t77-date
t77_date/datetime.py
end_of_month
def end_of_month(val): """ Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) i...
python
def end_of_month(val): """ Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime """ if type(val) == date: val = datetime.fromordinal(val.toordinal()) i...
[ "def", "end_of_month", "(", "val", ")", ":", "if", "type", "(", "val", ")", "==", "date", ":", "val", "=", "datetime", ".", "fromordinal", "(", "val", ".", "toordinal", "(", ")", ")", "if", "val", ".", "month", "==", "12", ":", "return", "start_of_...
Return a new datetime.datetime object with values that represent a end of a month. :param val: Date to ... :type val: datetime.datetime | datetime.date :rtype: datetime.datetime
[ "Return", "a", "new", "datetime", ".", "datetime", "object", "with", "values", "that", "represent", "a", "end", "of", "a", "month", ".", ":", "param", "val", ":", "Date", "to", "...", ":", "type", "val", ":", "datetime", ".", "datetime", "|", "datetime...
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L45-L60
tomi77/python-t77-date
t77_date/datetime.py
set_next_week_day
def set_next_week_day(val, week_day, iso=False): """ Set week day. New date will be greater or equal than input date. :param val: datetime or date :type val: datetime.datetime | datetime.date :param week_day: Week day to set :type week_day: int :param iso: week_day in ISO format, or not ...
python
def set_next_week_day(val, week_day, iso=False): """ Set week day. New date will be greater or equal than input date. :param val: datetime or date :type val: datetime.datetime | datetime.date :param week_day: Week day to set :type week_day: int :param iso: week_day in ISO format, or not ...
[ "def", "set_next_week_day", "(", "val", ",", "week_day", ",", "iso", "=", "False", ")", ":", "return", "_set_week_day", "(", "val", ",", "week_day", ",", "val", ".", "isoweekday", "(", ")", "if", "iso", "else", "val", ".", "weekday", "(", ")", ",", "...
Set week day. New date will be greater or equal than input date. :param val: datetime or date :type val: datetime.datetime | datetime.date :param week_day: Week day to set :type week_day: int :param iso: week_day in ISO format, or not :type iso: bool :return: datetime.datetime | datetime...
[ "Set", "week", "day", ".", "New", "date", "will", "be", "greater", "or", "equal", "than", "input", "date", ".", ":", "param", "val", ":", "datetime", "or", "date", ":", "type", "val", ":", "datetime", ".", "datetime", "|", "datetime", ".", "date", ":...
train
https://github.com/tomi77/python-t77-date/blob/b4b12ce6a02884fb62460f6b9068e7fa28979fce/t77_date/datetime.py#L74-L87
ch3pjw/junction
jcn/terminal.py
_override_sugar
def _override_sugar(func): '''Use this decorator to override an attribute that is specified in blessings' sugar dict with your own function that adds some additional functionality. ''' attr_name = func.__name__ @property @wraps(func) def func_that_uses_terminal_sugar(self): func(...
python
def _override_sugar(func): '''Use this decorator to override an attribute that is specified in blessings' sugar dict with your own function that adds some additional functionality. ''' attr_name = func.__name__ @property @wraps(func) def func_that_uses_terminal_sugar(self): func(...
[ "def", "_override_sugar", "(", "func", ")", ":", "attr_name", "=", "func", ".", "__name__", "@", "property", "@", "wraps", "(", "func", ")", "def", "func_that_uses_terminal_sugar", "(", "self", ")", ":", "func", "(", "self", ")", "return", "self", ".", "...
Use this decorator to override an attribute that is specified in blessings' sugar dict with your own function that adds some additional functionality.
[ "Use", "this", "decorator", "to", "override", "an", "attribute", "that", "is", "specified", "in", "blessings", "sugar", "dict", "with", "your", "own", "function", "that", "adds", "some", "additional", "functionality", "." ]
train
https://github.com/ch3pjw/junction/blob/7d0c4d279589bee8ae7b3ac4dee2ab425c0b1b0e/jcn/terminal.py#L27-L38
ch3pjw/junction
jcn/terminal.py
Terminal.unbuffered_input
def unbuffered_input(self): '''Context manager for setting the terminal to use unbuffered input. Normally, your terminal will collect together a user's input keystrokes and deliver them to you in one neat parcel when they hit the return/enter key. In a real-time interactive application ...
python
def unbuffered_input(self): '''Context manager for setting the terminal to use unbuffered input. Normally, your terminal will collect together a user's input keystrokes and deliver them to you in one neat parcel when they hit the return/enter key. In a real-time interactive application ...
[ "def", "unbuffered_input", "(", "self", ")", ":", "if", "self", ".", "is_a_tty", ":", "orig_tty_attrs", "=", "termios", ".", "tcgetattr", "(", "self", ".", "stream", ")", "tty", ".", "setcbreak", "(", "self", ".", "stream", ")", "try", ":", "yield", "f...
Context manager for setting the terminal to use unbuffered input. Normally, your terminal will collect together a user's input keystrokes and deliver them to you in one neat parcel when they hit the return/enter key. In a real-time interactive application we instead want to receive each...
[ "Context", "manager", "for", "setting", "the", "terminal", "to", "use", "unbuffered", "input", "." ]
train
https://github.com/ch3pjw/junction/blob/7d0c4d279589bee8ae7b3ac4dee2ab425c0b1b0e/jcn/terminal.py#L156-L183
ch3pjw/junction
jcn/terminal.py
Terminal.nonblocking_input
def nonblocking_input(self): '''Context manager to set the :class:`Terminal`'s input file to read in a non-blocking way. Normally, reading from :attr:`sys.stdin` blocks, which is bad if we want an interactive application that can also update information on the screen without any...
python
def nonblocking_input(self): '''Context manager to set the :class:`Terminal`'s input file to read in a non-blocking way. Normally, reading from :attr:`sys.stdin` blocks, which is bad if we want an interactive application that can also update information on the screen without any...
[ "def", "nonblocking_input", "(", "self", ")", ":", "# FIXME: do we handle restoring this during SIGTSTP?", "if", "hasattr", "(", "self", ".", "infile", ",", "'fileno'", ")", ":", "# Use fcntl to set stdin to non-blocking. WARNING - this is not", "# particularly portable!", "fla...
Context manager to set the :class:`Terminal`'s input file to read in a non-blocking way. Normally, reading from :attr:`sys.stdin` blocks, which is bad if we want an interactive application that can also update information on the screen without any input from the user! Therefore, we need...
[ "Context", "manager", "to", "set", "the", ":", "class", ":", "Terminal", "s", "input", "file", "to", "read", "in", "a", "non", "-", "blocking", "way", "." ]
train
https://github.com/ch3pjw/junction/blob/7d0c4d279589bee8ae7b3ac4dee2ab425c0b1b0e/jcn/terminal.py#L186-L210
ch3pjw/junction
jcn/terminal.py
Terminal.draw_lines
def draw_lines(self, lines, x=0, y=0): '''Write a collection of lines to the terminal stream at the given location. The lines are written as one 'block' (i.e. each new line starts one line down from the previous, but each starts *at the given x coordinate*). :parameter lines: An...
python
def draw_lines(self, lines, x=0, y=0): '''Write a collection of lines to the terminal stream at the given location. The lines are written as one 'block' (i.e. each new line starts one line down from the previous, but each starts *at the given x coordinate*). :parameter lines: An...
[ "def", "draw_lines", "(", "self", ",", "lines", ",", "x", "=", "0", ",", "y", "=", "0", ")", ":", "for", "y", ",", "line", "in", "enumerate", "(", "lines", ",", "start", "=", "y", ")", ":", "self", ".", "stream", ".", "write", "(", "self", "....
Write a collection of lines to the terminal stream at the given location. The lines are written as one 'block' (i.e. each new line starts one line down from the previous, but each starts *at the given x coordinate*). :parameter lines: An iterable of strings that should be written to the...
[ "Write", "a", "collection", "of", "lines", "to", "the", "terminal", "stream", "at", "the", "given", "location", ".", "The", "lines", "are", "written", "as", "one", "block", "(", "i", ".", "e", ".", "each", "new", "line", "starts", "one", "line", "down"...
train
https://github.com/ch3pjw/junction/blob/7d0c4d279589bee8ae7b3ac4dee2ab425c0b1b0e/jcn/terminal.py#L212-L229
SkyLothar/shcmd
shcmd/proc.py
Proc.raise_for_error
def raise_for_error(self): """ raise `ShCmdError` if the proc's return_code is not 0 otherwise return self ..Usage:: >>> proc = shcmd.run("ls").raise_for_error() >>> proc.return_code == 0 True """ if self.ok: return self ...
python
def raise_for_error(self): """ raise `ShCmdError` if the proc's return_code is not 0 otherwise return self ..Usage:: >>> proc = shcmd.run("ls").raise_for_error() >>> proc.return_code == 0 True """ if self.ok: return self ...
[ "def", "raise_for_error", "(", "self", ")", ":", "if", "self", ".", "ok", ":", "return", "self", "tip", "=", "\"running {0} @<{1}> error, return code {2}\"", ".", "format", "(", "\" \"", ".", "join", "(", "self", ".", "cmd", ")", ",", "self", ".", "cwd", ...
raise `ShCmdError` if the proc's return_code is not 0 otherwise return self ..Usage:: >>> proc = shcmd.run("ls").raise_for_error() >>> proc.return_code == 0 True
[ "raise", "ShCmdError", "if", "the", "proc", "s", "return_code", "is", "not", "0", "otherwise", "return", "self" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/proc.py#L128-L148
SkyLothar/shcmd
shcmd/proc.py
Proc._stream
def _stream(self): """execute subprocess with timeout Usage:: >>> with cmd_proc.run_with_timeout() as cmd_proc: ... stdout, stderr = cmd_proc.communicate() ... >>> assert cmd_proc.proc.return_code == 0, "proc exec failed" """ timer =...
python
def _stream(self): """execute subprocess with timeout Usage:: >>> with cmd_proc.run_with_timeout() as cmd_proc: ... stdout, stderr = cmd_proc.communicate() ... >>> assert cmd_proc.proc.return_code == 0, "proc exec failed" """ timer =...
[ "def", "_stream", "(", "self", ")", ":", "timer", "=", "None", "try", ":", "proc", "=", "subprocess", ".", "Popen", "(", "self", ".", "cmd", ",", "cwd", "=", "self", ".", "cwd", ",", "env", "=", "self", ".", "env", ",", "stdout", "=", "subprocess...
execute subprocess with timeout Usage:: >>> with cmd_proc.run_with_timeout() as cmd_proc: ... stdout, stderr = cmd_proc.communicate() ... >>> assert cmd_proc.proc.return_code == 0, "proc exec failed"
[ "execute", "subprocess", "with", "timeout" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/proc.py#L151-L177
SkyLothar/shcmd
shcmd/proc.py
Proc.iter_lines
def iter_lines(self, warn_only=False): """yields stdout text, line by line.""" remain = "" for data in self.iter_content(LINE_CHUNK_SIZE, warn_only=True): line_break_found = data[-1] in (b"\n", b"\r") lines = data.decode(self.codec).splitlines() lines[0] = rem...
python
def iter_lines(self, warn_only=False): """yields stdout text, line by line.""" remain = "" for data in self.iter_content(LINE_CHUNK_SIZE, warn_only=True): line_break_found = data[-1] in (b"\n", b"\r") lines = data.decode(self.codec).splitlines() lines[0] = rem...
[ "def", "iter_lines", "(", "self", ",", "warn_only", "=", "False", ")", ":", "remain", "=", "\"\"", "for", "data", "in", "self", ".", "iter_content", "(", "LINE_CHUNK_SIZE", ",", "warn_only", "=", "True", ")", ":", "line_break_found", "=", "data", "[", "-...
yields stdout text, line by line.
[ "yields", "stdout", "text", "line", "by", "line", "." ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/proc.py#L179-L195
SkyLothar/shcmd
shcmd/proc.py
Proc.iter_content
def iter_content(self, chunk_size=1, warn_only=False): """ yields stdout data, chunk by chunk :param chunk_size: size of each chunk (in bytes) """ self._state = "not finished" if self.return_code is not None: stdout = io.BytesIO(self._stdout) data...
python
def iter_content(self, chunk_size=1, warn_only=False): """ yields stdout data, chunk by chunk :param chunk_size: size of each chunk (in bytes) """ self._state = "not finished" if self.return_code is not None: stdout = io.BytesIO(self._stdout) data...
[ "def", "iter_content", "(", "self", ",", "chunk_size", "=", "1", ",", "warn_only", "=", "False", ")", ":", "self", ".", "_state", "=", "\"not finished\"", "if", "self", ".", "return_code", "is", "not", "None", ":", "stdout", "=", "io", ".", "BytesIO", ...
yields stdout data, chunk by chunk :param chunk_size: size of each chunk (in bytes)
[ "yields", "stdout", "data", "chunk", "by", "chunk" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/proc.py#L197-L238
SkyLothar/shcmd
shcmd/proc.py
Proc.block
def block(self, warn_only=False): """blocked executation.""" self._state = "not finished" if self._return_code is None: proc = subprocess.Popen( self.cmd, cwd=self.cwd, env=self.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE ...
python
def block(self, warn_only=False): """blocked executation.""" self._state = "not finished" if self._return_code is None: proc = subprocess.Popen( self.cmd, cwd=self.cwd, env=self.env, stdout=subprocess.PIPE, stderr=subprocess.PIPE ...
[ "def", "block", "(", "self", ",", "warn_only", "=", "False", ")", ":", "self", ".", "_state", "=", "\"not finished\"", "if", "self", ".", "_return_code", "is", "None", ":", "proc", "=", "subprocess", ".", "Popen", "(", "self", ".", "cmd", ",", "cwd", ...
blocked executation.
[ "blocked", "executation", "." ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/proc.py#L240-L254
SkyLothar/shcmd
shcmd/__init__.py
run
def run(cmd, cwd=None, env=None, timeout=None, stream=False, warn_only=False): """ :param cmd: command to run :param cwd: change dir into before execute, default is current dir :param env: environments to pass to subprocess :param timeout: timeout :param stream: stream output, default is False, ...
python
def run(cmd, cwd=None, env=None, timeout=None, stream=False, warn_only=False): """ :param cmd: command to run :param cwd: change dir into before execute, default is current dir :param env: environments to pass to subprocess :param timeout: timeout :param stream: stream output, default is False, ...
[ "def", "run", "(", "cmd", ",", "cwd", "=", "None", ",", "env", "=", "None", ",", "timeout", "=", "None", ",", "stream", "=", "False", ",", "warn_only", "=", "False", ")", ":", "proc", "=", "Proc", "(", "expand_args", "(", "cmd", ")", ",", "os", ...
:param cmd: command to run :param cwd: change dir into before execute, default is current dir :param env: environments to pass to subprocess :param timeout: timeout :param stream: stream output, default is False, block until finished :param warn_only: default False, set to True to allow unsuccessful...
[ ":", "param", "cmd", ":", "command", "to", "run", ":", "param", "cwd", ":", "change", "dir", "into", "before", "execute", "default", "is", "current", "dir", ":", "param", "env", ":", "environments", "to", "pass", "to", "subprocess", ":", "param", "timeou...
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/__init__.py#L31-L49
etcher-be/emiz
emiz/avwx/summary.py
metar
def metar(trans: MetarTrans) -> str: """ Condense the translation strings into a single report summary string """ summary = [] if trans.wind: summary.append('Winds ' + trans.wind) if trans.visibility: summary.append('Vis ' + trans.visibility[:trans.visibility.find(' (')].lower())...
python
def metar(trans: MetarTrans) -> str: """ Condense the translation strings into a single report summary string """ summary = [] if trans.wind: summary.append('Winds ' + trans.wind) if trans.visibility: summary.append('Vis ' + trans.visibility[:trans.visibility.find(' (')].lower())...
[ "def", "metar", "(", "trans", ":", "MetarTrans", ")", "->", "str", ":", "summary", "=", "[", "]", "if", "trans", ".", "wind", ":", "summary", ".", "append", "(", "'Winds '", "+", "trans", ".", "wind", ")", "if", "trans", ".", "visibility", ":", "su...
Condense the translation strings into a single report summary string
[ "Condense", "the", "translation", "strings", "into", "a", "single", "report", "summary", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/summary.py#L9-L28
etcher-be/emiz
emiz/avwx/summary.py
taf
def taf(trans: TafLineTrans) -> str: """ Condense the translation strings into a single forecast summary string """ summary = [] if trans.wind: summary.append('Winds ' + trans.wind) if trans.visibility: summary.append('Vis ' + trans.visibility[:trans.visibility.find(' (')].lower(...
python
def taf(trans: TafLineTrans) -> str: """ Condense the translation strings into a single forecast summary string """ summary = [] if trans.wind: summary.append('Winds ' + trans.wind) if trans.visibility: summary.append('Vis ' + trans.visibility[:trans.visibility.find(' (')].lower(...
[ "def", "taf", "(", "trans", ":", "TafLineTrans", ")", "->", "str", ":", "summary", "=", "[", "]", "if", "trans", ".", "wind", ":", "summary", ".", "append", "(", "'Winds '", "+", "trans", ".", "wind", ")", "if", "trans", ".", "visibility", ":", "su...
Condense the translation strings into a single forecast summary string
[ "Condense", "the", "translation", "strings", "into", "a", "single", "forecast", "summary", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/summary.py#L31-L52
radjkarl/fancyTools
fancytools/stats/findBestDistribution.py
findBestDistribution
def findBestDistribution(data, disttype='continuous'): """ find best statistical distribution,see: http://docs.scipy.org/doc/scipy-0.14.0/reference/stats.html currently only continuous distributions embedded returns scipy.stats[DIST], fitparams """ if disttype != 'continuous': rai...
python
def findBestDistribution(data, disttype='continuous'): """ find best statistical distribution,see: http://docs.scipy.org/doc/scipy-0.14.0/reference/stats.html currently only continuous distributions embedded returns scipy.stats[DIST], fitparams """ if disttype != 'continuous': rai...
[ "def", "findBestDistribution", "(", "data", ",", "disttype", "=", "'continuous'", ")", ":", "if", "disttype", "!=", "'continuous'", ":", "raise", "NotImplemented", "(", ")", "distributions", "=", "[", "st", ".", "alpha", ",", "st", ".", "anglit", ",", "st"...
find best statistical distribution,see: http://docs.scipy.org/doc/scipy-0.14.0/reference/stats.html currently only continuous distributions embedded returns scipy.stats[DIST], fitparams
[ "find", "best", "statistical", "distribution", "see", ":", "http", ":", "//", "docs", ".", "scipy", ".", "org", "/", "doc", "/", "scipy", "-", "0", ".", "14", ".", "0", "/", "reference", "/", "stats", ".", "html" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/stats/findBestDistribution.py#L11-L75
ella/django-markup
djangomarkup/views.py
transform
def transform(request, syntax_processor_name=None, var_name="text"): """ Returns rendered HTML for source text """ if request.method != 'POST': return HttpResponseNotAllowed("Only POST allowed") source = request.POST.get(var_name) if not source: return HttpResponse('') proc...
python
def transform(request, syntax_processor_name=None, var_name="text"): """ Returns rendered HTML for source text """ if request.method != 'POST': return HttpResponseNotAllowed("Only POST allowed") source = request.POST.get(var_name) if not source: return HttpResponse('') proc...
[ "def", "transform", "(", "request", ",", "syntax_processor_name", "=", "None", ",", "var_name", "=", "\"text\"", ")", ":", "if", "request", ".", "method", "!=", "'POST'", ":", "return", "HttpResponseNotAllowed", "(", "\"Only POST allowed\"", ")", "source", "=", ...
Returns rendered HTML for source text
[ "Returns", "rendered", "HTML", "for", "source", "text" ]
train
https://github.com/ella/django-markup/blob/45b4b60bc44f38f0a05b54173318951e951ca7ce/djangomarkup/views.py#L12-L33
sassoo/goldman
goldman/utils/model_helpers.py
rtype_to_model
def rtype_to_model(rtype): """ Return a model class object given a string resource type :param rtype: string resource type :return: model class object :raise: ValueError """ models = goldman.config.MODELS for model in models: if rtype.lower() == model.RTYPE....
python
def rtype_to_model(rtype): """ Return a model class object given a string resource type :param rtype: string resource type :return: model class object :raise: ValueError """ models = goldman.config.MODELS for model in models: if rtype.lower() == model.RTYPE....
[ "def", "rtype_to_model", "(", "rtype", ")", ":", "models", "=", "goldman", ".", "config", ".", "MODELS", "for", "model", "in", "models", ":", "if", "rtype", ".", "lower", "(", ")", "==", "model", ".", "RTYPE", ".", "lower", "(", ")", ":", "return", ...
Return a model class object given a string resource type :param rtype: string resource type :return: model class object :raise: ValueError
[ "Return", "a", "model", "class", "object", "given", "a", "string", "resource", "type" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/utils/model_helpers.py#L14-L29
dcramer/piplint
src/piplint/__init__.py
check_requirements
def check_requirements(requirement_files, strict=False, error_on_extras=False, verbose=False, venv=None, do_colour=False): """ Given a list of requirements files, checks them against the installed packages in the currentl environment. If any are missing, or do not fit within the v...
python
def check_requirements(requirement_files, strict=False, error_on_extras=False, verbose=False, venv=None, do_colour=False): """ Given a list of requirements files, checks them against the installed packages in the currentl environment. If any are missing, or do not fit within the v...
[ "def", "check_requirements", "(", "requirement_files", ",", "strict", "=", "False", ",", "error_on_extras", "=", "False", ",", "verbose", "=", "False", ",", "venv", "=", "None", ",", "do_colour", "=", "False", ")", ":", "colour", "=", "TextColours", "(", "...
Given a list of requirements files, checks them against the installed packages in the currentl environment. If any are missing, or do not fit within the version bounds, exits with a code of 1 and outputs information about the missing dependency.
[ "Given", "a", "list", "of", "requirements", "files", "checks", "them", "against", "the", "installed", "packages", "in", "the", "currentl", "environment", ".", "If", "any", "are", "missing", "or", "do", "not", "fit", "within", "the", "version", "bounds", "exi...
train
https://github.com/dcramer/piplint/blob/134b90f4c5adbeb1de73a8e507503d4b7544f6d2/src/piplint/__init__.py#L39-L204
collectiveacuity/labPack
labpack/speech/aws/polly.py
pollyClient.synthesize
def synthesize(self, message_text, voice_id='Nicole', output_format='mp3', sample_rate='22050', stream_response=False): ''' a method to synthesize speech from text :param message_text: string with text to synthesize :param voice_id: string with name of voice id in A...
python
def synthesize(self, message_text, voice_id='Nicole', output_format='mp3', sample_rate='22050', stream_response=False): ''' a method to synthesize speech from text :param message_text: string with text to synthesize :param voice_id: string with name of voice id in A...
[ "def", "synthesize", "(", "self", ",", "message_text", ",", "voice_id", "=", "'Nicole'", ",", "output_format", "=", "'mp3'", ",", "sample_rate", "=", "'22050'", ",", "stream_response", "=", "False", ")", ":", "title", "=", "'%s.synthesize'", "%", "self", "."...
a method to synthesize speech from text :param message_text: string with text to synthesize :param voice_id: string with name of voice id in AWS polly to use :param output_format: string with file type of audio output :param sample_rate: string with the audio frequency speci...
[ "a", "method", "to", "synthesize", "speech", "from", "text", ":", "param", "message_text", ":", "string", "with", "text", "to", "synthesize", ":", "param", "voice_id", ":", "string", "with", "name", "of", "voice", "id", "in", "AWS", "polly", "to", "use", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/aws/polly.py#L73-L152
walkermatt/spitslurp
spitslurp/__init__.py
spit
def spit(path, txt, encoding='UTF-8', append=False): """ Write a unicode string `txt` to file `path`. By default encoded as UTF-8 and truncates the file prior to writing Parameters ---------- path : str File path to file on disk txt : unicode Text content to write to file ...
python
def spit(path, txt, encoding='UTF-8', append=False): """ Write a unicode string `txt` to file `path`. By default encoded as UTF-8 and truncates the file prior to writing Parameters ---------- path : str File path to file on disk txt : unicode Text content to write to file ...
[ "def", "spit", "(", "path", ",", "txt", ",", "encoding", "=", "'UTF-8'", ",", "append", "=", "False", ")", ":", "mode", "=", "'a'", "if", "append", "else", "'w'", "with", "io", ".", "open", "(", "path", ",", "mode", ",", "encoding", "=", "encoding"...
Write a unicode string `txt` to file `path`. By default encoded as UTF-8 and truncates the file prior to writing Parameters ---------- path : str File path to file on disk txt : unicode Text content to write to file encoding : str, default `UTF-8`, optional Encoding of...
[ "Write", "a", "unicode", "string", "txt", "to", "file", "path", "." ]
train
https://github.com/walkermatt/spitslurp/blob/8216400c59696b1ee0d708cc6e21a7a016966270/spitslurp/__init__.py#L4-L30
walkermatt/spitslurp
spitslurp/__init__.py
slurp
def slurp(path, encoding='UTF-8'): """ Reads file `path` and returns the entire contents as a unicode string By default assumes the file is encoded as UTF-8 Parameters ---------- path : str File path to file on disk encoding : str, default `UTF-8`, optional Encoding of the ...
python
def slurp(path, encoding='UTF-8'): """ Reads file `path` and returns the entire contents as a unicode string By default assumes the file is encoded as UTF-8 Parameters ---------- path : str File path to file on disk encoding : str, default `UTF-8`, optional Encoding of the ...
[ "def", "slurp", "(", "path", ",", "encoding", "=", "'UTF-8'", ")", ":", "with", "io", ".", "open", "(", "path", ",", "'r'", ",", "encoding", "=", "encoding", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
Reads file `path` and returns the entire contents as a unicode string By default assumes the file is encoded as UTF-8 Parameters ---------- path : str File path to file on disk encoding : str, default `UTF-8`, optional Encoding of the file Returns ------- The txt read...
[ "Reads", "file", "path", "and", "returns", "the", "entire", "contents", "as", "a", "unicode", "string" ]
train
https://github.com/walkermatt/spitslurp/blob/8216400c59696b1ee0d708cc6e21a7a016966270/spitslurp/__init__.py#L33-L52
callowayproject/Transmogrify
transmogrify/utils.py
download_url
def download_url(url, destination): """ Download an external URL to the destination """ from settings import VALID_IMAGE_EXTENSIONS base_name, ext = os.path.splitext(url) ext = ext.lstrip('.') if ext not in VALID_IMAGE_EXTENSIONS: raise Exception("Invalid image extension") base...
python
def download_url(url, destination): """ Download an external URL to the destination """ from settings import VALID_IMAGE_EXTENSIONS base_name, ext = os.path.splitext(url) ext = ext.lstrip('.') if ext not in VALID_IMAGE_EXTENSIONS: raise Exception("Invalid image extension") base...
[ "def", "download_url", "(", "url", ",", "destination", ")", ":", "from", "settings", "import", "VALID_IMAGE_EXTENSIONS", "base_name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "url", ")", "ext", "=", "ext", ".", "lstrip", "(", "'.'", ")",...
Download an external URL to the destination
[ "Download", "an", "external", "URL", "to", "the", "destination" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L47-L60
callowayproject/Transmogrify
transmogrify/utils.py
create_securityhash
def create_securityhash(action_tuples): """ Create a SHA1 hash based on the KEY and action string """ from settings import SECRET_KEY action_string = "".join(["_%s%s" % a for a in action_tuples]) security_hash = sha1(action_string + SECRET_KEY).hexdigest() return security_hash
python
def create_securityhash(action_tuples): """ Create a SHA1 hash based on the KEY and action string """ from settings import SECRET_KEY action_string = "".join(["_%s%s" % a for a in action_tuples]) security_hash = sha1(action_string + SECRET_KEY).hexdigest() return security_hash
[ "def", "create_securityhash", "(", "action_tuples", ")", ":", "from", "settings", "import", "SECRET_KEY", "action_string", "=", "\"\"", ".", "join", "(", "[", "\"_%s%s\"", "%", "a", "for", "a", "in", "action_tuples", "]", ")", "security_hash", "=", "sha1", "...
Create a SHA1 hash based on the KEY and action string
[ "Create", "a", "SHA1", "hash", "based", "on", "the", "KEY", "and", "action", "string" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L70-L78
callowayproject/Transmogrify
transmogrify/utils.py
resolve_request_path
def resolve_request_path(requested_uri): """ Check for any aliases and alter the path accordingly. Returns resolved_uri """ from settings import PATH_ALIASES for key, val in PATH_ALIASES.items(): if re.match(key, requested_uri): return re.sub(key, val, requested_uri) re...
python
def resolve_request_path(requested_uri): """ Check for any aliases and alter the path accordingly. Returns resolved_uri """ from settings import PATH_ALIASES for key, val in PATH_ALIASES.items(): if re.match(key, requested_uri): return re.sub(key, val, requested_uri) re...
[ "def", "resolve_request_path", "(", "requested_uri", ")", ":", "from", "settings", "import", "PATH_ALIASES", "for", "key", ",", "val", "in", "PATH_ALIASES", ".", "items", "(", ")", ":", "if", "re", ".", "match", "(", "key", ",", "requested_uri", ")", ":", ...
Check for any aliases and alter the path accordingly. Returns resolved_uri
[ "Check", "for", "any", "aliases", "and", "alter", "the", "path", "accordingly", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L110-L121
callowayproject/Transmogrify
transmogrify/utils.py
process_url
def process_url(url, server_name="", document_root=None, check_security=True): """ Goes through the url and returns a dictionary of fields. For example: img/photos/2008/05/12/WIZARDS_0034_05022035_r329x151.jpg?e315d4515574cec417b1845392ba687dd98c17ce actions: [('r', '329x151')] parent_d...
python
def process_url(url, server_name="", document_root=None, check_security=True): """ Goes through the url and returns a dictionary of fields. For example: img/photos/2008/05/12/WIZARDS_0034_05022035_r329x151.jpg?e315d4515574cec417b1845392ba687dd98c17ce actions: [('r', '329x151')] parent_d...
[ "def", "process_url", "(", "url", ",", "server_name", "=", "\"\"", ",", "document_root", "=", "None", ",", "check_security", "=", "True", ")", ":", "from", ".", "network", "import", "Http404", "from", "settings", "import", "(", "BASE_PATH", ",", "ORIG_BASE_P...
Goes through the url and returns a dictionary of fields. For example: img/photos/2008/05/12/WIZARDS_0034_05022035_r329x151.jpg?e315d4515574cec417b1845392ba687dd98c17ce actions: [('r', '329x151')] parent_dir: img/photos/2008/05/12/ ext: jpg base_filename: WIZARDS_0034_050220...
[ "Goes", "through", "the", "url", "and", "returns", "a", "dictionary", "of", "fields", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L147-L249
callowayproject/Transmogrify
transmogrify/utils.py
get_cached_files
def get_cached_files(url, server_name="", document_root=None): """ Given a URL, return a list of paths of all cached variations of that file. Doesn't include the original file. """ import glob url_info = process_url(url, server_name, document_root, check_security=False) # get path to cache...
python
def get_cached_files(url, server_name="", document_root=None): """ Given a URL, return a list of paths of all cached variations of that file. Doesn't include the original file. """ import glob url_info = process_url(url, server_name, document_root, check_security=False) # get path to cache...
[ "def", "get_cached_files", "(", "url", ",", "server_name", "=", "\"\"", ",", "document_root", "=", "None", ")", ":", "import", "glob", "url_info", "=", "process_url", "(", "url", ",", "server_name", ",", "document_root", ",", "check_security", "=", "False", ...
Given a URL, return a list of paths of all cached variations of that file. Doesn't include the original file.
[ "Given", "a", "URL", "return", "a", "list", "of", "paths", "of", "all", "cached", "variations", "of", "that", "file", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/utils.py#L252-L264
espenak/djangosenchatools
djangosenchatools/buildserver.py
BuildServerThread.run
def run(self): """ Sets up the live server and databases, and then loops over handling http requests. """ server_address = (self.host, self.port) threading = True if threading: httpd_cls = type('WSGIServer', (ThreadingMixIn, WSGIServer), {}) el...
python
def run(self): """ Sets up the live server and databases, and then loops over handling http requests. """ server_address = (self.host, self.port) threading = True if threading: httpd_cls = type('WSGIServer', (ThreadingMixIn, WSGIServer), {}) el...
[ "def", "run", "(", "self", ")", ":", "server_address", "=", "(", "self", ".", "host", ",", "self", ".", "port", ")", "threading", "=", "True", "if", "threading", ":", "httpd_cls", "=", "type", "(", "'WSGIServer'", ",", "(", "ThreadingMixIn", ",", "WSGI...
Sets up the live server and databases, and then loops over handling http requests.
[ "Sets", "up", "the", "live", "server", "and", "databases", "and", "then", "loops", "over", "handling", "http", "requests", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/buildserver.py#L23-L38
twidi/py-dataql
dataql/parsers/base.py
BaseParser.visit
def visit(self, node): """Rewrite original method to use lower-case method, and not "generic" function.""" try: # Get the "visit_%s" method, using the lower case version of the rule. method = getattr(self, 'visit_%s' % node.expr_name.lower()) except AttributeError: ...
python
def visit(self, node): """Rewrite original method to use lower-case method, and not "generic" function.""" try: # Get the "visit_%s" method, using the lower case version of the rule. method = getattr(self, 'visit_%s' % node.expr_name.lower()) except AttributeError: ...
[ "def", "visit", "(", "self", ",", "node", ")", ":", "try", ":", "# Get the \"visit_%s\" method, using the lower case version of the rule.", "method", "=", "getattr", "(", "self", ",", "'visit_%s'", "%", "node", ".", "expr_name", ".", "lower", "(", ")", ")", "exc...
Rewrite original method to use lower-case method, and not "generic" function.
[ "Rewrite", "original", "method", "to", "use", "lower", "-", "case", "method", "and", "not", "generic", "function", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/base.py#L271-L295
twidi/py-dataql
dataql/parsers/base.py
BaseParser.visit_oper
def visit_oper(self, node, _): """Return an operator as a string. Currently only "=" and ":" (both synonyms) Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The operator as a string. ...
python
def visit_oper(self, node, _): """Return an operator as a string. Currently only "=" and ":" (both synonyms) Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The operator as a string. ...
[ "def", "visit_oper", "(", "self", ",", "node", ",", "_", ")", ":", "oper", "=", "node", ".", "text", "if", "oper", "==", "':'", ":", "oper", "=", "'='", "return", "oper" ]
Return an operator as a string. Currently only "=" and ":" (both synonyms) Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The operator as a string. Example ------- >>> BaseP...
[ "Return", "an", "operator", "as", "a", "string", ".", "Currently", "only", "=", "and", ":", "(", "both", "synonyms", ")" ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/base.py#L343-L369
twidi/py-dataql
dataql/parsers/base.py
BaseParser.visit_str
def visit_str(self, node, _): """Regex rule for quoted string allowing escaped quotes inside. Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The wanted string, with quoted characters unquoted...
python
def visit_str(self, node, _): """Regex rule for quoted string allowing escaped quotes inside. Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The wanted string, with quoted characters unquoted...
[ "def", "visit_str", "(", "self", ",", "node", ",", "_", ")", ":", "# remove surrounding quotes and remove single backslashes", "return", "self", ".", "visit_str", ".", "re_single_backslash", ".", "sub", "(", "''", ",", "node", ".", "text", "[", "1", ":", "-", ...
Regex rule for quoted string allowing escaped quotes inside. Arguments --------- node : parsimonious.nodes.Node. _ (children) : list, unused Result ------ str The wanted string, with quoted characters unquoted. Example ------- ...
[ "Regex", "rule", "for", "quoted", "string", "allowing", "escaped", "quotes", "inside", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/parsers/base.py#L406-L444
nefarioustim/parker
parker/fileops.py
dump_string_to_file
def dump_string_to_file(string, filepath): """Dump @string as a line to @filepath.""" create_dirs( os.path.dirname(filepath) ) with open(filepath, 'a') as outfile: outfile.write(string) outfile.write('\n')
python
def dump_string_to_file(string, filepath): """Dump @string as a line to @filepath.""" create_dirs( os.path.dirname(filepath) ) with open(filepath, 'a') as outfile: outfile.write(string) outfile.write('\n')
[ "def", "dump_string_to_file", "(", "string", ",", "filepath", ")", ":", "create_dirs", "(", "os", ".", "path", ".", "dirname", "(", "filepath", ")", ")", "with", "open", "(", "filepath", ",", "'a'", ")", "as", "outfile", ":", "outfile", ".", "write", "...
Dump @string as a line to @filepath.
[ "Dump" ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/fileops.py#L32-L40
nefarioustim/parker
parker/fileops.py
dump_dict_to_file
def dump_dict_to_file(dictionary, filepath): """Dump @dictionary as a line to @filepath.""" create_dirs( os.path.dirname(filepath) ) with open(filepath, 'a') as outfile: json.dump(dictionary, outfile) outfile.write('\n')
python
def dump_dict_to_file(dictionary, filepath): """Dump @dictionary as a line to @filepath.""" create_dirs( os.path.dirname(filepath) ) with open(filepath, 'a') as outfile: json.dump(dictionary, outfile) outfile.write('\n')
[ "def", "dump_dict_to_file", "(", "dictionary", ",", "filepath", ")", ":", "create_dirs", "(", "os", ".", "path", ".", "dirname", "(", "filepath", ")", ")", "with", "open", "(", "filepath", ",", "'a'", ")", "as", "outfile", ":", "json", ".", "dump", "("...
Dump @dictionary as a line to @filepath.
[ "Dump" ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/fileops.py#L43-L51
nefarioustim/parker
parker/fileops.py
get_chunk_path_from_string
def get_chunk_path_from_string(string, chunk=3): """Return a chunked path from string.""" return os.path.join( *list(generate_chunks( string, chunk )) )
python
def get_chunk_path_from_string(string, chunk=3): """Return a chunked path from string.""" return os.path.join( *list(generate_chunks( string, chunk )) )
[ "def", "get_chunk_path_from_string", "(", "string", ",", "chunk", "=", "3", ")", ":", "return", "os", ".", "path", ".", "join", "(", "*", "list", "(", "generate_chunks", "(", "string", ",", "chunk", ")", ")", ")" ]
Return a chunked path from string.
[ "Return", "a", "chunked", "path", "from", "string", "." ]
train
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/fileops.py#L60-L67
RonenNess/Fileter
fileter/sources/folder_source.py
FolderSource.next
def next(self): """ Return all files in folder. """ # get depth of starting root directory base_depth = self.__root.count(os.path.sep) # walk files and folders for root, subFolders, files in os.walk(self.__root): # apply folder filter if ...
python
def next(self): """ Return all files in folder. """ # get depth of starting root directory base_depth = self.__root.count(os.path.sep) # walk files and folders for root, subFolders, files in os.walk(self.__root): # apply folder filter if ...
[ "def", "next", "(", "self", ")", ":", "# get depth of starting root directory", "base_depth", "=", "self", ".", "__root", ".", "count", "(", "os", ".", "path", ".", "sep", ")", "# walk files and folders", "for", "root", ",", "subFolders", ",", "files", "in", ...
Return all files in folder.
[ "Return", "all", "files", "in", "folder", "." ]
train
https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/sources/folder_source.py#L41-L71
quasipedia/swaggery
examples/vetinari/vetinari.py
Clock.ticks
def ticks( cls, request, length: (Ptypes.path, Integer('Duration of the stream, in seconds.')), style: (Ptypes.path, String('Tick style.', enum=['compact', 'extended'])) ) -> [ (200, 'Ok', TickStream), (400, 'Invalid parameters') ]: '''...
python
def ticks( cls, request, length: (Ptypes.path, Integer('Duration of the stream, in seconds.')), style: (Ptypes.path, String('Tick style.', enum=['compact', 'extended'])) ) -> [ (200, 'Ok', TickStream), (400, 'Invalid parameters') ]: '''...
[ "def", "ticks", "(", "cls", ",", "request", ",", "length", ":", "(", "Ptypes", ".", "path", ",", "Integer", "(", "'Duration of the stream, in seconds.'", ")", ")", ",", "style", ":", "(", "Ptypes", ".", "path", ",", "String", "(", "'Tick style.'", ",", "...
A streaming Lord Vetinari clock...
[ "A", "streaming", "Lord", "Vetinari", "clock", "..." ]
train
https://github.com/quasipedia/swaggery/blob/89a2e1b2bebbc511c781c9e63972f65aef73cc2f/examples/vetinari/vetinari.py#L39-L58
carlosp420/dataset-creator
dataset_creator/mega.py
MegaDatasetBlock.convert_blocks_to_string
def convert_blocks_to_string(self): """ New method, only in MegaDatasetBlock class. :return: flattened data blocks as string """ taxa_ids = [[]] * int(self.data.number_taxa) sequences = [''] * int(self.data.number_taxa) for block in self._blocks: for...
python
def convert_blocks_to_string(self): """ New method, only in MegaDatasetBlock class. :return: flattened data blocks as string """ taxa_ids = [[]] * int(self.data.number_taxa) sequences = [''] * int(self.data.number_taxa) for block in self._blocks: for...
[ "def", "convert_blocks_to_string", "(", "self", ")", ":", "taxa_ids", "=", "[", "[", "]", "]", "*", "int", "(", "self", ".", "data", ".", "number_taxa", ")", "sequences", "=", "[", "''", "]", "*", "int", "(", "self", ".", "data", ".", "number_taxa", ...
New method, only in MegaDatasetBlock class. :return: flattened data blocks as string
[ "New", "method", "only", "in", "MegaDatasetBlock", "class", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/mega.py#L10-L35
etcher-be/emiz
emiz/avwx/metar.py
parse
def parse(station: str, txt: str) -> (MetarData, Units): # type: ignore """ Returns MetarData and Units dataclasses with parsed data and their associated units """ core.valid_station(station) return parse_na(txt) if core.uses_na_format(station[:2]) else parse_in(txt)
python
def parse(station: str, txt: str) -> (MetarData, Units): # type: ignore """ Returns MetarData and Units dataclasses with parsed data and their associated units """ core.valid_station(station) return parse_na(txt) if core.uses_na_format(station[:2]) else parse_in(txt)
[ "def", "parse", "(", "station", ":", "str", ",", "txt", ":", "str", ")", "->", "(", "MetarData", ",", "Units", ")", ":", "# type: ignore", "core", ".", "valid_station", "(", "station", ")", "return", "parse_na", "(", "txt", ")", "if", "core", ".", "u...
Returns MetarData and Units dataclasses with parsed data and their associated units
[ "Returns", "MetarData", "and", "Units", "dataclasses", "with", "parsed", "data", "and", "their", "associated", "units" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/metar.py#L23-L28
etcher-be/emiz
emiz/avwx/metar.py
parse_na
def parse_na(txt: str) -> (MetarData, Units): # type: ignore """ Parser for the North American METAR variant """ units = Units(**NA_UNITS) # type: ignore clean = core.sanitize_report_string(txt) wxresp = {'raw': txt, 'sanitized': clean} wxdata, wxresp['remarks'] = core.get_remarks(clean) ...
python
def parse_na(txt: str) -> (MetarData, Units): # type: ignore """ Parser for the North American METAR variant """ units = Units(**NA_UNITS) # type: ignore clean = core.sanitize_report_string(txt) wxresp = {'raw': txt, 'sanitized': clean} wxdata, wxresp['remarks'] = core.get_remarks(clean) ...
[ "def", "parse_na", "(", "txt", ":", "str", ")", "->", "(", "MetarData", ",", "Units", ")", ":", "# type: ignore", "units", "=", "Units", "(", "*", "*", "NA_UNITS", ")", "# type: ignore", "clean", "=", "core", ".", "sanitize_report_string", "(", "txt", ")...
Parser for the North American METAR variant
[ "Parser", "for", "the", "North", "American", "METAR", "variant" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/metar.py#L31-L51
GemHQ/round-py
round/wrappers.py
MFAable.with_mfa
def with_mfa(self, mfa_token): """Set the MFA token for the next request. `mfa_token`s are only good for one request. Use this method to chain into the protected action you want to perform. Note: Only useful for Application authentication. Usage: account.with_mfa(appli...
python
def with_mfa(self, mfa_token): """Set the MFA token for the next request. `mfa_token`s are only good for one request. Use this method to chain into the protected action you want to perform. Note: Only useful for Application authentication. Usage: account.with_mfa(appli...
[ "def", "with_mfa", "(", "self", ",", "mfa_token", ")", ":", "if", "hasattr", "(", "mfa_token", ",", "'__call__'", ")", ":", "# callable() is unsupported by 3.1 and 3.2", "self", ".", "context", ".", "mfa_token", "=", "mfa_token", ".", "__call__", "(", ")", "el...
Set the MFA token for the next request. `mfa_token`s are only good for one request. Use this method to chain into the protected action you want to perform. Note: Only useful for Application authentication. Usage: account.with_mfa(application.totp.now()).pay(...) Args:...
[ "Set", "the", "MFA", "token", "for", "the", "next", "request", ".", "mfa_token", "s", "are", "only", "good", "for", "one", "request", ".", "Use", "this", "method", "to", "chain", "into", "the", "protected", "action", "you", "want", "to", "perform", "." ]
train
https://github.com/GemHQ/round-py/blob/d0838f849cd260b1eb5df67ed3c6f2fe56c91c21/round/wrappers.py#L37-L57
seanodonnell/django_mce_spellcheck
django_mce_spellcheck/views.py
spellcheck
def spellcheck(request): """ Returns a HttpResponse that implements the TinyMCE spellchecker protocol. """ try: raw = request.raw_post_data input = json.loads(raw) id = input['id'] method = input['method'] params = input['params'] lang = params[0] arg = pa...
python
def spellcheck(request): """ Returns a HttpResponse that implements the TinyMCE spellchecker protocol. """ try: raw = request.raw_post_data input = json.loads(raw) id = input['id'] method = input['method'] params = input['params'] lang = params[0] arg = pa...
[ "def", "spellcheck", "(", "request", ")", ":", "try", ":", "raw", "=", "request", ".", "raw_post_data", "input", "=", "json", ".", "loads", "(", "raw", ")", "id", "=", "input", "[", "'id'", "]", "method", "=", "input", "[", "'method'", "]", "params",...
Returns a HttpResponse that implements the TinyMCE spellchecker protocol.
[ "Returns", "a", "HttpResponse", "that", "implements", "the", "TinyMCE", "spellchecker", "protocol", "." ]
train
https://github.com/seanodonnell/django_mce_spellcheck/blob/8c54f4b343db4034c6b6dfc5ed57ff57d901cf2c/django_mce_spellcheck/views.py#L8-L40
cmutel/constructive_geometries
constructive_geometries/geomatcher.py
resolved_row
def resolved_row(objs, geomatcher): """Temporarily insert ``RoW`` into ``geomatcher.topology``, defined by the topo faces not used in ``objs``. Will overwrite any existing ``RoW``. On exiting the context manager, ``RoW`` is deleted.""" def get_locations(lst): for elem in lst: try: ...
python
def resolved_row(objs, geomatcher): """Temporarily insert ``RoW`` into ``geomatcher.topology``, defined by the topo faces not used in ``objs``. Will overwrite any existing ``RoW``. On exiting the context manager, ``RoW`` is deleted.""" def get_locations(lst): for elem in lst: try: ...
[ "def", "resolved_row", "(", "objs", ",", "geomatcher", ")", ":", "def", "get_locations", "(", "lst", ")", ":", "for", "elem", "in", "lst", ":", "try", ":", "yield", "elem", "[", "'location'", "]", "except", "TypeError", ":", "yield", "elem", "geomatcher"...
Temporarily insert ``RoW`` into ``geomatcher.topology``, defined by the topo faces not used in ``objs``. Will overwrite any existing ``RoW``. On exiting the context manager, ``RoW`` is deleted.
[ "Temporarily", "insert", "RoW", "into", "geomatcher", ".", "topology", "defined", "by", "the", "topo", "faces", "not", "used", "in", "objs", "." ]
train
https://github.com/cmutel/constructive_geometries/blob/d38d7e8d5bf943a6499f3000004f1953af5970de/constructive_geometries/geomatcher.py#L260-L280