id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
241,500
diffeo/yakonfig
yakonfig/toplevel.py
_recurse_config
def _recurse_config(parent_config, modules, f, prefix=''): '''Walk through the module tree. This is a helper function for :func:`create_config_tree` and :func:`_walk_config`. It calls `f` once for each module in the configuration tree with parameters `parent_config`, `config_name`, `prefix`, and `...
python
def _recurse_config(parent_config, modules, f, prefix=''): '''Walk through the module tree. This is a helper function for :func:`create_config_tree` and :func:`_walk_config`. It calls `f` once for each module in the configuration tree with parameters `parent_config`, `config_name`, `prefix`, and `...
[ "def", "_recurse_config", "(", "parent_config", ",", "modules", ",", "f", ",", "prefix", "=", "''", ")", ":", "for", "module", "in", "modules", ":", "config_name", "=", "getattr", "(", "module", ",", "'config_name'", ",", "None", ")", "if", "config_name", ...
Walk through the module tree. This is a helper function for :func:`create_config_tree` and :func:`_walk_config`. It calls `f` once for each module in the configuration tree with parameters `parent_config`, `config_name`, `prefix`, and `module`. `parent_config[config_name]` may or may not exist (b...
[ "Walk", "through", "the", "module", "tree", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L262-L300
241,501
diffeo/yakonfig
yakonfig/toplevel.py
create_config_tree
def create_config_tree(config, modules, prefix=''): '''Cause every possible configuration sub-dictionary to exist. This is intended to be called very early in the configuration sequence. For each module, it checks that the corresponding configuration item exists in `config` and creates it as an empty ...
python
def create_config_tree(config, modules, prefix=''): '''Cause every possible configuration sub-dictionary to exist. This is intended to be called very early in the configuration sequence. For each module, it checks that the corresponding configuration item exists in `config` and creates it as an empty ...
[ "def", "create_config_tree", "(", "config", ",", "modules", ",", "prefix", "=", "''", ")", ":", "def", "work_in", "(", "parent_config", ",", "config_name", ",", "prefix", ",", "module", ")", ":", "if", "config_name", "not", "in", "parent_config", ":", "# t...
Cause every possible configuration sub-dictionary to exist. This is intended to be called very early in the configuration sequence. For each module, it checks that the corresponding configuration item exists in `config` and creates it as an empty dictionary if required, and then recurses into child ...
[ "Cause", "every", "possible", "configuration", "sub", "-", "dictionary", "to", "exist", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L303-L332
241,502
diffeo/yakonfig
yakonfig/toplevel.py
_walk_config
def _walk_config(config, modules, f, prefix=''): """Recursively walk through a module list. For every module, calls ``f(config, module, name)`` where `config` is the configuration scoped to that module, `module` is the Configurable-like object, and `name` is the complete path (ending in the module ...
python
def _walk_config(config, modules, f, prefix=''): """Recursively walk through a module list. For every module, calls ``f(config, module, name)`` where `config` is the configuration scoped to that module, `module` is the Configurable-like object, and `name` is the complete path (ending in the module ...
[ "def", "_walk_config", "(", "config", ",", "modules", ",", "f", ",", "prefix", "=", "''", ")", ":", "def", "work_in", "(", "parent_config", ",", "config_name", ",", "prefix", ",", "module", ")", ":", "# create_config_tree() needs to have been called by now", "# ...
Recursively walk through a module list. For every module, calls ``f(config, module, name)`` where `config` is the configuration scoped to that module, `module` is the Configurable-like object, and `name` is the complete path (ending in the module name). :param dict config: configuration to walk an...
[ "Recursively", "walk", "through", "a", "module", "list", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L335-L364
241,503
diffeo/yakonfig
yakonfig/toplevel.py
collect_add_argparse
def collect_add_argparse(parser, modules): """Add all command-line options. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This calls :meth:`~yakonfig.configurable.Configurable.add_arguments` (if present) on all of them to set t...
python
def collect_add_argparse(parser, modules): """Add all command-line options. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This calls :meth:`~yakonfig.configurable.Configurable.add_arguments` (if present) on all of them to set t...
[ "def", "collect_add_argparse", "(", "parser", ",", "modules", ")", ":", "def", "work_in", "(", "parent_config", ",", "config_name", ",", "prefix", ",", "module", ")", ":", "f", "=", "getattr", "(", "module", ",", "'add_arguments'", ",", "None", ")", "if", ...
Add all command-line options. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This calls :meth:`~yakonfig.configurable.Configurable.add_arguments` (if present) on all of them to set the global command-line arguments. :param argp...
[ "Add", "all", "command", "-", "line", "options", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L367-L386
241,504
diffeo/yakonfig
yakonfig/toplevel.py
assemble_default_config
def assemble_default_config(modules): """Build the default configuration from a set of modules. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This produces the default configuration from that list of modules. :param modules: ...
python
def assemble_default_config(modules): """Build the default configuration from a set of modules. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This produces the default configuration from that list of modules. :param modules: ...
[ "def", "assemble_default_config", "(", "modules", ")", ":", "def", "work_in", "(", "parent_config", ",", "config_name", ",", "prefix", ",", "module", ")", ":", "my_config", "=", "dict", "(", "getattr", "(", "module", ",", "'default_config'", ",", "{", "}", ...
Build the default configuration from a set of modules. `modules` is an iterable of :class:`yakonfig.configurable.Configurable` objects, or anything equivalently typed. This produces the default configuration from that list of modules. :param modules: modules or Configurable instances to use :...
[ "Build", "the", "default", "configuration", "from", "a", "set", "of", "modules", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L389-L411
241,505
diffeo/yakonfig
yakonfig/toplevel.py
fill_in_arguments
def fill_in_arguments(config, modules, args): """Fill in configuration fields from command-line arguments. `config` is a dictionary holding the initial configuration, probably the result of :func:`assemble_default_config`. It reads through `modules`, and for each, fills in any configuration values ...
python
def fill_in_arguments(config, modules, args): """Fill in configuration fields from command-line arguments. `config` is a dictionary holding the initial configuration, probably the result of :func:`assemble_default_config`. It reads through `modules`, and for each, fills in any configuration values ...
[ "def", "fill_in_arguments", "(", "config", ",", "modules", ",", "args", ")", ":", "def", "work_in", "(", "config", ",", "module", ",", "name", ")", ":", "rkeys", "=", "getattr", "(", "module", ",", "'runtime_keys'", ",", "{", "}", ")", "for", "(", "a...
Fill in configuration fields from command-line arguments. `config` is a dictionary holding the initial configuration, probably the result of :func:`assemble_default_config`. It reads through `modules`, and for each, fills in any configuration values that are provided in `args`. `config` is modifi...
[ "Fill", "in", "configuration", "fields", "from", "command", "-", "line", "arguments", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L414-L441
241,506
diffeo/yakonfig
yakonfig/toplevel.py
do_config_discovery
def do_config_discovery(config, modules): '''Let modules detect additional configuration values. `config` is the initial dictionary with command-line and file-derived values, but nothing else, filled in. This calls :meth:`yakonfig.configurable.Configurable.discover_config` on every configuration m...
python
def do_config_discovery(config, modules): '''Let modules detect additional configuration values. `config` is the initial dictionary with command-line and file-derived values, but nothing else, filled in. This calls :meth:`yakonfig.configurable.Configurable.discover_config` on every configuration m...
[ "def", "do_config_discovery", "(", "config", ",", "modules", ")", ":", "def", "work_in", "(", "config", ",", "module", ",", "name", ")", ":", "f", "=", "getattr", "(", "module", ",", "'discover_config'", ",", "None", ")", "if", "f", ":", "f", "(", "c...
Let modules detect additional configuration values. `config` is the initial dictionary with command-line and file-derived values, but nothing else, filled in. This calls :meth:`yakonfig.configurable.Configurable.discover_config` on every configuration module. It is expect that this method will mo...
[ "Let", "modules", "detect", "additional", "configuration", "values", "." ]
412e195da29b4f4fc7b72967c192714a6f5eaeb5
https://github.com/diffeo/yakonfig/blob/412e195da29b4f4fc7b72967c192714a6f5eaeb5/yakonfig/toplevel.py#L444-L463
241,507
kejbaly2/idid
idid/cli.py
main
def main(arguments=None, config=None): """ Parse arguments for ``idid`` command. Pass optional parameter ``arguments`` as either command line string or list of options. This is mainly useful for testing. ``config`` can be passed in as a path or string to access user defined values for importan...
python
def main(arguments=None, config=None): """ Parse arguments for ``idid`` command. Pass optional parameter ``arguments`` as either command line string or list of options. This is mainly useful for testing. ``config`` can be passed in as a path or string to access user defined values for importan...
[ "def", "main", "(", "arguments", "=", "None", ",", "config", "=", "None", ")", ":", "# Parse options, initialize gathered stats", "options", "=", "LoggOptions", "(", "arguments", "=", "arguments", ")", ".", "parse", "(", ")", "# FIXME: pass in only config; set confi...
Parse arguments for ``idid`` command. Pass optional parameter ``arguments`` as either command line string or list of options. This is mainly useful for testing. ``config`` can be passed in as a path or string to access user defined values for important variables manually. YAML only. Returns the s...
[ "Parse", "arguments", "for", "idid", "command", "." ]
0f19e9ca9c8fa4a81e95c490dfbbc1b452c7451c
https://github.com/kejbaly2/idid/blob/0f19e9ca9c8fa4a81e95c490dfbbc1b452c7451c/idid/cli.py#L241-L263
241,508
kejbaly2/idid
idid/cli.py
LoggOptions._parse
def _parse(self, opts, args): """ Perform additional check for ``idid`` command arguments """ k_args = len(args) _dt = opts.date = None logg = opts.logg = None journal = opts.journal = None default_journal = self.config.get('default_journal') _journals = self.con...
python
def _parse(self, opts, args): """ Perform additional check for ``idid`` command arguments """ k_args = len(args) _dt = opts.date = None logg = opts.logg = None journal = opts.journal = None default_journal = self.config.get('default_journal') _journals = self.con...
[ "def", "_parse", "(", "self", ",", "opts", ",", "args", ")", ":", "k_args", "=", "len", "(", "args", ")", "_dt", "=", "opts", ".", "date", "=", "None", "logg", "=", "opts", ".", "logg", "=", "None", "journal", "=", "opts", ".", "journal", "=", ...
Perform additional check for ``idid`` command arguments
[ "Perform", "additional", "check", "for", "idid", "command", "arguments" ]
0f19e9ca9c8fa4a81e95c490dfbbc1b452c7451c
https://github.com/kejbaly2/idid/blob/0f19e9ca9c8fa4a81e95c490dfbbc1b452c7451c/idid/cli.py#L129-L233
241,509
jonathansick/paperweight
paperweight/texutils.py
find_root_tex_document
def find_root_tex_document(base_dir="."): """Find the tex article in the current directory that can be considered a root. We do this by searching contents for ``'\documentclass'``. Parameters ---------- base_dir : str Directory to search for LaTeX documents, relative to the current ...
python
def find_root_tex_document(base_dir="."): """Find the tex article in the current directory that can be considered a root. We do this by searching contents for ``'\documentclass'``. Parameters ---------- base_dir : str Directory to search for LaTeX documents, relative to the current ...
[ "def", "find_root_tex_document", "(", "base_dir", "=", "\".\"", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "__name__", ")", "for", "tex_path", "in", "iter_tex_documents", "(", "base_dir", "=", "base_dir", ")", ":", "with", "codecs", ".", "open",...
Find the tex article in the current directory that can be considered a root. We do this by searching contents for ``'\documentclass'``. Parameters ---------- base_dir : str Directory to search for LaTeX documents, relative to the current working directory. Returns ------- t...
[ "Find", "the", "tex", "article", "in", "the", "current", "directory", "that", "can", "be", "considered", "a", "root", ".", "We", "do", "this", "by", "searching", "contents", "for", "\\", "documentclass", "." ]
803535b939a56d375967cefecd5fdca81323041e
https://github.com/jonathansick/paperweight/blob/803535b939a56d375967cefecd5fdca81323041e/paperweight/texutils.py#L30-L54
241,510
jonathansick/paperweight
paperweight/texutils.py
iter_tex_documents
def iter_tex_documents(base_dir="."): """Iterate through all .tex documents in the current directory.""" for path, dirlist, filelist in os.walk(base_dir): for name in fnmatch.filter(filelist, "*.tex"): yield os.path.join(path, name)
python
def iter_tex_documents(base_dir="."): """Iterate through all .tex documents in the current directory.""" for path, dirlist, filelist in os.walk(base_dir): for name in fnmatch.filter(filelist, "*.tex"): yield os.path.join(path, name)
[ "def", "iter_tex_documents", "(", "base_dir", "=", "\".\"", ")", ":", "for", "path", ",", "dirlist", ",", "filelist", "in", "os", ".", "walk", "(", "base_dir", ")", ":", "for", "name", "in", "fnmatch", ".", "filter", "(", "filelist", ",", "\"*.tex\"", ...
Iterate through all .tex documents in the current directory.
[ "Iterate", "through", "all", ".", "tex", "documents", "in", "the", "current", "directory", "." ]
803535b939a56d375967cefecd5fdca81323041e
https://github.com/jonathansick/paperweight/blob/803535b939a56d375967cefecd5fdca81323041e/paperweight/texutils.py#L57-L61
241,511
jonathansick/paperweight
paperweight/texutils.py
inline
def inline(root_text, base_dir="", replacer=None, ifexists_replacer=None): """Inline all input latex files. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- root_txt : unicode Text to process (...
python
def inline(root_text, base_dir="", replacer=None, ifexists_replacer=None): """Inline all input latex files. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- root_txt : unicode Text to process (...
[ "def", "inline", "(", "root_text", ",", "base_dir", "=", "\"\"", ",", "replacer", "=", "None", ",", "ifexists_replacer", "=", "None", ")", ":", "def", "_sub_line", "(", "match", ")", ":", "\"\"\"Function to be used with re.sub to inline files for each match.\"\"\"", ...
Inline all input latex files. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- root_txt : unicode Text to process (and include in-lined files). base_dir : str Base directory of file containing ``root_text``. Defaults t...
[ "Inline", "all", "input", "latex", "files", "." ]
803535b939a56d375967cefecd5fdca81323041e
https://github.com/jonathansick/paperweight/blob/803535b939a56d375967cefecd5fdca81323041e/paperweight/texutils.py#L89-L164
241,512
jonathansick/paperweight
paperweight/texutils.py
inline_blob
def inline_blob(commit_ref, root_text, base_dir='.', repo_dir=""): """Inline all input latex files that exist as git blobs in a tree object. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- commit_ref : str String identifying ...
python
def inline_blob(commit_ref, root_text, base_dir='.', repo_dir=""): """Inline all input latex files that exist as git blobs in a tree object. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- commit_ref : str String identifying ...
[ "def", "inline_blob", "(", "commit_ref", ",", "root_text", ",", "base_dir", "=", "'.'", ",", "repo_dir", "=", "\"\"", ")", ":", "def", "_sub_blob", "(", "match", ")", ":", "\"\"\"Function to be used with re.sub to inline files for each match.\"\"\"", "fname", "=", "...
Inline all input latex files that exist as git blobs in a tree object. The inlining is accomplished recursively. All files are opened as UTF-8 unicode files. Parameters ---------- commit_ref : str String identifying a git commit/tag. root_text : unicode Text of tex document whe...
[ "Inline", "all", "input", "latex", "files", "that", "exist", "as", "git", "blobs", "in", "a", "tree", "object", "." ]
803535b939a56d375967cefecd5fdca81323041e
https://github.com/jonathansick/paperweight/blob/803535b939a56d375967cefecd5fdca81323041e/paperweight/texutils.py#L167-L246
241,513
codingjester/pycitibike
pycitibike/__init__.py
Citibike._get
def _get(self, uri, options): """ Quick and dirty wrapper around the requests object to do some simple data catching :params uri: a string, the uri you want to request :params options: a dict, the list of parameters you want to use """ url = "http://%s/%s" % (sel...
python
def _get(self, uri, options): """ Quick and dirty wrapper around the requests object to do some simple data catching :params uri: a string, the uri you want to request :params options: a dict, the list of parameters you want to use """ url = "http://%s/%s" % (sel...
[ "def", "_get", "(", "self", ",", "uri", ",", "options", ")", ":", "url", "=", "\"http://%s/%s\"", "%", "(", "self", ".", "host", ",", "uri", ")", "r", "=", "requests", ".", "get", "(", "url", ",", "params", "=", "options", ")", "if", "r", ".", ...
Quick and dirty wrapper around the requests object to do some simple data catching :params uri: a string, the uri you want to request :params options: a dict, the list of parameters you want to use
[ "Quick", "and", "dirty", "wrapper", "around", "the", "requests", "object", "to", "do", "some", "simple", "data", "catching" ]
740a6f9da60a1e0ff97a9c61ae4469ec2e207443
https://github.com/codingjester/pycitibike/blob/740a6f9da60a1e0ff97a9c61ae4469ec2e207443/pycitibike/__init__.py#L39-L54
241,514
shreyaspotnis/rampage
rampage/widgets/MainWindow.py
MainWindow.setWindowTitle
def setWindowTitle(self, newTitle=''): """Prepend Rampage to all window titles.""" title = 'Rampage - ' + newTitle super(MainWindow, self).setWindowTitle(title)
python
def setWindowTitle(self, newTitle=''): """Prepend Rampage to all window titles.""" title = 'Rampage - ' + newTitle super(MainWindow, self).setWindowTitle(title)
[ "def", "setWindowTitle", "(", "self", ",", "newTitle", "=", "''", ")", ":", "title", "=", "'Rampage - '", "+", "newTitle", "super", "(", "MainWindow", ",", "self", ")", ".", "setWindowTitle", "(", "title", ")" ]
Prepend Rampage to all window titles.
[ "Prepend", "Rampage", "to", "all", "window", "titles", "." ]
e2565aef7ee16ee06523de975e8aa41aca14e3b2
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/widgets/MainWindow.py#L105-L108
241,515
Amsterdam/authorization_django
authorization_django/jwks.py
load
def load(jwks): """Parse a JWKSet and return a dictionary that maps key IDs on keys.""" sign_keys = {} verify_keys = {} try: keyset = json.loads(jwks) for key in keyset['keys']: for op in key['key_ops']: if op == 'sign': k = sign_keys ...
python
def load(jwks): """Parse a JWKSet and return a dictionary that maps key IDs on keys.""" sign_keys = {} verify_keys = {} try: keyset = json.loads(jwks) for key in keyset['keys']: for op in key['key_ops']: if op == 'sign': k = sign_keys ...
[ "def", "load", "(", "jwks", ")", ":", "sign_keys", "=", "{", "}", "verify_keys", "=", "{", "}", "try", ":", "keyset", "=", "json", ".", "loads", "(", "jwks", ")", "for", "key", "in", "keyset", "[", "'keys'", "]", ":", "for", "op", "in", "key", ...
Parse a JWKSet and return a dictionary that maps key IDs on keys.
[ "Parse", "a", "JWKSet", "and", "return", "a", "dictionary", "that", "maps", "key", "IDs", "on", "keys", "." ]
71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1
https://github.com/Amsterdam/authorization_django/blob/71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1/authorization_django/jwks.py#L21-L45
241,516
vinu76jsr/pipsort
setup.py
version
def version(): """ Get the local package version. """ path = join("lib", _CONFIG["name"], "__version__.py") with open(path) as stream: exec(stream.read()) return __version__
python
def version(): """ Get the local package version. """ path = join("lib", _CONFIG["name"], "__version__.py") with open(path) as stream: exec(stream.read()) return __version__
[ "def", "version", "(", ")", ":", "path", "=", "join", "(", "\"lib\"", ",", "_CONFIG", "[", "\"name\"", "]", ",", "\"__version__.py\"", ")", "with", "open", "(", "path", ")", "as", "stream", ":", "exec", "(", "stream", ".", "read", "(", ")", ")", "r...
Get the local package version.
[ "Get", "the", "local", "package", "version", "." ]
71ead1269de85ee0255741390bf1da85d81b7d16
https://github.com/vinu76jsr/pipsort/blob/71ead1269de85ee0255741390bf1da85d81b7d16/setup.py#L49-L56
241,517
konture/CloeePy
cloeepy/config.py
Config._set_config_path
def _set_config_path(self): """ Reads config path from environment variable CLOEEPY_CONFIG_PATH and sets as instance attr """ self._path = os.getenv("CLOEEPY_CONFIG_PATH") if self._path is None: msg = "CLOEEPY_CONFIG_PATH is not set. Exiting..." sy...
python
def _set_config_path(self): """ Reads config path from environment variable CLOEEPY_CONFIG_PATH and sets as instance attr """ self._path = os.getenv("CLOEEPY_CONFIG_PATH") if self._path is None: msg = "CLOEEPY_CONFIG_PATH is not set. Exiting..." sy...
[ "def", "_set_config_path", "(", "self", ")", ":", "self", ".", "_path", "=", "os", ".", "getenv", "(", "\"CLOEEPY_CONFIG_PATH\"", ")", "if", "self", ".", "_path", "is", "None", ":", "msg", "=", "\"CLOEEPY_CONFIG_PATH is not set. Exiting...\"", "sys", ".", "exi...
Reads config path from environment variable CLOEEPY_CONFIG_PATH and sets as instance attr
[ "Reads", "config", "path", "from", "environment", "variable", "CLOEEPY_CONFIG_PATH", "and", "sets", "as", "instance", "attr" ]
dcb21284d2df405d92ac6868ea7215792c9323b9
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/config.py#L45-L53
241,518
konture/CloeePy
cloeepy/config.py
Config._load_config
def _load_config(self): """ Loads the YAML configuration file and sets python dictionary and raw contents as instance attrs. """ if not os.path.exists(self._path): sys.exit("Config path %s does not exist" % self._path) # create empty config object self...
python
def _load_config(self): """ Loads the YAML configuration file and sets python dictionary and raw contents as instance attrs. """ if not os.path.exists(self._path): sys.exit("Config path %s does not exist" % self._path) # create empty config object self...
[ "def", "_load_config", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_path", ")", ":", "sys", ".", "exit", "(", "\"Config path %s does not exist\"", "%", "self", ".", "_path", ")", "# create empty config object", ...
Loads the YAML configuration file and sets python dictionary and raw contents as instance attrs.
[ "Loads", "the", "YAML", "configuration", "file", "and", "sets", "python", "dictionary", "and", "raw", "contents", "as", "instance", "attrs", "." ]
dcb21284d2df405d92ac6868ea7215792c9323b9
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/config.py#L56-L68
241,519
konture/CloeePy
cloeepy/config.py
Config._set_attributes
def _set_attributes(self): """ Recursively transforms config dictionaries into instance attrs to make for easy dot attribute access instead of dictionary access. """ # turn config dict into nested objects config = obj(self._config_dict) # set the attributes onto i...
python
def _set_attributes(self): """ Recursively transforms config dictionaries into instance attrs to make for easy dot attribute access instead of dictionary access. """ # turn config dict into nested objects config = obj(self._config_dict) # set the attributes onto i...
[ "def", "_set_attributes", "(", "self", ")", ":", "# turn config dict into nested objects", "config", "=", "obj", "(", "self", ".", "_config_dict", ")", "# set the attributes onto instance", "for", "k", ",", "v", "in", "self", ".", "_config_dict", ".", "items", "("...
Recursively transforms config dictionaries into instance attrs to make for easy dot attribute access instead of dictionary access.
[ "Recursively", "transforms", "config", "dictionaries", "into", "instance", "attrs", "to", "make", "for", "easy", "dot", "attribute", "access", "instead", "of", "dictionary", "access", "." ]
dcb21284d2df405d92ac6868ea7215792c9323b9
https://github.com/konture/CloeePy/blob/dcb21284d2df405d92ac6868ea7215792c9323b9/cloeepy/config.py#L83-L92
241,520
JNRowe/jnrbase
jnrbase/template.py
highlight
def highlight(__text: str, *, lexer: str = 'diff', formatter: str = 'terminal') -> str: """Highlight text highlighted using ``pygments``. Returns text untouched if colour output is not enabled. See also: :pypi:`Pygments` Args: __text: Text to highlight lexer: Jinja lexer...
python
def highlight(__text: str, *, lexer: str = 'diff', formatter: str = 'terminal') -> str: """Highlight text highlighted using ``pygments``. Returns text untouched if colour output is not enabled. See also: :pypi:`Pygments` Args: __text: Text to highlight lexer: Jinja lexer...
[ "def", "highlight", "(", "__text", ":", "str", ",", "*", ",", "lexer", ":", "str", "=", "'diff'", ",", "formatter", ":", "str", "=", "'terminal'", ")", "->", "str", ":", "if", "sys", ".", "stdout", ".", "isatty", "(", ")", ":", "lexer", "=", "get...
Highlight text highlighted using ``pygments``. Returns text untouched if colour output is not enabled. See also: :pypi:`Pygments` Args: __text: Text to highlight lexer: Jinja lexer to use formatter: Jinja formatter to use Returns: Syntax highlighted output, when possib...
[ "Highlight", "text", "highlighted", "using", "pygments", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/template.py#L77-L96
241,521
JNRowe/jnrbase
jnrbase/template.py
html2text
def html2text(__html: str, *, width: int = 80, ascii_replacements: bool = False) -> str: """HTML to plain text renderer. See also: :pypi:`html2text` Args: __html: Text to process width: Paragraph width ascii_replacements: Use pseudo-ASCII replacements for Unicode ...
python
def html2text(__html: str, *, width: int = 80, ascii_replacements: bool = False) -> str: """HTML to plain text renderer. See also: :pypi:`html2text` Args: __html: Text to process width: Paragraph width ascii_replacements: Use pseudo-ASCII replacements for Unicode ...
[ "def", "html2text", "(", "__html", ":", "str", ",", "*", ",", "width", ":", "int", "=", "80", ",", "ascii_replacements", ":", "bool", "=", "False", ")", "->", "str", ":", "html2", ".", "BODY_WIDTH", "=", "width", "html2", ".", "UNICODE_SNOB", "=", "a...
HTML to plain text renderer. See also: :pypi:`html2text` Args: __html: Text to process width: Paragraph width ascii_replacements: Use pseudo-ASCII replacements for Unicode Returns: Rendered text
[ "HTML", "to", "plain", "text", "renderer", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/template.py#L100-L115
241,522
JNRowe/jnrbase
jnrbase/template.py
regexp
def regexp(__string: str, __pattern: str, __repl: Union[Callable, str], *, count: int = 0, flags: int = 0) -> str: """Jinja filter for regexp replacements. See :func:`re.sub` for documentation. Returns: Text with substitutions applied """ return re.sub(__pattern, __repl, __strin...
python
def regexp(__string: str, __pattern: str, __repl: Union[Callable, str], *, count: int = 0, flags: int = 0) -> str: """Jinja filter for regexp replacements. See :func:`re.sub` for documentation. Returns: Text with substitutions applied """ return re.sub(__pattern, __repl, __strin...
[ "def", "regexp", "(", "__string", ":", "str", ",", "__pattern", ":", "str", ",", "__repl", ":", "Union", "[", "Callable", ",", "str", "]", ",", "*", ",", "count", ":", "int", "=", "0", ",", "flags", ":", "int", "=", "0", ")", "->", "str", ":", ...
Jinja filter for regexp replacements. See :func:`re.sub` for documentation. Returns: Text with substitutions applied
[ "Jinja", "filter", "for", "regexp", "replacements", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/template.py#L119-L128
241,523
JNRowe/jnrbase
jnrbase/template.py
setup
def setup(__pkg: str) -> jinja2.Environment: """Configure a new Jinja environment with our filters. Args: __pkg: Package name to use as base for templates searches Returns: Configured Jinja environment """ dirs = [path.join(d, 'templates') for d in xdg_basedir.get_data_d...
python
def setup(__pkg: str) -> jinja2.Environment: """Configure a new Jinja environment with our filters. Args: __pkg: Package name to use as base for templates searches Returns: Configured Jinja environment """ dirs = [path.join(d, 'templates') for d in xdg_basedir.get_data_d...
[ "def", "setup", "(", "__pkg", ":", "str", ")", "->", "jinja2", ".", "Environment", ":", "dirs", "=", "[", "path", ".", "join", "(", "d", ",", "'templates'", ")", "for", "d", "in", "xdg_basedir", ".", "get_data_dirs", "(", "__pkg", ")", "]", "env", ...
Configure a new Jinja environment with our filters. Args: __pkg: Package name to use as base for templates searches Returns: Configured Jinja environment
[ "Configure", "a", "new", "Jinja", "environment", "with", "our", "filters", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/template.py#L145-L162
241,524
ArabellaTech/aa-intercom
aa_intercom/utils.py
upload_intercom_user
def upload_intercom_user(obj_id): """Creates or updates single user account on intercom""" UserModel = get_user_model() intercom_user = False instance = UserModel.objects.get(pk=obj_id) data = instance.get_intercom_data() if not getattr(settings, "SKIP_INTERCOM", False): try: ...
python
def upload_intercom_user(obj_id): """Creates or updates single user account on intercom""" UserModel = get_user_model() intercom_user = False instance = UserModel.objects.get(pk=obj_id) data = instance.get_intercom_data() if not getattr(settings, "SKIP_INTERCOM", False): try: ...
[ "def", "upload_intercom_user", "(", "obj_id", ")", ":", "UserModel", "=", "get_user_model", "(", ")", "intercom_user", "=", "False", "instance", "=", "UserModel", ".", "objects", ".", "get", "(", "pk", "=", "obj_id", ")", "data", "=", "instance", ".", "get...
Creates or updates single user account on intercom
[ "Creates", "or", "updates", "single", "user", "account", "on", "intercom" ]
f7e2ab63967529660f9c2fe4f1d0bf3cec1502c2
https://github.com/ArabellaTech/aa-intercom/blob/f7e2ab63967529660f9c2fe4f1d0bf3cec1502c2/aa_intercom/utils.py#L14-L31
241,525
edwards-lab/libGWAS
libgwas/boundary.py
BoundaryCheck.LoadExclusions
def LoadExclusions(self, snps): """ Load locus exclusions. :param snps: Can either be a list of rsids or a file containing rsids. :return: None If snps is a file, the file must only contain RSIDs separated by whitespace (tabs, spaces and return characters). """ ...
python
def LoadExclusions(self, snps): """ Load locus exclusions. :param snps: Can either be a list of rsids or a file containing rsids. :return: None If snps is a file, the file must only contain RSIDs separated by whitespace (tabs, spaces and return characters). """ ...
[ "def", "LoadExclusions", "(", "self", ",", "snps", ")", ":", "snp_names", "=", "[", "]", "if", "len", "(", "snps", ")", "==", "1", "and", "os", ".", "path", ".", "isfile", "(", "snps", "[", "0", "]", ")", ":", "snp_names", "=", "open", "(", "sn...
Load locus exclusions. :param snps: Can either be a list of rsids or a file containing rsids. :return: None If snps is a file, the file must only contain RSIDs separated by whitespace (tabs, spaces and return characters).
[ "Load", "locus", "exclusions", "." ]
d68c9a083d443dfa5d7c5112de29010909cfe23f
https://github.com/edwards-lab/libGWAS/blob/d68c9a083d443dfa5d7c5112de29010909cfe23f/libgwas/boundary.py#L97-L114
241,526
scivision/histutils
histutils/rawDMCreader.py
getserialnum
def getserialnum(flist): """ This function assumes the serial number of the camera is in a particular place in the filename. Yes, this is a little lame, but it's how the original 2011 image-writing program worked, and I've carried over the scheme rather than appending bits to dozens of TB of files. ...
python
def getserialnum(flist): """ This function assumes the serial number of the camera is in a particular place in the filename. Yes, this is a little lame, but it's how the original 2011 image-writing program worked, and I've carried over the scheme rather than appending bits to dozens of TB of files. ...
[ "def", "getserialnum", "(", "flist", ")", ":", "sn", "=", "[", "]", "for", "f", "in", "flist", ":", "tmp", "=", "search", "(", "r'(?<=CamSer)\\d{3,6}'", ",", "f", ")", "if", "tmp", ":", "ser", "=", "int", "(", "tmp", ".", "group", "(", ")", ")", ...
This function assumes the serial number of the camera is in a particular place in the filename. Yes, this is a little lame, but it's how the original 2011 image-writing program worked, and I've carried over the scheme rather than appending bits to dozens of TB of files.
[ "This", "function", "assumes", "the", "serial", "number", "of", "the", "camera", "is", "in", "a", "particular", "place", "in", "the", "filename", ".", "Yes", "this", "is", "a", "little", "lame", "but", "it", "s", "how", "the", "original", "2011", "image"...
859a91d3894cb57faed34881c6ea16130b90571e
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/rawDMCreader.py#L80-L94
241,527
scivision/histutils
histutils/rawDMCreader.py
getDMCparam
def getDMCparam(fn: Path, xyPix, xyBin, FrameIndReq=None, ut1req=None, kineticsec=None, startUTC=None, nHeadBytes=4, verbose=0): """ nHeadBytes=4 for 2013-2016 data nHeadBytes=0 for 2011 data """ Nmetadata = nHeadBytes // 2 # FIXME for DMCdata version 1 only if not fn.is_file()...
python
def getDMCparam(fn: Path, xyPix, xyBin, FrameIndReq=None, ut1req=None, kineticsec=None, startUTC=None, nHeadBytes=4, verbose=0): """ nHeadBytes=4 for 2013-2016 data nHeadBytes=0 for 2011 data """ Nmetadata = nHeadBytes // 2 # FIXME for DMCdata version 1 only if not fn.is_file()...
[ "def", "getDMCparam", "(", "fn", ":", "Path", ",", "xyPix", ",", "xyBin", ",", "FrameIndReq", "=", "None", ",", "ut1req", "=", "None", ",", "kineticsec", "=", "None", ",", "startUTC", "=", "None", ",", "nHeadBytes", "=", "4", ",", "verbose", "=", "0"...
nHeadBytes=4 for 2013-2016 data nHeadBytes=0 for 2011 data
[ "nHeadBytes", "=", "4", "for", "2013", "-", "2016", "data", "nHeadBytes", "=", "0", "for", "2011", "data" ]
859a91d3894cb57faed34881c6ea16130b90571e
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/rawDMCreader.py#L97-L126
241,528
scivision/histutils
histutils/rawDMCreader.py
whichframes
def whichframes(fn, FrameIndReq, kineticsec, ut1req, startUTC, firstRawInd, lastRawInd, BytesPerImage, BytesPerFrame, verbose): ext = Path(fn).suffix # %% get file size fileSizeBytes = fn.stat().st_size if fileSizeBytes < BytesPerImage: raise ValueError( f'File size {fil...
python
def whichframes(fn, FrameIndReq, kineticsec, ut1req, startUTC, firstRawInd, lastRawInd, BytesPerImage, BytesPerFrame, verbose): ext = Path(fn).suffix # %% get file size fileSizeBytes = fn.stat().st_size if fileSizeBytes < BytesPerImage: raise ValueError( f'File size {fil...
[ "def", "whichframes", "(", "fn", ",", "FrameIndReq", ",", "kineticsec", ",", "ut1req", ",", "startUTC", ",", "firstRawInd", ",", "lastRawInd", ",", "BytesPerImage", ",", "BytesPerFrame", ",", "verbose", ")", ":", "ext", "=", "Path", "(", "fn", ")", ".", ...
if no requested frames were specified, read all frames. Otherwise, just return the requested frames Assignments have to be "int64", not just python "int". Windows python 2.7 64-bit on files >2.1GB, the bytes will wrap
[ "if", "no", "requested", "frames", "were", "specified", "read", "all", "frames", ".", "Otherwise", "just", "return", "the", "requested", "frames", "Assignments", "have", "to", "be", "int64", "not", "just", "python", "int", ".", "Windows", "python", "2", ".",...
859a91d3894cb57faed34881c6ea16130b90571e
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/rawDMCreader.py#L208-L266
241,529
scivision/histutils
histutils/rawDMCreader.py
getDMCframe
def getDMCframe(f, iFrm: int, finf: dict, verbose: bool=False): """ f is open file handle """ # on windows, "int" is int32 and overflows at 2.1GB! We need np.int64 currByte = iFrm * finf['bytesperframe'] # %% advance to start of frame in bytes if verbose: print(f'seeking to byte {currBy...
python
def getDMCframe(f, iFrm: int, finf: dict, verbose: bool=False): """ f is open file handle """ # on windows, "int" is int32 and overflows at 2.1GB! We need np.int64 currByte = iFrm * finf['bytesperframe'] # %% advance to start of frame in bytes if verbose: print(f'seeking to byte {currBy...
[ "def", "getDMCframe", "(", "f", ",", "iFrm", ":", "int", ",", "finf", ":", "dict", ",", "verbose", ":", "bool", "=", "False", ")", ":", "# on windows, \"int\" is int32 and overflows at 2.1GB! We need np.int64", "currByte", "=", "iFrm", "*", "finf", "[", "'bytes...
f is open file handle
[ "f", "is", "open", "file", "handle" ]
859a91d3894cb57faed34881c6ea16130b90571e
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/rawDMCreader.py#L269-L299
241,530
a-tal/kezmenu3
kezmenu3/kezmenu.py
KezMenu._fixSize
def _fixSize(self): """Fix the menu size. Commonly called when the font is changed""" self.height = 0 for o in self.options: text = o['label'] font = o['font'] ren = font.render(text, 1, (0, 0, 0)) if ren.get_width() > self.width: s...
python
def _fixSize(self): """Fix the menu size. Commonly called when the font is changed""" self.height = 0 for o in self.options: text = o['label'] font = o['font'] ren = font.render(text, 1, (0, 0, 0)) if ren.get_width() > self.width: s...
[ "def", "_fixSize", "(", "self", ")", ":", "self", ".", "height", "=", "0", "for", "o", "in", "self", ".", "options", ":", "text", "=", "o", "[", "'label'", "]", "font", "=", "o", "[", "'font'", "]", "ren", "=", "font", ".", "render", "(", "text...
Fix the menu size. Commonly called when the font is changed
[ "Fix", "the", "menu", "size", ".", "Commonly", "called", "when", "the", "font", "is", "changed" ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu.py#L72-L81
241,531
a-tal/kezmenu3
kezmenu3/kezmenu.py
KezMenu.draw
def draw(self, surface): """Blit the menu to a surface.""" offset = 0 i = 0 ol, ot = self.screen_topleft_offset first = self.options and self.options[0] last = self.options and self.options[-1] for o in self.options: indent = o.get('padding_col', 0) ...
python
def draw(self, surface): """Blit the menu to a surface.""" offset = 0 i = 0 ol, ot = self.screen_topleft_offset first = self.options and self.options[0] last = self.options and self.options[-1] for o in self.options: indent = o.get('padding_col', 0) ...
[ "def", "draw", "(", "self", ",", "surface", ")", ":", "offset", "=", "0", "i", "=", "0", "ol", ",", "ot", "=", "self", ".", "screen_topleft_offset", "first", "=", "self", ".", "options", "and", "self", ".", "options", "[", "0", "]", "last", "=", ...
Blit the menu to a surface.
[ "Blit", "the", "menu", "to", "a", "surface", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu.py#L83-L117
241,532
a-tal/kezmenu3
kezmenu3/kezmenu.py
KezMenu.update
def update(self, events, time_passed=None): """Update the menu and get input for the menu. @events: the pygame catched events @time_passed: delta time since the last call """ for e in events: if e.type == pygame.QUIT: raise SystemExit if ...
python
def update(self, events, time_passed=None): """Update the menu and get input for the menu. @events: the pygame catched events @time_passed: delta time since the last call """ for e in events: if e.type == pygame.QUIT: raise SystemExit if ...
[ "def", "update", "(", "self", ",", "events", ",", "time_passed", "=", "None", ")", ":", "for", "e", "in", "events", ":", "if", "e", ".", "type", "==", "pygame", ".", "QUIT", ":", "raise", "SystemExit", "if", "e", ".", "type", "==", "pygame", ".", ...
Update the menu and get input for the menu. @events: the pygame catched events @time_passed: delta time since the last call
[ "Update", "the", "menu", "and", "get", "input", "for", "the", "menu", "." ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu.py#L119-L152
241,533
a-tal/kezmenu3
kezmenu3/kezmenu.py
KezMenu._checkMousePositionForFocus
def _checkMousePositionForFocus(self): """Check the mouse position to know if move focus on a option""" i = 0 cur_pos = pygame.mouse.get_pos() ml, mt = self.position for o in self.options: rect = o.get('label_rect') if rect: if rect.collide...
python
def _checkMousePositionForFocus(self): """Check the mouse position to know if move focus on a option""" i = 0 cur_pos = pygame.mouse.get_pos() ml, mt = self.position for o in self.options: rect = o.get('label_rect') if rect: if rect.collide...
[ "def", "_checkMousePositionForFocus", "(", "self", ")", ":", "i", "=", "0", "cur_pos", "=", "pygame", ".", "mouse", ".", "get_pos", "(", ")", "ml", ",", "mt", "=", "self", ".", "position", "for", "o", "in", "self", ".", "options", ":", "rect", "=", ...
Check the mouse position to know if move focus on a option
[ "Check", "the", "mouse", "position", "to", "know", "if", "move", "focus", "on", "a", "option" ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu.py#L154-L166
241,534
a-tal/kezmenu3
kezmenu3/kezmenu.py
KezMenu.center_at
def center_at(self, x, y): """Center the menu at x, y""" self.x = x - (self.width / 2) self.y = y - (self.height / 2)
python
def center_at(self, x, y): """Center the menu at x, y""" self.x = x - (self.width / 2) self.y = y - (self.height / 2)
[ "def", "center_at", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "x", "=", "x", "-", "(", "self", ".", "width", "/", "2", ")", "self", ".", "y", "=", "y", "-", "(", "self", ".", "height", "/", "2", ")" ]
Center the menu at x, y
[ "Center", "the", "menu", "at", "x", "y" ]
3b06f9cb67fdc98a73928f877eea86692f832fa4
https://github.com/a-tal/kezmenu3/blob/3b06f9cb67fdc98a73928f877eea86692f832fa4/kezmenu3/kezmenu.py#L189-L193
241,535
mdeous/fatbotslim
fatbotslim/irc/bot.py
run_bots
def run_bots(bots): """ Run many bots in parallel. :param bots: IRC bots to run. :type bots: list """ greenlets = [spawn(bot.run) for bot in bots] try: joinall(greenlets) except KeyboardInterrupt: for bot in bots: bot.disconnect() finally: killall...
python
def run_bots(bots): """ Run many bots in parallel. :param bots: IRC bots to run. :type bots: list """ greenlets = [spawn(bot.run) for bot in bots] try: joinall(greenlets) except KeyboardInterrupt: for bot in bots: bot.disconnect() finally: killall...
[ "def", "run_bots", "(", "bots", ")", ":", "greenlets", "=", "[", "spawn", "(", "bot", ".", "run", ")", "for", "bot", "in", "bots", "]", "try", ":", "joinall", "(", "greenlets", ")", "except", "KeyboardInterrupt", ":", "for", "bot", "in", "bots", ":",...
Run many bots in parallel. :param bots: IRC bots to run. :type bots: list
[ "Run", "many", "bots", "in", "parallel", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L417-L431
241,536
mdeous/fatbotslim
fatbotslim/irc/bot.py
Message.parse
def parse(cls, data): """ Extracts message informations from `data`. :param data: received line. :type data: unicode :return: extracted informations (source, destination, command, args). :rtype: tuple(Source, str, str, list) :raise: :class:`fatbotslim.irc.NullMes...
python
def parse(cls, data): """ Extracts message informations from `data`. :param data: received line. :type data: unicode :return: extracted informations (source, destination, command, args). :rtype: tuple(Source, str, str, list) :raise: :class:`fatbotslim.irc.NullMes...
[ "def", "parse", "(", "cls", ",", "data", ")", ":", "src", "=", "u''", "dst", "=", "None", "if", "data", "[", "0", "]", "==", "u':'", ":", "src", ",", "data", "=", "data", "[", "1", ":", "]", ".", "split", "(", "u' '", ",", "1", ")", "if", ...
Extracts message informations from `data`. :param data: received line. :type data: unicode :return: extracted informations (source, destination, command, args). :rtype: tuple(Source, str, str, list) :raise: :class:`fatbotslim.irc.NullMessage` if `data` is empty.
[ "Extracts", "message", "informations", "from", "data", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L75-L101
241,537
mdeous/fatbotslim
fatbotslim/irc/bot.py
Source.parse
def parse(cls, prefix): """ Extracts informations from `prefix`. :param prefix: prefix with format ``<servername>|<nick>['!'<user>]['@'<host>]``. :type prefix: unicode :return: extracted informations (nickname or host, mode, username, host). :rtype: tuple(str, str, str, ...
python
def parse(cls, prefix): """ Extracts informations from `prefix`. :param prefix: prefix with format ``<servername>|<nick>['!'<user>]['@'<host>]``. :type prefix: unicode :return: extracted informations (nickname or host, mode, username, host). :rtype: tuple(str, str, str, ...
[ "def", "parse", "(", "cls", ",", "prefix", ")", ":", "try", ":", "nick", ",", "rest", "=", "prefix", ".", "split", "(", "u'!'", ")", "except", "ValueError", ":", "return", "prefix", ",", "None", ",", "None", ",", "None", "try", ":", "mode", ",", ...
Extracts informations from `prefix`. :param prefix: prefix with format ``<servername>|<nick>['!'<user>]['@'<host>]``. :type prefix: unicode :return: extracted informations (nickname or host, mode, username, host). :rtype: tuple(str, str, str, str)
[ "Extracts", "informations", "from", "prefix", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L124-L145
241,538
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC._create_connection
def _create_connection(self): """ Creates a transport channel. :return: transport channel instance :rtype: :class:`fatbotslim.irc.tcp.TCP` or :class:`fatbotslim.irc.tcp.SSL` """ transport = SSL if self.ssl else TCP return transport(self.server, self.port)
python
def _create_connection(self): """ Creates a transport channel. :return: transport channel instance :rtype: :class:`fatbotslim.irc.tcp.TCP` or :class:`fatbotslim.irc.tcp.SSL` """ transport = SSL if self.ssl else TCP return transport(self.server, self.port)
[ "def", "_create_connection", "(", "self", ")", ":", "transport", "=", "SSL", "if", "self", ".", "ssl", "else", "TCP", "return", "transport", "(", "self", ".", "server", ",", "self", ".", "port", ")" ]
Creates a transport channel. :return: transport channel instance :rtype: :class:`fatbotslim.irc.tcp.TCP` or :class:`fatbotslim.irc.tcp.SSL`
[ "Creates", "a", "transport", "channel", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L188-L196
241,539
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC._connect
def _connect(self): """ Connects the bot to the server and identifies itself. """ self.conn = self._create_connection() spawn(self.conn.connect) self.set_nick(self.nick) self.cmd(u'USER', u'{0} 3 * {1}'.format(self.nick, self.realname))
python
def _connect(self): """ Connects the bot to the server and identifies itself. """ self.conn = self._create_connection() spawn(self.conn.connect) self.set_nick(self.nick) self.cmd(u'USER', u'{0} 3 * {1}'.format(self.nick, self.realname))
[ "def", "_connect", "(", "self", ")", ":", "self", ".", "conn", "=", "self", ".", "_create_connection", "(", ")", "spawn", "(", "self", ".", "conn", ".", "connect", ")", "self", ".", "set_nick", "(", "self", ".", "nick", ")", "self", ".", "cmd", "("...
Connects the bot to the server and identifies itself.
[ "Connects", "the", "bot", "to", "the", "server", "and", "identifies", "itself", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L198-L205
241,540
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC._send
def _send(self, command): """ Sends a raw line to the server. :param command: line to send. :type command: unicode """ command = command.encode('utf-8') log.debug('>> ' + command) self.conn.oqueue.put(command)
python
def _send(self, command): """ Sends a raw line to the server. :param command: line to send. :type command: unicode """ command = command.encode('utf-8') log.debug('>> ' + command) self.conn.oqueue.put(command)
[ "def", "_send", "(", "self", ",", "command", ")", ":", "command", "=", "command", ".", "encode", "(", "'utf-8'", ")", "log", ".", "debug", "(", "'>> '", "+", "command", ")", "self", ".", "conn", ".", "oqueue", ".", "put", "(", "command", ")" ]
Sends a raw line to the server. :param command: line to send. :type command: unicode
[ "Sends", "a", "raw", "line", "to", "the", "server", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L207-L216
241,541
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC._handle
def _handle(self, msg): """ Pass a received message to the registered handlers. :param msg: received message :type msg: :class:`fatbotslim.irc.Message` """ def handler_yielder(): for handler in self.handlers: yield handler def handle...
python
def _handle(self, msg): """ Pass a received message to the registered handlers. :param msg: received message :type msg: :class:`fatbotslim.irc.Message` """ def handler_yielder(): for handler in self.handlers: yield handler def handle...
[ "def", "_handle", "(", "self", ",", "msg", ")", ":", "def", "handler_yielder", "(", ")", ":", "for", "handler", "in", "self", ".", "handlers", ":", "yield", "handler", "def", "handler_callback", "(", "_", ")", ":", "if", "msg", ".", "propagate", ":", ...
Pass a received message to the registered handlers. :param msg: received message :type msg: :class:`fatbotslim.irc.Message`
[ "Pass", "a", "received", "message", "to", "the", "registered", "handlers", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L243-L276
241,542
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.randomize_nick
def randomize_nick(cls, base, suffix_length=3): """ Generates a pseudo-random nickname. :param base: prefix to use for the generated nickname. :type base: unicode :param suffix_length: amount of digits to append to `base` :type suffix_length: int :return: generat...
python
def randomize_nick(cls, base, suffix_length=3): """ Generates a pseudo-random nickname. :param base: prefix to use for the generated nickname. :type base: unicode :param suffix_length: amount of digits to append to `base` :type suffix_length: int :return: generat...
[ "def", "randomize_nick", "(", "cls", ",", "base", ",", "suffix_length", "=", "3", ")", ":", "suffix", "=", "u''", ".", "join", "(", "choice", "(", "u'0123456789'", ")", "for", "_", "in", "range", "(", "suffix_length", ")", ")", "return", "u'{0}{1}'", "...
Generates a pseudo-random nickname. :param base: prefix to use for the generated nickname. :type base: unicode :param suffix_length: amount of digits to append to `base` :type suffix_length: int :return: generated nickname. :rtype: unicode
[ "Generates", "a", "pseudo", "-", "random", "nickname", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L279-L291
241,543
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.add_handler
def add_handler(self, handler, args=None, kwargs=None): """ Registers a new handler. :param handler: handler to register. :type handler: :class:`fatbotslim.handlers.BaseHandler` :param args: positional arguments to pass to the handler's constructor. :type args: list ...
python
def add_handler(self, handler, args=None, kwargs=None): """ Registers a new handler. :param handler: handler to register. :type handler: :class:`fatbotslim.handlers.BaseHandler` :param args: positional arguments to pass to the handler's constructor. :type args: list ...
[ "def", "add_handler", "(", "self", ",", "handler", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "args", "=", "[", "]", "if", "args", "is", "None", "else", "args", "kwargs", "=", "{", "}", "if", "kwargs", "is", "None", "else", "...
Registers a new handler. :param handler: handler to register. :type handler: :class:`fatbotslim.handlers.BaseHandler` :param args: positional arguments to pass to the handler's constructor. :type args: list :param kwargs: keyword arguments to pass to the handler's constructor. ...
[ "Registers", "a", "new", "handler", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L311-L328
241,544
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.cmd
def cmd(self, command, args, prefix=None): """ Sends a command to the server. :param command: IRC code to send. :type command: unicode :param args: arguments to pass with the command. :type args: basestring :param prefix: optional prefix to prepend to the command...
python
def cmd(self, command, args, prefix=None): """ Sends a command to the server. :param command: IRC code to send. :type command: unicode :param args: arguments to pass with the command. :type args: basestring :param prefix: optional prefix to prepend to the command...
[ "def", "cmd", "(", "self", ",", "command", ",", "args", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "prefix", "=", "u''", "raw_cmd", "=", "u'{0} {1} {2}'", ".", "format", "(", "prefix", ",", "command", ",", "args", ")", ...
Sends a command to the server. :param command: IRC code to send. :type command: unicode :param args: arguments to pass with the command. :type args: basestring :param prefix: optional prefix to prepend to the command. :type prefix: str or None
[ "Sends", "a", "command", "to", "the", "server", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L330-L344
241,545
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.ctcp_reply
def ctcp_reply(self, command, dst, message=None): """ Sends a reply to a CTCP request. :param command: CTCP command to use. :type command: str :param dst: sender of the initial request. :type dst: str :param message: data to attach to the reply. :type mes...
python
def ctcp_reply(self, command, dst, message=None): """ Sends a reply to a CTCP request. :param command: CTCP command to use. :type command: str :param dst: sender of the initial request. :type dst: str :param message: data to attach to the reply. :type mes...
[ "def", "ctcp_reply", "(", "self", ",", "command", ",", "dst", ",", "message", "=", "None", ")", ":", "if", "message", "is", "None", ":", "raw_cmd", "=", "u'\\x01{0}\\x01'", ".", "format", "(", "command", ")", "else", ":", "raw_cmd", "=", "u'\\x01{0} {1}\...
Sends a reply to a CTCP request. :param command: CTCP command to use. :type command: str :param dst: sender of the initial request. :type dst: str :param message: data to attach to the reply. :type message: str
[ "Sends", "a", "reply", "to", "a", "CTCP", "request", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L346-L361
241,546
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.msg
def msg(self, target, msg): """ Sends a message to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: str """ self.cmd(u'PRIVMSG', u'{0} :{1}'.format(target, msg))
python
def msg(self, target, msg): """ Sends a message to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: str """ self.cmd(u'PRIVMSG', u'{0} :{1}'.format(target, msg))
[ "def", "msg", "(", "self", ",", "target", ",", "msg", ")", ":", "self", ".", "cmd", "(", "u'PRIVMSG'", ",", "u'{0} :{1}'", ".", "format", "(", "target", ",", "msg", ")", ")" ]
Sends a message to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: str
[ "Sends", "a", "message", "to", "an", "user", "or", "channel", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L363-L372
241,547
mdeous/fatbotslim
fatbotslim/irc/bot.py
IRC.notice
def notice(self, target, msg): """ Sends a NOTICE to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: basestring """ self.cmd(u'NOTICE', u'{0} :{1}'.format(target, msg))
python
def notice(self, target, msg): """ Sends a NOTICE to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: basestring """ self.cmd(u'NOTICE', u'{0} :{1}'.format(target, msg))
[ "def", "notice", "(", "self", ",", "target", ",", "msg", ")", ":", "self", ".", "cmd", "(", "u'NOTICE'", ",", "u'{0} :{1}'", ".", "format", "(", "target", ",", "msg", ")", ")" ]
Sends a NOTICE to an user or channel. :param target: user or channel to send to. :type target: str :param msg: message to send. :type msg: basestring
[ "Sends", "a", "NOTICE", "to", "an", "user", "or", "channel", "." ]
341595d24454a79caee23750eac271f9d0626c88
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L374-L383
241,548
csaez/wishlib
wishlib/si/utils.py
siget
def siget(fullname=""): """Returns a softimage object given its fullname.""" fullname = str(fullname) if not len(fullname): return None return sidict.GetObject(fullname, False)
python
def siget(fullname=""): """Returns a softimage object given its fullname.""" fullname = str(fullname) if not len(fullname): return None return sidict.GetObject(fullname, False)
[ "def", "siget", "(", "fullname", "=", "\"\"", ")", ":", "fullname", "=", "str", "(", "fullname", ")", "if", "not", "len", "(", "fullname", ")", ":", "return", "None", "return", "sidict", ".", "GetObject", "(", "fullname", ",", "False", ")" ]
Returns a softimage object given its fullname.
[ "Returns", "a", "softimage", "object", "given", "its", "fullname", "." ]
c212fa7875006a332a4cefbf69885ced9647bc2f
https://github.com/csaez/wishlib/blob/c212fa7875006a332a4cefbf69885ced9647bc2f/wishlib/si/utils.py#L30-L35
241,549
csaez/wishlib
wishlib/si/utils.py
cmd_wrapper
def cmd_wrapper(cmd_name, **kwds): """Wrap and execute a softimage command accepting named arguments""" cmd = si.Commands(cmd_name) if not cmd: raise Exception(cmd_name + " doesnt found!") for arg in cmd.Arguments: value = kwds.get(arg.Name) if value: arg.Value = valu...
python
def cmd_wrapper(cmd_name, **kwds): """Wrap and execute a softimage command accepting named arguments""" cmd = si.Commands(cmd_name) if not cmd: raise Exception(cmd_name + " doesnt found!") for arg in cmd.Arguments: value = kwds.get(arg.Name) if value: arg.Value = valu...
[ "def", "cmd_wrapper", "(", "cmd_name", ",", "*", "*", "kwds", ")", ":", "cmd", "=", "si", ".", "Commands", "(", "cmd_name", ")", "if", "not", "cmd", ":", "raise", "Exception", "(", "cmd_name", "+", "\" doesnt found!\"", ")", "for", "arg", "in", "cmd", ...
Wrap and execute a softimage command accepting named arguments
[ "Wrap", "and", "execute", "a", "softimage", "command", "accepting", "named", "arguments" ]
c212fa7875006a332a4cefbf69885ced9647bc2f
https://github.com/csaez/wishlib/blob/c212fa7875006a332a4cefbf69885ced9647bc2f/wishlib/si/utils.py#L38-L47
241,550
Amsterdam/authorization_django
authorization_django/middleware.py
_create_logger
def _create_logger(middleware_settings): """ Creates a logger using the given settings. """ if django_settings.DEBUG: level = logging.DEBUG formatter = logging.Formatter( middleware_settings['LOGGER_FORMAT_DEBUG']) else: level = middleware_settings['LOGGER_LEVEL'] ...
python
def _create_logger(middleware_settings): """ Creates a logger using the given settings. """ if django_settings.DEBUG: level = logging.DEBUG formatter = logging.Formatter( middleware_settings['LOGGER_FORMAT_DEBUG']) else: level = middleware_settings['LOGGER_LEVEL'] ...
[ "def", "_create_logger", "(", "middleware_settings", ")", ":", "if", "django_settings", ".", "DEBUG", ":", "level", "=", "logging", ".", "DEBUG", "formatter", "=", "logging", ".", "Formatter", "(", "middleware_settings", "[", "'LOGGER_FORMAT_DEBUG'", "]", ")", "...
Creates a logger using the given settings.
[ "Creates", "a", "logger", "using", "the", "given", "settings", "." ]
71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1
https://github.com/Amsterdam/authorization_django/blob/71da52b38a7f5a16a2bde8f8ea97b3c11ccb1be1/authorization_django/middleware.py#L15-L41
241,551
EwilDawe/typy
typy/keyboard.py
press
def press(*keys): """ Simulates a key-press for all the keys passed to the function :param keys: list of keys to be pressed :return: None """ for key in keys: win32api.keybd_event(codes[key], 0, 0, 0) release(key)
python
def press(*keys): """ Simulates a key-press for all the keys passed to the function :param keys: list of keys to be pressed :return: None """ for key in keys: win32api.keybd_event(codes[key], 0, 0, 0) release(key)
[ "def", "press", "(", "*", "keys", ")", ":", "for", "key", "in", "keys", ":", "win32api", ".", "keybd_event", "(", "codes", "[", "key", "]", ",", "0", ",", "0", ",", "0", ")", "release", "(", "key", ")" ]
Simulates a key-press for all the keys passed to the function :param keys: list of keys to be pressed :return: None
[ "Simulates", "a", "key", "-", "press", "for", "all", "the", "keys", "passed", "to", "the", "function" ]
0349e7176567a4dbef318e75d9b3d6868950a1a9
https://github.com/EwilDawe/typy/blob/0349e7176567a4dbef318e75d9b3d6868950a1a9/typy/keyboard.py#L11-L21
241,552
EwilDawe/typy
typy/keyboard.py
hold
def hold(*keys, hold_time = 0, hold_while = None): """ Simulates the holding of all the keys passed to the function These keys are held down for a default period of 0 seconds before release :param keys: list of keys to be held :param hold_time: length of time to hold keys :param hold_while: hol...
python
def hold(*keys, hold_time = 0, hold_while = None): """ Simulates the holding of all the keys passed to the function These keys are held down for a default period of 0 seconds before release :param keys: list of keys to be held :param hold_time: length of time to hold keys :param hold_while: hol...
[ "def", "hold", "(", "*", "keys", ",", "hold_time", "=", "0", ",", "hold_while", "=", "None", ")", ":", "for", "key", "in", "keys", ":", "win32api", ".", "keybd_event", "(", "codes", "[", "key", "]", ",", "0", ",", "0", ",", "0", ")", "if", "cal...
Simulates the holding of all the keys passed to the function These keys are held down for a default period of 0 seconds before release :param keys: list of keys to be held :param hold_time: length of time to hold keys :param hold_while: hold keys while hold_while returns True :return: None
[ "Simulates", "the", "holding", "of", "all", "the", "keys", "passed", "to", "the", "function", "These", "keys", "are", "held", "down", "for", "a", "default", "period", "of", "0", "seconds", "before", "release" ]
0349e7176567a4dbef318e75d9b3d6868950a1a9
https://github.com/EwilDawe/typy/blob/0349e7176567a4dbef318e75d9b3d6868950a1a9/typy/keyboard.py#L24-L42
241,553
EwilDawe/typy
typy/keyboard.py
release
def release(*keys): """ Simulates the release of all the keys passed to this function :param keys: list of keys to be released :return: None """ for key in keys: win32api.keybd_event(codes[key], 0, win32con.KEYEVENTF_KEYUP, 0)
python
def release(*keys): """ Simulates the release of all the keys passed to this function :param keys: list of keys to be released :return: None """ for key in keys: win32api.keybd_event(codes[key], 0, win32con.KEYEVENTF_KEYUP, 0)
[ "def", "release", "(", "*", "keys", ")", ":", "for", "key", "in", "keys", ":", "win32api", ".", "keybd_event", "(", "codes", "[", "key", "]", ",", "0", ",", "win32con", ".", "KEYEVENTF_KEYUP", ",", "0", ")" ]
Simulates the release of all the keys passed to this function :param keys: list of keys to be released :return: None
[ "Simulates", "the", "release", "of", "all", "the", "keys", "passed", "to", "this", "function" ]
0349e7176567a4dbef318e75d9b3d6868950a1a9
https://github.com/EwilDawe/typy/blob/0349e7176567a4dbef318e75d9b3d6868950a1a9/typy/keyboard.py#L45-L54
241,554
fr33jc/bang
bang/providers/rs.py
normalize_input_value
def normalize_input_value(value): """ Returns an input value normalized for RightScale API 2.0. This typically means adjusting the *input type* prefix to be one of the valid values:: blank ignore inherit text: env: cred: key: array: ...
python
def normalize_input_value(value): """ Returns an input value normalized for RightScale API 2.0. This typically means adjusting the *input type* prefix to be one of the valid values:: blank ignore inherit text: env: cred: key: array: ...
[ "def", "normalize_input_value", "(", "value", ")", ":", "if", "value", "in", "(", "'blank'", ",", "'ignore'", ",", "'inherit'", ")", ":", "return", "value", "# assume any unspecified or unknown types are text", "tokens", "=", "value", ".", "split", "(", "':'", "...
Returns an input value normalized for RightScale API 2.0. This typically means adjusting the *input type* prefix to be one of the valid values:: blank ignore inherit text: env: cred: key: array: This list comes from the table published here:...
[ "Returns", "an", "input", "value", "normalized", "for", "RightScale", "API", "2", ".", "0", "." ]
8f000713f88d2a9a8c1193b63ca10a6578560c16
https://github.com/fr33jc/bang/blob/8f000713f88d2a9a8c1193b63ca10a6578560c16/bang/providers/rs.py#L52-L84
241,555
fr33jc/bang
bang/providers/rs.py
Servers.create_stack
def create_stack(self, name): """ Creates stack if necessary. """ deployment = find_exact(self.api.deployments, name=name) if not deployment: try: # TODO: replace when python-rightscale handles non-json self.api.client.post( ...
python
def create_stack(self, name): """ Creates stack if necessary. """ deployment = find_exact(self.api.deployments, name=name) if not deployment: try: # TODO: replace when python-rightscale handles non-json self.api.client.post( ...
[ "def", "create_stack", "(", "self", ",", "name", ")", ":", "deployment", "=", "find_exact", "(", "self", ".", "api", ".", "deployments", ",", "name", "=", "name", ")", "if", "not", "deployment", ":", "try", ":", "# TODO: replace when python-rightscale handles ...
Creates stack if necessary.
[ "Creates", "stack", "if", "necessary", "." ]
8f000713f88d2a9a8c1193b63ca10a6578560c16
https://github.com/fr33jc/bang/blob/8f000713f88d2a9a8c1193b63ca10a6578560c16/bang/providers/rs.py#L100-L117
241,556
GMadorell/abris
abris_transform/configuration/data_model.py
DataModel.set_features_types_from_dataframe
def set_features_types_from_dataframe(self, data_frame): """ Sets the features types from the given data_frame. All the calls except the first one are ignored. """ if self.__feature_types_set: return self.__feature_types_set = True dtypes = data_frame...
python
def set_features_types_from_dataframe(self, data_frame): """ Sets the features types from the given data_frame. All the calls except the first one are ignored. """ if self.__feature_types_set: return self.__feature_types_set = True dtypes = data_frame...
[ "def", "set_features_types_from_dataframe", "(", "self", ",", "data_frame", ")", ":", "if", "self", ".", "__feature_types_set", ":", "return", "self", ".", "__feature_types_set", "=", "True", "dtypes", "=", "data_frame", ".", "dtypes", "for", "feature", "in", "s...
Sets the features types from the given data_frame. All the calls except the first one are ignored.
[ "Sets", "the", "features", "types", "from", "the", "given", "data_frame", ".", "All", "the", "calls", "except", "the", "first", "one", "are", "ignored", "." ]
0d8ab7ec506835a45fae6935d129f5d7e6937bb2
https://github.com/GMadorell/abris/blob/0d8ab7ec506835a45fae6935d129f5d7e6937bb2/abris_transform/configuration/data_model.py#L12-L25
241,557
lextoumbourou/txstripe
txstripe/util.py
handle_api_error
def handle_api_error(resp): """Stolen straight from the Stripe Python source.""" content = yield resp.json() headers = HeaderWrapper(resp.headers) try: err = content['error'] except (KeyError, TypeError): raise error.APIError( "Invalid response object from API: %r (HTTP...
python
def handle_api_error(resp): """Stolen straight from the Stripe Python source.""" content = yield resp.json() headers = HeaderWrapper(resp.headers) try: err = content['error'] except (KeyError, TypeError): raise error.APIError( "Invalid response object from API: %r (HTTP...
[ "def", "handle_api_error", "(", "resp", ")", ":", "content", "=", "yield", "resp", ".", "json", "(", ")", "headers", "=", "HeaderWrapper", "(", "resp", ".", "headers", ")", "try", ":", "err", "=", "content", "[", "'error'", "]", "except", "(", "KeyErro...
Stolen straight from the Stripe Python source.
[ "Stolen", "straight", "from", "the", "Stripe", "Python", "source", "." ]
a69e67f524258026fd1840655a0578311bba3b89
https://github.com/lextoumbourou/txstripe/blob/a69e67f524258026fd1840655a0578311bba3b89/txstripe/util.py#L11-L39
241,558
DaveMcEwan/ndim
ndim_base.py
vectors_between_pts
def vectors_between_pts(pts=[]): '''Return vectors between points on N dimensions. Last vector is the path between the first and last point, creating a loop. ''' assert isinstance(pts, list) and len(pts) > 0 l_pts = len(pts) l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) ...
python
def vectors_between_pts(pts=[]): '''Return vectors between points on N dimensions. Last vector is the path between the first and last point, creating a loop. ''' assert isinstance(pts, list) and len(pts) > 0 l_pts = len(pts) l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) ...
[ "def", "vectors_between_pts", "(", "pts", "=", "[", "]", ")", ":", "assert", "isinstance", "(", "pts", ",", "list", ")", "and", "len", "(", "pts", ")", ">", "0", "l_pts", "=", "len", "(", "pts", ")", "l_pt_prev", "=", "None", "for", "pt", "in", "...
Return vectors between points on N dimensions. Last vector is the path between the first and last point, creating a loop.
[ "Return", "vectors", "between", "points", "on", "N", "dimensions", ".", "Last", "vector", "is", "the", "path", "between", "the", "first", "and", "last", "point", "creating", "a", "loop", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L8-L26
241,559
DaveMcEwan/ndim
ndim_base.py
pt_between_pts
def pt_between_pts(a=(0.0, 0.0), b=(0.0, 0.0), t=0.5): '''Return the point between two points on N dimensions. ''' assert isinstance(a, tuple) assert isinstance(b, tuple) l_pt = len(a) assert l_pt > 1 assert l_pt == len(b) for i in a: assert isinstance(i, float) for i in b: ...
python
def pt_between_pts(a=(0.0, 0.0), b=(0.0, 0.0), t=0.5): '''Return the point between two points on N dimensions. ''' assert isinstance(a, tuple) assert isinstance(b, tuple) l_pt = len(a) assert l_pt > 1 assert l_pt == len(b) for i in a: assert isinstance(i, float) for i in b: ...
[ "def", "pt_between_pts", "(", "a", "=", "(", "0.0", ",", "0.0", ")", ",", "b", "=", "(", "0.0", ",", "0.0", ")", ",", "t", "=", "0.5", ")", ":", "assert", "isinstance", "(", "a", ",", "tuple", ")", "assert", "isinstance", "(", "b", ",", "tuple"...
Return the point between two points on N dimensions.
[ "Return", "the", "point", "between", "two", "points", "on", "N", "dimensions", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L56-L71
241,560
DaveMcEwan/ndim
ndim_base.py
pt_rotate
def pt_rotate(pt=(0.0, 0.0), angle=[0.0], center=(0.0, 0.0)): '''Return given point rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i,...
python
def pt_rotate(pt=(0.0, 0.0), angle=[0.0], center=(0.0, 0.0)): '''Return given point rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i,...
[ "def", "pt_rotate", "(", "pt", "=", "(", "0.0", ",", "0.0", ")", ",", "angle", "=", "[", "0.0", "]", ",", "center", "=", "(", "0.0", ",", "0.0", ")", ")", ":", "assert", "isinstance", "(", "pt", ",", "tuple", ")", "l_pt", "=", "len", "(", "pt...
Return given point rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis.
[ "Return", "given", "point", "rotated", "around", "a", "center", "point", "in", "N", "dimensions", ".", "Angle", "is", "list", "of", "rotation", "in", "radians", "for", "each", "pair", "of", "axis", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L145-L180
241,561
DaveMcEwan/ndim
ndim_base.py
pts_rotate
def pts_rotate(pts=[], angle=[0.0], center=(0.0, 0.0)): '''Return given points rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tu...
python
def pts_rotate(pts=[], angle=[0.0], center=(0.0, 0.0)): '''Return given points rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tu...
[ "def", "pts_rotate", "(", "pts", "=", "[", "]", ",", "angle", "=", "[", "0.0", "]", ",", "center", "=", "(", "0.0", ",", "0.0", ")", ")", ":", "assert", "isinstance", "(", "pts", ",", "list", ")", "and", "len", "(", "pts", ")", ">", "0", "l_p...
Return given points rotated around a center point in N dimensions. Angle is list of rotation in radians for each pair of axis.
[ "Return", "given", "points", "rotated", "around", "a", "center", "point", "in", "N", "dimensions", ".", "Angle", "is", "list", "of", "rotation", "in", "radians", "for", "each", "pair", "of", "axis", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L183-L209
241,562
DaveMcEwan/ndim
ndim_base.py
pt_shift
def pt_shift(pt=(0.0, 0.0), shift=[0.0, 0.0]): '''Return given point shifted in N dimensions. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i, float) assert isinstance(shift, list) l_sh = len(shift) assert l_sh == l_pt for ...
python
def pt_shift(pt=(0.0, 0.0), shift=[0.0, 0.0]): '''Return given point shifted in N dimensions. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i, float) assert isinstance(shift, list) l_sh = len(shift) assert l_sh == l_pt for ...
[ "def", "pt_shift", "(", "pt", "=", "(", "0.0", ",", "0.0", ")", ",", "shift", "=", "[", "0.0", ",", "0.0", "]", ")", ":", "assert", "isinstance", "(", "pt", ",", "tuple", ")", "l_pt", "=", "len", "(", "pt", ")", "assert", "l_pt", ">", "1", "f...
Return given point shifted in N dimensions.
[ "Return", "given", "point", "shifted", "in", "N", "dimensions", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L212-L226
241,563
DaveMcEwan/ndim
ndim_base.py
pts_shift
def pts_shift(pts=[], shift=[0.0, 0.0]): '''Return given points shifted in N dimensions. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isins...
python
def pts_shift(pts=[], shift=[0.0, 0.0]): '''Return given points shifted in N dimensions. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isins...
[ "def", "pts_shift", "(", "pts", "=", "[", "]", ",", "shift", "=", "[", "0.0", ",", "0.0", "]", ")", ":", "assert", "isinstance", "(", "pts", ",", "list", ")", "and", "len", "(", "pts", ")", ">", "0", "l_pt_prev", "=", "None", "for", "pt", "in",...
Return given points shifted in N dimensions.
[ "Return", "given", "points", "shifted", "in", "N", "dimensions", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L229-L249
241,564
DaveMcEwan/ndim
ndim_base.py
pt_scale
def pt_scale(pt=(0.0, 0.0), f=1.0): '''Return given point scaled by factor f from origin. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i, float) assert isinstance(f, float) return tuple([pt[i]*f for i in range(l_pt)])
python
def pt_scale(pt=(0.0, 0.0), f=1.0): '''Return given point scaled by factor f from origin. ''' assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstance(i, float) assert isinstance(f, float) return tuple([pt[i]*f for i in range(l_pt)])
[ "def", "pt_scale", "(", "pt", "=", "(", "0.0", ",", "0.0", ")", ",", "f", "=", "1.0", ")", ":", "assert", "isinstance", "(", "pt", ",", "tuple", ")", "l_pt", "=", "len", "(", "pt", ")", "assert", "l_pt", ">", "1", "for", "i", "in", "pt", ":",...
Return given point scaled by factor f from origin.
[ "Return", "given", "point", "scaled", "by", "factor", "f", "from", "origin", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L348-L358
241,565
DaveMcEwan/ndim
ndim_base.py
pts_scale
def pts_scale(pts=[], f=1.0): '''Return given points scaled by factor f from origin. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstanc...
python
def pts_scale(pts=[], f=1.0): '''Return given points scaled by factor f from origin. ''' assert isinstance(pts, list) and len(pts) > 0 l_pt_prev = None for pt in pts: assert isinstance(pt, tuple) l_pt = len(pt) assert l_pt > 1 for i in pt: assert isinstanc...
[ "def", "pts_scale", "(", "pts", "=", "[", "]", ",", "f", "=", "1.0", ")", ":", "assert", "isinstance", "(", "pts", ",", "list", ")", "and", "len", "(", "pts", ")", ">", "0", "l_pt_prev", "=", "None", "for", "pt", "in", "pts", ":", "assert", "is...
Return given points scaled by factor f from origin.
[ "Return", "given", "points", "scaled", "by", "factor", "f", "from", "origin", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L361-L377
241,566
DaveMcEwan/ndim
ndim_base.py
angle_diff
def angle_diff(start_a=[0.0], end_a=[0.0], direction=True): '''Return difference in angle from start_a to end_a. Direction follows the right-hand-rule so positive is counter-clockwise. ''' assert isinstance(start_a, list) assert isinstance(end_a, list) l_angle = len(start_a) assert l_angle > 0 ...
python
def angle_diff(start_a=[0.0], end_a=[0.0], direction=True): '''Return difference in angle from start_a to end_a. Direction follows the right-hand-rule so positive is counter-clockwise. ''' assert isinstance(start_a, list) assert isinstance(end_a, list) l_angle = len(start_a) assert l_angle > 0 ...
[ "def", "angle_diff", "(", "start_a", "=", "[", "0.0", "]", ",", "end_a", "=", "[", "0.0", "]", ",", "direction", "=", "True", ")", ":", "assert", "isinstance", "(", "start_a", ",", "list", ")", "assert", "isinstance", "(", "end_a", ",", "list", ")", ...
Return difference in angle from start_a to end_a. Direction follows the right-hand-rule so positive is counter-clockwise.
[ "Return", "difference", "in", "angle", "from", "start_a", "to", "end_a", ".", "Direction", "follows", "the", "right", "-", "hand", "-", "rule", "so", "positive", "is", "counter", "-", "clockwise", "." ]
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L380-L402
241,567
DaveMcEwan/ndim
ndim_base.py
gen_polygon_pts
def gen_polygon_pts(n_pts=3, radius=[1.0]): '''Generate points for a polygon with a number of radiuses. This makes it easy to generate shapes with an arbitrary number of sides, regularly angled around the origin. A single radius will give a simple shape such as a square, hexagon, etc. Multiple radiuses will give ...
python
def gen_polygon_pts(n_pts=3, radius=[1.0]): '''Generate points for a polygon with a number of radiuses. This makes it easy to generate shapes with an arbitrary number of sides, regularly angled around the origin. A single radius will give a simple shape such as a square, hexagon, etc. Multiple radiuses will give ...
[ "def", "gen_polygon_pts", "(", "n_pts", "=", "3", ",", "radius", "=", "[", "1.0", "]", ")", ":", "assert", "isinstance", "(", "n_pts", ",", "int", ")", "and", "n_pts", ">", "0", "assert", "isinstance", "(", "radius", ",", "list", ")", "l_rad", "=", ...
Generate points for a polygon with a number of radiuses. This makes it easy to generate shapes with an arbitrary number of sides, regularly angled around the origin. A single radius will give a simple shape such as a square, hexagon, etc. Multiple radiuses will give complex shapes like stars, gear wheels, ratchet w...
[ "Generate", "points", "for", "a", "polygon", "with", "a", "number", "of", "radiuses", ".", "This", "makes", "it", "easy", "to", "generate", "shapes", "with", "an", "arbitrary", "number", "of", "sides", "regularly", "angled", "around", "the", "origin", ".", ...
f1ea023d3e597160fc1e9e11921de07af659f9d2
https://github.com/DaveMcEwan/ndim/blob/f1ea023d3e597160fc1e9e11921de07af659f9d2/ndim_base.py#L405-L421
241,568
redbridge/molnctrl
molnctrl/__init__.py
_add_params_docstring
def _add_params_docstring(params): """ Add params to doc string """ p_string = "\nAccepts the following paramters: \n" for param in params: p_string += "name: %s, required: %s, description: %s \n" % (param['name'], param['required'], param['description']) return p_string
python
def _add_params_docstring(params): """ Add params to doc string """ p_string = "\nAccepts the following paramters: \n" for param in params: p_string += "name: %s, required: %s, description: %s \n" % (param['name'], param['required'], param['description']) return p_string
[ "def", "_add_params_docstring", "(", "params", ")", ":", "p_string", "=", "\"\\nAccepts the following paramters: \\n\"", "for", "param", "in", "params", ":", "p_string", "+=", "\"name: %s, required: %s, description: %s \\n\"", "%", "(", "param", "[", "'name'", "]", ",",...
Add params to doc string
[ "Add", "params", "to", "doc", "string" ]
9990ae7e522ce364bb61a735f774dc28de5f8e60
https://github.com/redbridge/molnctrl/blob/9990ae7e522ce364bb61a735f774dc28de5f8e60/molnctrl/__init__.py#L40-L46
241,569
redbridge/molnctrl
molnctrl/__init__.py
_create_api_method
def _create_api_method(cls, name, api_method): """ Create dynamic class methods based on the Cloudmonkey precached_verbs """ def _api_method(self, **kwargs): # lookup the command command = api_method['name'] if kwargs: return self._make_request(command, kwargs) el...
python
def _create_api_method(cls, name, api_method): """ Create dynamic class methods based on the Cloudmonkey precached_verbs """ def _api_method(self, **kwargs): # lookup the command command = api_method['name'] if kwargs: return self._make_request(command, kwargs) el...
[ "def", "_create_api_method", "(", "cls", ",", "name", ",", "api_method", ")", ":", "def", "_api_method", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# lookup the command", "command", "=", "api_method", "[", "'name'", "]", "if", "kwargs", ":", "return"...
Create dynamic class methods based on the Cloudmonkey precached_verbs
[ "Create", "dynamic", "class", "methods", "based", "on", "the", "Cloudmonkey", "precached_verbs" ]
9990ae7e522ce364bb61a735f774dc28de5f8e60
https://github.com/redbridge/molnctrl/blob/9990ae7e522ce364bb61a735f774dc28de5f8e60/molnctrl/__init__.py#L48-L62
241,570
deviantony/valigator
valigator/valigator.py
validate
def validate(backup): """Use this endpoint to start a backup validation. You must specify the backup type in the endpoint. Specify JSON data for backup archive info. { 'archive_path': '/path/to/archive' } Data must be valid, otherwise it will abort with a 400 code. First, it will ...
python
def validate(backup): """Use this endpoint to start a backup validation. You must specify the backup type in the endpoint. Specify JSON data for backup archive info. { 'archive_path': '/path/to/archive' } Data must be valid, otherwise it will abort with a 400 code. First, it will ...
[ "def", "validate", "(", "backup", ")", ":", "data", "=", "request", ".", "json", "if", "not", "data", ":", "abort", "(", "400", ",", "'No data received'", ")", "try", ":", "archive_path", "=", "data", "[", "'archive_path'", "]", "except", "KeyError", ":"...
Use this endpoint to start a backup validation. You must specify the backup type in the endpoint. Specify JSON data for backup archive info. { 'archive_path': '/path/to/archive' } Data must be valid, otherwise it will abort with a 400 code. First, it will try to search for an existing...
[ "Use", "this", "endpoint", "to", "start", "a", "backup", "validation", ".", "You", "must", "specify", "the", "backup", "type", "in", "the", "endpoint", ".", "Specify", "JSON", "data", "for", "backup", "archive", "info", "." ]
0557029bc58ea1270e358c14ca382d3807ed5b6f
https://github.com/deviantony/valigator/blob/0557029bc58ea1270e358c14ca382d3807ed5b6f/valigator/valigator.py#L10-L47
241,571
deviantony/valigator
valigator/valigator.py
main
def main(conf): """Main function, entry point of the program.""" global config config = load_configuration(conf) app.conf.update(config['celery']) run(host=config['valigator']['bind'], port=config['valigator']['port'])
python
def main(conf): """Main function, entry point of the program.""" global config config = load_configuration(conf) app.conf.update(config['celery']) run(host=config['valigator']['bind'], port=config['valigator']['port'])
[ "def", "main", "(", "conf", ")", ":", "global", "config", "config", "=", "load_configuration", "(", "conf", ")", "app", ".", "conf", ".", "update", "(", "config", "[", "'celery'", "]", ")", "run", "(", "host", "=", "config", "[", "'valigator'", "]", ...
Main function, entry point of the program.
[ "Main", "function", "entry", "point", "of", "the", "program", "." ]
0557029bc58ea1270e358c14ca382d3807ed5b6f
https://github.com/deviantony/valigator/blob/0557029bc58ea1270e358c14ca382d3807ed5b6f/valigator/valigator.py#L54-L59
241,572
cdeboever3/cdpybio
cdpybio/variants.py
record_variant_id
def record_variant_id(record): """Get variant ID from pyvcf.model._Record""" if record.ID: return record.ID else: return record.CHROM + ':' + str(record.POS)
python
def record_variant_id(record): """Get variant ID from pyvcf.model._Record""" if record.ID: return record.ID else: return record.CHROM + ':' + str(record.POS)
[ "def", "record_variant_id", "(", "record", ")", ":", "if", "record", ".", "ID", ":", "return", "record", ".", "ID", "else", ":", "return", "record", ".", "CHROM", "+", "':'", "+", "str", "(", "record", ".", "POS", ")" ]
Get variant ID from pyvcf.model._Record
[ "Get", "variant", "ID", "from", "pyvcf", ".", "model", ".", "_Record" ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/variants.py#L7-L12
241,573
cdeboever3/cdpybio
cdpybio/variants.py
wasp_snp_directory
def wasp_snp_directory(vcf, directory, sample_name=None): """ Convert VCF file into input for WASP. Only bi-allelic heterozygous sites are used. Parameters: ----------- vcf : str Path to VCF file. directory : str Output directory. This is the directory that will hold the fi...
python
def wasp_snp_directory(vcf, directory, sample_name=None): """ Convert VCF file into input for WASP. Only bi-allelic heterozygous sites are used. Parameters: ----------- vcf : str Path to VCF file. directory : str Output directory. This is the directory that will hold the fi...
[ "def", "wasp_snp_directory", "(", "vcf", ",", "directory", ",", "sample_name", "=", "None", ")", ":", "chrom", "=", "[", "]", "pos", "=", "[", "]", "ref", "=", "[", "]", "alt", "=", "[", "]", "vcf_reader", "=", "pyvcf", ".", "Reader", "(", "open", ...
Convert VCF file into input for WASP. Only bi-allelic heterozygous sites are used. Parameters: ----------- vcf : str Path to VCF file. directory : str Output directory. This is the directory that will hold the files for WASP. sample_name : str If provided, use ...
[ "Convert", "VCF", "file", "into", "input", "for", "WASP", ".", "Only", "bi", "-", "allelic", "heterozygous", "sites", "are", "used", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/variants.py#L32-L81
241,574
cdeboever3/cdpybio
cdpybio/variants.py
vcf_as_df
def vcf_as_df(fn): """ Read VCF file into pandas DataFrame. Parameters: ----------- fn : str Path to VCF file. Returns ------- df : pandas.DataFrame The VCF file as a data frame. Note that all header information is thrown away. """ header_lines = 0 ...
python
def vcf_as_df(fn): """ Read VCF file into pandas DataFrame. Parameters: ----------- fn : str Path to VCF file. Returns ------- df : pandas.DataFrame The VCF file as a data frame. Note that all header information is thrown away. """ header_lines = 0 ...
[ "def", "vcf_as_df", "(", "fn", ")", ":", "header_lines", "=", "0", "with", "open", "(", "fn", ",", "'r'", ")", "as", "f", ":", "line", "=", "f", ".", "readline", "(", ")", ".", "strip", "(", ")", "header_lines", "+=", "1", "while", "line", "[", ...
Read VCF file into pandas DataFrame. Parameters: ----------- fn : str Path to VCF file. Returns ------- df : pandas.DataFrame The VCF file as a data frame. Note that all header information is thrown away.
[ "Read", "VCF", "file", "into", "pandas", "DataFrame", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/variants.py#L83-L110
241,575
cdeboever3/cdpybio
cdpybio/variants.py
make_het_matrix
def make_het_matrix(fn): """ Make boolean matrix of samples by variants. One indicates that the sample is heterozygous for that variant. Parameters: ----------- vcf : str Path to VCF file. """ # TODO: parallelize? vcf_df = vcf_as_df(fn) variant_ids = vcf_df.apply(lambda...
python
def make_het_matrix(fn): """ Make boolean matrix of samples by variants. One indicates that the sample is heterozygous for that variant. Parameters: ----------- vcf : str Path to VCF file. """ # TODO: parallelize? vcf_df = vcf_as_df(fn) variant_ids = vcf_df.apply(lambda...
[ "def", "make_het_matrix", "(", "fn", ")", ":", "# TODO: parallelize?", "vcf_df", "=", "vcf_as_df", "(", "fn", ")", "variant_ids", "=", "vcf_df", ".", "apply", "(", "lambda", "x", ":", "df_variant_id", "(", "x", ")", ",", "axis", "=", "1", ")", "vcf_reade...
Make boolean matrix of samples by variants. One indicates that the sample is heterozygous for that variant. Parameters: ----------- vcf : str Path to VCF file.
[ "Make", "boolean", "matrix", "of", "samples", "by", "variants", ".", "One", "indicates", "that", "the", "sample", "is", "heterozygous", "for", "that", "variant", "." ]
38efdf0e11d01bc00a135921cb91a19c03db5d5c
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/variants.py#L112-L137
241,576
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.current
def current(self): """Returns the current user """ if not has_request_context(): return self.no_req_ctx_user_stack.top user_stack = getattr(_request_ctx_stack.top, 'user_stack', None) if user_stack and user_stack.top: return user_stack.top return _...
python
def current(self): """Returns the current user """ if not has_request_context(): return self.no_req_ctx_user_stack.top user_stack = getattr(_request_ctx_stack.top, 'user_stack', None) if user_stack and user_stack.top: return user_stack.top return _...
[ "def", "current", "(", "self", ")", ":", "if", "not", "has_request_context", "(", ")", ":", "return", "self", ".", "no_req_ctx_user_stack", ".", "top", "user_stack", "=", "getattr", "(", "_request_ctx_stack", ".", "top", ",", "'user_stack'", ",", "None", ")"...
Returns the current user
[ "Returns", "the", "current", "user" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L233-L241
241,577
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.generate_user_token
def generate_user_token(self, user, salt=None): """Generates a unique token associated to the user """ return self.token_serializer.dumps(str(user.id), salt=salt)
python
def generate_user_token(self, user, salt=None): """Generates a unique token associated to the user """ return self.token_serializer.dumps(str(user.id), salt=salt)
[ "def", "generate_user_token", "(", "self", ",", "user", ",", "salt", "=", "None", ")", ":", "return", "self", ".", "token_serializer", ".", "dumps", "(", "str", "(", "user", ".", "id", ")", ",", "salt", "=", "salt", ")" ]
Generates a unique token associated to the user
[ "Generates", "a", "unique", "token", "associated", "to", "the", "user" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L285-L288
241,578
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.update_password
def update_password(self, user, password, skip_validation=False): """Updates the password of a user """ pwcol = self.options["password_column"] pwhash = self.bcrypt.generate_password_hash(password) if not skip_validation: self.validate_password(user, password, pwhash)...
python
def update_password(self, user, password, skip_validation=False): """Updates the password of a user """ pwcol = self.options["password_column"] pwhash = self.bcrypt.generate_password_hash(password) if not skip_validation: self.validate_password(user, password, pwhash)...
[ "def", "update_password", "(", "self", ",", "user", ",", "password", ",", "skip_validation", "=", "False", ")", ":", "pwcol", "=", "self", ".", "options", "[", "\"password_column\"", "]", "pwhash", "=", "self", ".", "bcrypt", ".", "generate_password_hash", "...
Updates the password of a user
[ "Updates", "the", "password", "of", "a", "user" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L339-L352
241,579
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.login_required
def login_required(self, fresh=False, redirect_to=None): """Ensures that a user is authenticated """ if not self.logged_in() or (fresh and not self.login_manager.login_fresh()): if redirect_to: resp = redirect(redirect_to) else: resp = self...
python
def login_required(self, fresh=False, redirect_to=None): """Ensures that a user is authenticated """ if not self.logged_in() or (fresh and not self.login_manager.login_fresh()): if redirect_to: resp = redirect(redirect_to) else: resp = self...
[ "def", "login_required", "(", "self", ",", "fresh", "=", "False", ",", "redirect_to", "=", "None", ")", ":", "if", "not", "self", ".", "logged_in", "(", ")", "or", "(", "fresh", "and", "not", "self", ".", "login_manager", ".", "login_fresh", "(", ")", ...
Ensures that a user is authenticated
[ "Ensures", "that", "a", "user", "is", "authenticated" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L364-L372
241,580
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature._login
def _login(self, user, provider=None, remember=False, force=False, **attrs): """Updates user attributes and login the user in flask-login """ user.last_login_at = datetime.datetime.now() user.last_login_provider = provider or self.options["default_auth_provider_name"] user.last_l...
python
def _login(self, user, provider=None, remember=False, force=False, **attrs): """Updates user attributes and login the user in flask-login """ user.last_login_at = datetime.datetime.now() user.last_login_provider = provider or self.options["default_auth_provider_name"] user.last_l...
[ "def", "_login", "(", "self", ",", "user", ",", "provider", "=", "None", ",", "remember", "=", "False", ",", "force", "=", "False", ",", "*", "*", "attrs", ")", ":", "user", ".", "last_login_at", "=", "datetime", ".", "datetime", ".", "now", "(", "...
Updates user attributes and login the user in flask-login
[ "Updates", "user", "attributes", "and", "login", "the", "user", "in", "flask", "-", "login" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L431-L439
241,581
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.check_password_confirm
def check_password_confirm(self, form, trigger_action_group=None): """Checks that the password and the confirm password match in the provided form. Won't do anything if any of the password fields are not in the form. """ pwcol = self.options['password_column'] pwconfirmfi...
python
def check_password_confirm(self, form, trigger_action_group=None): """Checks that the password and the confirm password match in the provided form. Won't do anything if any of the password fields are not in the form. """ pwcol = self.options['password_column'] pwconfirmfi...
[ "def", "check_password_confirm", "(", "self", ",", "form", ",", "trigger_action_group", "=", "None", ")", ":", "pwcol", "=", "self", ".", "options", "[", "'password_column'", "]", "pwconfirmfield", "=", "pwcol", "+", "\"_confirm\"", "if", "pwcol", "in", "form"...
Checks that the password and the confirm password match in the provided form. Won't do anything if any of the password fields are not in the form.
[ "Checks", "that", "the", "password", "and", "the", "confirm", "password", "match", "in", "the", "provided", "form", ".", "Won", "t", "do", "anything", "if", "any", "of", "the", "password", "fields", "are", "not", "in", "the", "form", "." ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L528-L538
241,582
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.reset_password
def reset_password(self, token=None, login_user=None): """Resets the password of the user identified by the token """ pwcol = self.options['password_column'] if not token: if "token" in request.view_args: token = request.view_args["token"] elif "to...
python
def reset_password(self, token=None, login_user=None): """Resets the password of the user identified by the token """ pwcol = self.options['password_column'] if not token: if "token" in request.view_args: token = request.view_args["token"] elif "to...
[ "def", "reset_password", "(", "self", ",", "token", "=", "None", ",", "login_user", "=", "None", ")", ":", "pwcol", "=", "self", ".", "options", "[", "'password_column'", "]", "if", "not", "token", ":", "if", "\"token\"", "in", "request", ".", "view_args...
Resets the password of the user identified by the token
[ "Resets", "the", "password", "of", "the", "user", "identified", "by", "the", "token" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L695-L718
241,583
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.update_password_from_form
def update_password_from_form(self, user=None, form=None): """Updates the user password using a form """ user = user or self.current if not form and "form" in current_context.data and request.method == "POST": form = current_context.data.form elif not form: ...
python
def update_password_from_form(self, user=None, form=None): """Updates the user password using a form """ user = user or self.current if not form and "form" in current_context.data and request.method == "POST": form = current_context.data.form elif not form: ...
[ "def", "update_password_from_form", "(", "self", ",", "user", "=", "None", ",", "form", "=", "None", ")", ":", "user", "=", "user", "or", "self", ".", "current", "if", "not", "form", "and", "\"form\"", "in", "current_context", ".", "data", "and", "reques...
Updates the user password using a form
[ "Updates", "the", "user", "password", "using", "a", "form" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L731-L742
241,584
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.check_user_password
def check_user_password(self, user, password=None, form=None): """Checks if the password matches the one of the user. If no password is provided, the current form will be used """ pwcol = self.options['password_column'] if password is None: if not form and "form" in c...
python
def check_user_password(self, user, password=None, form=None): """Checks if the password matches the one of the user. If no password is provided, the current form will be used """ pwcol = self.options['password_column'] if password is None: if not form and "form" in c...
[ "def", "check_user_password", "(", "self", ",", "user", ",", "password", "=", "None", ",", "form", "=", "None", ")", ":", "pwcol", "=", "self", ".", "options", "[", "'password_column'", "]", "if", "password", "is", "None", ":", "if", "not", "form", "an...
Checks if the password matches the one of the user. If no password is provided, the current form will be used
[ "Checks", "if", "the", "password", "matches", "the", "one", "of", "the", "user", ".", "If", "no", "password", "is", "provided", "the", "current", "form", "will", "be", "used" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L762-L776
241,585
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.check_unique_attr
def check_unique_attr(self, attrs, user=None, form=None, flash_msg=None): """Checks that an attribute of the current user is unique amongst all users. If no value is provided, the current form will be used. """ user = user or self.current ucol = self.options["username_column"] ...
python
def check_unique_attr(self, attrs, user=None, form=None, flash_msg=None): """Checks that an attribute of the current user is unique amongst all users. If no value is provided, the current form will be used. """ user = user or self.current ucol = self.options["username_column"] ...
[ "def", "check_unique_attr", "(", "self", ",", "attrs", ",", "user", "=", "None", ",", "form", "=", "None", ",", "flash_msg", "=", "None", ")", ":", "user", "=", "user", "or", "self", ".", "current", "ucol", "=", "self", ".", "options", "[", "\"userna...
Checks that an attribute of the current user is unique amongst all users. If no value is provided, the current form will be used.
[ "Checks", "that", "an", "attribute", "of", "the", "current", "user", "is", "unique", "amongst", "all", "users", ".", "If", "no", "value", "is", "provided", "the", "current", "form", "will", "be", "used", "." ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L810-L841
241,586
frascoweb/frasco-users
frasco_users/__init__.py
UsersFeature.oauth_signup
def oauth_signup(self, provider, attrs, defaults, redirect_url=None): """Start the signup process after having logged in via oauth """ session["oauth_user_defaults"] = defaults session["oauth_user_attrs"] = dict(provider=provider, **attrs) if not redirect_url: redirec...
python
def oauth_signup(self, provider, attrs, defaults, redirect_url=None): """Start the signup process after having logged in via oauth """ session["oauth_user_defaults"] = defaults session["oauth_user_attrs"] = dict(provider=provider, **attrs) if not redirect_url: redirec...
[ "def", "oauth_signup", "(", "self", ",", "provider", ",", "attrs", ",", "defaults", ",", "redirect_url", "=", "None", ")", ":", "session", "[", "\"oauth_user_defaults\"", "]", "=", "defaults", "session", "[", "\"oauth_user_attrs\"", "]", "=", "dict", "(", "p...
Start the signup process after having logged in via oauth
[ "Start", "the", "signup", "process", "after", "having", "logged", "in", "via", "oauth" ]
16591ca466de5b7c80d7a2384327d9cf2d919c41
https://github.com/frascoweb/frasco-users/blob/16591ca466de5b7c80d7a2384327d9cf2d919c41/frasco_users/__init__.py#L863-L870
241,587
AndresMWeber/Nomenclate
nomenclate/core/formatter.py
FormatString.get_valid_format_order
def get_valid_format_order(cls, format_target, format_order=None): """ Checks to see if the target format string follows the proper style """ format_order = format_order or cls.parse_format_order(format_target) cls.validate_no_token_duplicates(format_order) format_target = cls.re...
python
def get_valid_format_order(cls, format_target, format_order=None): """ Checks to see if the target format string follows the proper style """ format_order = format_order or cls.parse_format_order(format_target) cls.validate_no_token_duplicates(format_order) format_target = cls.re...
[ "def", "get_valid_format_order", "(", "cls", ",", "format_target", ",", "format_order", "=", "None", ")", ":", "format_order", "=", "format_order", "or", "cls", ".", "parse_format_order", "(", "format_target", ")", "cls", ".", "validate_no_token_duplicates", "(", ...
Checks to see if the target format string follows the proper style
[ "Checks", "to", "see", "if", "the", "target", "format", "string", "follows", "the", "proper", "style" ]
e6d6fc28beac042bad588e56fbe77531d2de6b6f
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/formatter.py#L52-L61
241,588
scieloorg/porteira
porteira/porteira.py
Schema._handle_errors
def _handle_errors(self, errors_list): """ Handles errors list Output Format: [(DOMIAN, LINE, COLUMN, LEVEL, TYPE_NAME, MESSAGE),] Ex.: [(PARSER, 3, 51, FATAL, ERR_TAG_NAME_MISMATCH, Opening and ending tag mismatch: statpage line 3 and startpage), (SCHEM...
python
def _handle_errors(self, errors_list): """ Handles errors list Output Format: [(DOMIAN, LINE, COLUMN, LEVEL, TYPE_NAME, MESSAGE),] Ex.: [(PARSER, 3, 51, FATAL, ERR_TAG_NAME_MISMATCH, Opening and ending tag mismatch: statpage line 3 and startpage), (SCHEM...
[ "def", "_handle_errors", "(", "self", ",", "errors_list", ")", ":", "errors", "=", "[", "]", "for", "error", "in", "errors_list", ":", "errors", ".", "append", "(", "(", "error", ".", "domain_name", ",", "error", ".", "line", ",", "error", ".", "column...
Handles errors list Output Format: [(DOMIAN, LINE, COLUMN, LEVEL, TYPE_NAME, MESSAGE),] Ex.: [(PARSER, 3, 51, FATAL, ERR_TAG_NAME_MISMATCH, Opening and ending tag mismatch: statpage line 3 and startpage), (SCHEMASV, 2, 0, ERROR, SCHEMAV_CVC_ELT_1, Element 'wizard': ...
[ "Handles", "errors", "list" ]
e61f7d248b16848e63b2f85f37125aa77aba0366
https://github.com/scieloorg/porteira/blob/e61f7d248b16848e63b2f85f37125aa77aba0366/porteira/porteira.py#L23-L39
241,589
scieloorg/porteira
porteira/porteira.py
Schema.get_validation_errors
def get_validation_errors(self, xml_input): """ This method returns a list of validation errors. If there are no errors an empty list is returned """ errors = [] try: parsed_xml = etree.parse(self._handle_xml(xml_input)) self.xmlschema.assertValid(...
python
def get_validation_errors(self, xml_input): """ This method returns a list of validation errors. If there are no errors an empty list is returned """ errors = [] try: parsed_xml = etree.parse(self._handle_xml(xml_input)) self.xmlschema.assertValid(...
[ "def", "get_validation_errors", "(", "self", ",", "xml_input", ")", ":", "errors", "=", "[", "]", "try", ":", "parsed_xml", "=", "etree", ".", "parse", "(", "self", ".", "_handle_xml", "(", "xml_input", ")", ")", "self", ".", "xmlschema", ".", "assertVal...
This method returns a list of validation errors. If there are no errors an empty list is returned
[ "This", "method", "returns", "a", "list", "of", "validation", "errors", ".", "If", "there", "are", "no", "errors", "an", "empty", "list", "is", "returned" ]
e61f7d248b16848e63b2f85f37125aa77aba0366
https://github.com/scieloorg/porteira/blob/e61f7d248b16848e63b2f85f37125aa77aba0366/porteira/porteira.py#L50-L63
241,590
scieloorg/porteira
porteira/porteira.py
Schema.validate
def validate(self, xml_input): """ This method validate the parsing and schema, return a boolean """ parsed_xml = etree.parse(self._handle_xml(xml_input)) try: return self.xmlschema.validate(parsed_xml) except AttributeError: raise CannotValidate('...
python
def validate(self, xml_input): """ This method validate the parsing and schema, return a boolean """ parsed_xml = etree.parse(self._handle_xml(xml_input)) try: return self.xmlschema.validate(parsed_xml) except AttributeError: raise CannotValidate('...
[ "def", "validate", "(", "self", ",", "xml_input", ")", ":", "parsed_xml", "=", "etree", ".", "parse", "(", "self", ".", "_handle_xml", "(", "xml_input", ")", ")", "try", ":", "return", "self", ".", "xmlschema", ".", "validate", "(", "parsed_xml", ")", ...
This method validate the parsing and schema, return a boolean
[ "This", "method", "validate", "the", "parsing", "and", "schema", "return", "a", "boolean" ]
e61f7d248b16848e63b2f85f37125aa77aba0366
https://github.com/scieloorg/porteira/blob/e61f7d248b16848e63b2f85f37125aa77aba0366/porteira/porteira.py#L65-L73
241,591
scieloorg/porteira
porteira/porteira.py
Schema.deserialize
def deserialize(self, xml_input, *args, **kwargs): """ Convert XML to dict object """ return xmltodict.parse(xml_input, *args, **kwargs)
python
def deserialize(self, xml_input, *args, **kwargs): """ Convert XML to dict object """ return xmltodict.parse(xml_input, *args, **kwargs)
[ "def", "deserialize", "(", "self", ",", "xml_input", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "xmltodict", ".", "parse", "(", "xml_input", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Convert XML to dict object
[ "Convert", "XML", "to", "dict", "object" ]
e61f7d248b16848e63b2f85f37125aa77aba0366
https://github.com/scieloorg/porteira/blob/e61f7d248b16848e63b2f85f37125aa77aba0366/porteira/porteira.py#L75-L79
241,592
chamrc/to
to/__init__.py
_import_all_modules
def _import_all_modules(): """dynamically imports all modules in the package""" import traceback import os global results globals_, locals_ = globals(), locals() def load_module(modulename, package_module): try: names = [] module = __import__(package_module, glob...
python
def _import_all_modules(): """dynamically imports all modules in the package""" import traceback import os global results globals_, locals_ = globals(), locals() def load_module(modulename, package_module): try: names = [] module = __import__(package_module, glob...
[ "def", "_import_all_modules", "(", ")", ":", "import", "traceback", "import", "os", "global", "results", "globals_", ",", "locals_", "=", "globals", "(", ")", ",", "locals", "(", ")", "def", "load_module", "(", "modulename", ",", "package_module", ")", ":", ...
dynamically imports all modules in the package
[ "dynamically", "imports", "all", "modules", "in", "the", "package" ]
ea1122bef08615b6c19904dadf2608e10c20c960
https://github.com/chamrc/to/blob/ea1122bef08615b6c19904dadf2608e10c20c960/to/__init__.py#L1-L42
241,593
yograterol/zoort
zoort.py
compress_folder_dump
def compress_folder_dump(path, target): ''' Compress folder dump to tar.gz file ''' import tarfile if not path or not os.path.isdir(path): raise SystemExit(_error_codes.get(105)) name_out_file = (target + 'dump-' + datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'...
python
def compress_folder_dump(path, target): ''' Compress folder dump to tar.gz file ''' import tarfile if not path or not os.path.isdir(path): raise SystemExit(_error_codes.get(105)) name_out_file = (target + 'dump-' + datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'...
[ "def", "compress_folder_dump", "(", "path", ",", "target", ")", ":", "import", "tarfile", "if", "not", "path", "or", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "raise", "SystemExit", "(", "_error_codes", ".", "get", "(", "105", ")",...
Compress folder dump to tar.gz file
[ "Compress", "folder", "dump", "to", "tar", ".", "gz", "file" ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L665-L677
241,594
yograterol/zoort
zoort.py
encrypt_file
def encrypt_file(path, output, password=None): ''' Encrypt file with AES method and password. ''' if not password: password = PASSWORD_FILE query = 'openssl aes-128-cbc -salt -in {0} -out {1} -k {2}' with hide('output'): local(query.format(path, output, password)) os.remo...
python
def encrypt_file(path, output, password=None): ''' Encrypt file with AES method and password. ''' if not password: password = PASSWORD_FILE query = 'openssl aes-128-cbc -salt -in {0} -out {1} -k {2}' with hide('output'): local(query.format(path, output, password)) os.remo...
[ "def", "encrypt_file", "(", "path", ",", "output", ",", "password", "=", "None", ")", ":", "if", "not", "password", ":", "password", "=", "PASSWORD_FILE", "query", "=", "'openssl aes-128-cbc -salt -in {0} -out {1} -k {2}'", "with", "hide", "(", "'output'", ")", ...
Encrypt file with AES method and password.
[ "Encrypt", "file", "with", "AES", "method", "and", "password", "." ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L680-L689
241,595
yograterol/zoort
zoort.py
decrypt_file
def decrypt_file(path, password=None): ''' Decrypt file with AES method and password. ''' global PASSWORD_FILE if not password: password = PASSWORD_FILE if path and not os.path.isfile(path): raise SystemExit(_error_codes.get(106)) query = 'openssl aes-128-cbc -d -salt -in {0}...
python
def decrypt_file(path, password=None): ''' Decrypt file with AES method and password. ''' global PASSWORD_FILE if not password: password = PASSWORD_FILE if path and not os.path.isfile(path): raise SystemExit(_error_codes.get(106)) query = 'openssl aes-128-cbc -d -salt -in {0}...
[ "def", "decrypt_file", "(", "path", ",", "password", "=", "None", ")", ":", "global", "PASSWORD_FILE", "if", "not", "password", ":", "password", "=", "PASSWORD_FILE", "if", "path", "and", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", ...
Decrypt file with AES method and password.
[ "Decrypt", "file", "with", "AES", "method", "and", "password", "." ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L692-L703
241,596
yograterol/zoort
zoort.py
optional_actions
def optional_actions(encrypt, path, compress_file, **kwargs): ''' Optional actions about of AWS S3 and encrypt file. ''' yes = ('y', 'Y') file_to_upload = normalize_path(path) + compress_file[1] if encrypt in yes: encrypt_file(compress_file[1], compress_file[0]) file_to_upload = ...
python
def optional_actions(encrypt, path, compress_file, **kwargs): ''' Optional actions about of AWS S3 and encrypt file. ''' yes = ('y', 'Y') file_to_upload = normalize_path(path) + compress_file[1] if encrypt in yes: encrypt_file(compress_file[1], compress_file[0]) file_to_upload = ...
[ "def", "optional_actions", "(", "encrypt", ",", "path", ",", "compress_file", ",", "*", "*", "kwargs", ")", ":", "yes", "=", "(", "'y'", ",", "'Y'", ")", "file_to_upload", "=", "normalize_path", "(", "path", ")", "+", "compress_file", "[", "1", "]", "i...
Optional actions about of AWS S3 and encrypt file.
[ "Optional", "actions", "about", "of", "AWS", "S3", "and", "encrypt", "file", "." ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L706-L731
241,597
yograterol/zoort
zoort.py
main
def main(): '''Main entry point for the mongo_backups CLI.''' args = docopt(__doc__, version=__version__) if args.get('backup'): backup_database(args) if args.get('backup_all'): backup_all(args) if args.get('decrypt'): decrypt_file(args.get('<path>')) if args.get('configu...
python
def main(): '''Main entry point for the mongo_backups CLI.''' args = docopt(__doc__, version=__version__) if args.get('backup'): backup_database(args) if args.get('backup_all'): backup_all(args) if args.get('decrypt'): decrypt_file(args.get('<path>')) if args.get('configu...
[ "def", "main", "(", ")", ":", "args", "=", "docopt", "(", "__doc__", ",", "version", "=", "__version__", ")", "if", "args", ".", "get", "(", "'backup'", ")", ":", "backup_database", "(", "args", ")", "if", "args", ".", "get", "(", "'backup_all'", ")"...
Main entry point for the mongo_backups CLI.
[ "Main", "entry", "point", "for", "the", "mongo_backups", "CLI", "." ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L735-L753
241,598
yograterol/zoort
zoort.py
backup_database
def backup_database(args): ''' Backup one database from CLI ''' username = args.get('<user>') password = args.get('<password>') database = args['<database>'] host = args.get('<host>') or '127.0.0.1' path = args.get('--path') or os.getcwd() s3 = args.get('--upload_s3') glacier = a...
python
def backup_database(args): ''' Backup one database from CLI ''' username = args.get('<user>') password = args.get('<password>') database = args['<database>'] host = args.get('<host>') or '127.0.0.1' path = args.get('--path') or os.getcwd() s3 = args.get('--upload_s3') glacier = a...
[ "def", "backup_database", "(", "args", ")", ":", "username", "=", "args", ".", "get", "(", "'<user>'", ")", "password", "=", "args", ".", "get", "(", "'<password>'", ")", "database", "=", "args", "[", "'<database>'", "]", "host", "=", "args", ".", "get...
Backup one database from CLI
[ "Backup", "one", "database", "from", "CLI" ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L760-L801
241,599
yograterol/zoort
zoort.py
backup_all
def backup_all(args): ''' Backup all databases with access user. ''' username = None password = None auth = args.get('--auth') path = args.get('--path') s3 = args.get('--upload_s3') glacier = args.get('--upload_glacier') dropbox = args.get('--upload_dropbox') swift = args.get...
python
def backup_all(args): ''' Backup all databases with access user. ''' username = None password = None auth = args.get('--auth') path = args.get('--path') s3 = args.get('--upload_s3') glacier = args.get('--upload_glacier') dropbox = args.get('--upload_dropbox') swift = args.get...
[ "def", "backup_all", "(", "args", ")", ":", "username", "=", "None", "password", "=", "None", "auth", "=", "args", ".", "get", "(", "'--auth'", ")", "path", "=", "args", ".", "get", "(", "'--path'", ")", "s3", "=", "args", ".", "get", "(", "'--uplo...
Backup all databases with access user.
[ "Backup", "all", "databases", "with", "access", "user", "." ]
ed6669ab945007c20a83f6d468856c4eb585c752
https://github.com/yograterol/zoort/blob/ed6669ab945007c20a83f6d468856c4eb585c752/zoort.py#L804-L844