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
249,900
kodexlab/reliure
reliure/web.py
EngineView.set_outputs
def set_outputs(self, *outputs): """ Set the outputs of the view """ self._outputs = OrderedDict() for output in outputs: out_name = None type_or_serialize = None if isinstance((list, tuple), output): if len(output) == 1: ...
python
def set_outputs(self, *outputs): """ Set the outputs of the view """ self._outputs = OrderedDict() for output in outputs: out_name = None type_or_serialize = None if isinstance((list, tuple), output): if len(output) == 1: ...
[ "def", "set_outputs", "(", "self", ",", "*", "outputs", ")", ":", "self", ".", "_outputs", "=", "OrderedDict", "(", ")", "for", "output", "in", "outputs", ":", "out_name", "=", "None", "type_or_serialize", "=", "None", "if", "isinstance", "(", "(", "list...
Set the outputs of the view
[ "Set", "the", "outputs", "of", "the", "view" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L96-L113
249,901
kodexlab/reliure
reliure/web.py
EngineView.add_output
def add_output(self, out_name, type_or_serialize=None, **kwargs): """ Declare an output """ if out_name not in self.engine.all_outputs(): raise ValueError("'%s' is not generated by the engine %s" % (out_name, self.engine.all_outputs())) if type_or_serialize is None: ...
python
def add_output(self, out_name, type_or_serialize=None, **kwargs): """ Declare an output """ if out_name not in self.engine.all_outputs(): raise ValueError("'%s' is not generated by the engine %s" % (out_name, self.engine.all_outputs())) if type_or_serialize is None: ...
[ "def", "add_output", "(", "self", ",", "out_name", ",", "type_or_serialize", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "out_name", "not", "in", "self", ".", "engine", ".", "all_outputs", "(", ")", ":", "raise", "ValueError", "(", "\"'%s' is n...
Declare an output
[ "Declare", "an", "output" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L115-L130
249,902
kodexlab/reliure
reliure/web.py
EngineView.options
def options(self): """ Engine options discover HTTP entry point """ #configure engine with an empty dict to ensure default selection/options self.engine.configure({}) conf = self.engine.as_dict() conf["returns"] = [oname for oname in six.iterkeys(self._outputs)] #...
python
def options(self): """ Engine options discover HTTP entry point """ #configure engine with an empty dict to ensure default selection/options self.engine.configure({}) conf = self.engine.as_dict() conf["returns"] = [oname for oname in six.iterkeys(self._outputs)] #...
[ "def", "options", "(", "self", ")", ":", "#configure engine with an empty dict to ensure default selection/options", "self", ".", "engine", ".", "configure", "(", "{", "}", ")", "conf", "=", "self", ".", "engine", ".", "as_dict", "(", ")", "conf", "[", "\"return...
Engine options discover HTTP entry point
[ "Engine", "options", "discover", "HTTP", "entry", "point" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/web.py#L248-L257
249,903
anti1869/sunhead
src/sunhead/events/stream.py
init_stream_from_settings
async def init_stream_from_settings(cfg: dict) -> Stream: """ Shortcut to create Stream from configured settings. Will definitely fail if there is no meaningful configuration provided. Example of such is:: { "streams": { "rabbitmq": { "transport": "s...
python
async def init_stream_from_settings(cfg: dict) -> Stream: """ Shortcut to create Stream from configured settings. Will definitely fail if there is no meaningful configuration provided. Example of such is:: { "streams": { "rabbitmq": { "transport": "s...
[ "async", "def", "init_stream_from_settings", "(", "cfg", ":", "dict", ")", "->", "Stream", ":", "cfg_name", "=", "cfg", "[", "\"active_stream\"", "]", "stream_init_kwargs", "=", "cfg", "[", "\"streams\"", "]", "[", "cfg_name", "]", "stream", "=", "Stream", "...
Shortcut to create Stream from configured settings. Will definitely fail if there is no meaningful configuration provided. Example of such is:: { "streams": { "rabbitmq": { "transport": "sunhead.events.transports.amqp.AMQPClient", "connec...
[ "Shortcut", "to", "create", "Stream", "from", "configured", "settings", "." ]
5117ec797a38eb82d955241d20547d125efe80f3
https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/events/stream.py#L124-L157
249,904
openbermuda/ripl
ripl/md2py.py
Mark2Py.interpret
def interpret(self, infile): """ Process a file of rest and return list of dicts """ data = [] for record in self.generate_records(infile): data.append(record) return data
python
def interpret(self, infile): """ Process a file of rest and return list of dicts """ data = [] for record in self.generate_records(infile): data.append(record) return data
[ "def", "interpret", "(", "self", ",", "infile", ")", ":", "data", "=", "[", "]", "for", "record", "in", "self", ".", "generate_records", "(", "infile", ")", ":", "data", ".", "append", "(", "record", ")", "return", "data" ]
Process a file of rest and return list of dicts
[ "Process", "a", "file", "of", "rest", "and", "return", "list", "of", "dicts" ]
4886b1a697e4b81c2202db9cb977609e034f8e70
https://github.com/openbermuda/ripl/blob/4886b1a697e4b81c2202db9cb977609e034f8e70/ripl/md2py.py#L17-L25
249,905
jtpaasch/simplygithub
simplygithub/authentication/profile.py
read_profile
def read_profile(name): """Get a named profile from the CONFIG_FILE. Args: name The name of the profile to load. Returns: A dictionary with the profile's ``repo`` and ``token`` values. """ config = configparser.ConfigParser() config.read(CONFIG_FILE) profile =...
python
def read_profile(name): """Get a named profile from the CONFIG_FILE. Args: name The name of the profile to load. Returns: A dictionary with the profile's ``repo`` and ``token`` values. """ config = configparser.ConfigParser() config.read(CONFIG_FILE) profile =...
[ "def", "read_profile", "(", "name", ")", ":", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "config", ".", "read", "(", "CONFIG_FILE", ")", "profile", "=", "config", "[", "name", "]", "repo", "=", "profile", "[", "\"repo\"", "]", "token",...
Get a named profile from the CONFIG_FILE. Args: name The name of the profile to load. Returns: A dictionary with the profile's ``repo`` and ``token`` values.
[ "Get", "a", "named", "profile", "from", "the", "CONFIG_FILE", "." ]
b77506275ec276ce90879bf1ea9299a79448b903
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/authentication/profile.py#L60-L77
249,906
jtpaasch/simplygithub
simplygithub/authentication/profile.py
write_profile
def write_profile(name, repo, token): """Save a profile to the CONFIG_FILE. After you use this method to save a profile, you can load it anytime later with the ``read_profile()`` function defined above. Args: name The name of the profile to save. repo The Gith...
python
def write_profile(name, repo, token): """Save a profile to the CONFIG_FILE. After you use this method to save a profile, you can load it anytime later with the ``read_profile()`` function defined above. Args: name The name of the profile to save. repo The Gith...
[ "def", "write_profile", "(", "name", ",", "repo", ",", "token", ")", ":", "make_sure_folder_exists", "(", "CONFIG_FOLDER", ")", "config", "=", "configparser", ".", "ConfigParser", "(", ")", "config", ".", "read", "(", "CONFIG_FILE", ")", "profile", "=", "{",...
Save a profile to the CONFIG_FILE. After you use this method to save a profile, you can load it anytime later with the ``read_profile()`` function defined above. Args: name The name of the profile to save. repo The Github repo you want to connect to. For instance,...
[ "Save", "a", "profile", "to", "the", "CONFIG_FILE", "." ]
b77506275ec276ce90879bf1ea9299a79448b903
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/authentication/profile.py#L80-L110
249,907
GaretJax/irco
setup.py
Setup.requirements
def requirements(fname): """ Utility function to create a list of requirements from the output of the pip freeze command saved in a text file. """ packages = Setup.read(fname, fail_silently=True).split('\n') packages = (p.strip() for p in packages) packages = (p f...
python
def requirements(fname): """ Utility function to create a list of requirements from the output of the pip freeze command saved in a text file. """ packages = Setup.read(fname, fail_silently=True).split('\n') packages = (p.strip() for p in packages) packages = (p f...
[ "def", "requirements", "(", "fname", ")", ":", "packages", "=", "Setup", ".", "read", "(", "fname", ",", "fail_silently", "=", "True", ")", ".", "split", "(", "'\\n'", ")", "packages", "=", "(", "p", ".", "strip", "(", ")", "for", "p", "in", "packa...
Utility function to create a list of requirements from the output of the pip freeze command saved in a text file.
[ "Utility", "function", "to", "create", "a", "list", "of", "requirements", "from", "the", "output", "of", "the", "pip", "freeze", "command", "saved", "in", "a", "text", "file", "." ]
e5df3cf1a608dc813011a1ee7e920637e5bd155c
https://github.com/GaretJax/irco/blob/e5df3cf1a608dc813011a1ee7e920637e5bd155c/setup.py#L22-L30
249,908
elijahr/lk
lk.py
build_parser
def build_parser(): """ Returns an argparse.ArgumentParser instance to parse the command line arguments for lk """ import argparse description = "A programmer's search tool, parallel and fast" parser = argparse.ArgumentParser(description=description) parser.add_argument('pattern', metava...
python
def build_parser(): """ Returns an argparse.ArgumentParser instance to parse the command line arguments for lk """ import argparse description = "A programmer's search tool, parallel and fast" parser = argparse.ArgumentParser(description=description) parser.add_argument('pattern', metava...
[ "def", "build_parser", "(", ")", ":", "import", "argparse", "description", "=", "\"A programmer's search tool, parallel and fast\"", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "description", ")", "parser", ".", "add_argument", "(", "'pa...
Returns an argparse.ArgumentParser instance to parse the command line arguments for lk
[ "Returns", "an", "argparse", ".", "ArgumentParser", "instance", "to", "parse", "the", "command", "line", "arguments", "for", "lk" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L14-L66
249,909
elijahr/lk
lk.py
get_file_contents
def get_file_contents(path, binary=False): """ Return the contents of the text file at path. If it is a binary file,raise an IOError """ # if this isn't a text file, we should raise an IOError f = open(path, 'r') file_contents = f.read() f.close() if not binary and file_contents.find...
python
def get_file_contents(path, binary=False): """ Return the contents of the text file at path. If it is a binary file,raise an IOError """ # if this isn't a text file, we should raise an IOError f = open(path, 'r') file_contents = f.read() f.close() if not binary and file_contents.find...
[ "def", "get_file_contents", "(", "path", ",", "binary", "=", "False", ")", ":", "# if this isn't a text file, we should raise an IOError", "f", "=", "open", "(", "path", ",", "'r'", ")", "file_contents", "=", "f", ".", "read", "(", ")", "f", ".", "close", "(...
Return the contents of the text file at path. If it is a binary file,raise an IOError
[ "Return", "the", "contents", "of", "the", "text", "file", "at", "path", ".", "If", "it", "is", "a", "binary", "file", "raise", "an", "IOError" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L68-L79
249,910
elijahr/lk
lk.py
main
def main(): """ if lk.py is run as a script, this function will run """ parser = build_parser() args = parser.parse_args() flags = re.LOCALE if args.dot_all: flags |= re.DOTALL if args.ignorecase: flags |= re.IGNORECASE if args.unicode: flags |= re.UNICODE...
python
def main(): """ if lk.py is run as a script, this function will run """ parser = build_parser() args = parser.parse_args() flags = re.LOCALE if args.dot_all: flags |= re.DOTALL if args.ignorecase: flags |= re.IGNORECASE if args.unicode: flags |= re.UNICODE...
[ "def", "main", "(", ")", ":", "parser", "=", "build_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "flags", "=", "re", ".", "LOCALE", "if", "args", ".", "dot_all", ":", "flags", "|=", "re", ".", "DOTALL", "if", "args", ".", ...
if lk.py is run as a script, this function will run
[ "if", "lk", ".", "py", "is", "run", "as", "a", "script", "this", "function", "will", "run" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L306-L349
249,911
elijahr/lk
lk.py
SearchManager.enqueue_directory
def enqueue_directory(self, directory): """ add a search of the directory to the queue """ exclude_path_regexes = self.exclude_path_regexes[:] if not self.search_hidden: exclude_path_regexes.append(self.hidden_file_regex) else: exclude_path_regex...
python
def enqueue_directory(self, directory): """ add a search of the directory to the queue """ exclude_path_regexes = self.exclude_path_regexes[:] if not self.search_hidden: exclude_path_regexes.append(self.hidden_file_regex) else: exclude_path_regex...
[ "def", "enqueue_directory", "(", "self", ",", "directory", ")", ":", "exclude_path_regexes", "=", "self", ".", "exclude_path_regexes", "[", ":", "]", "if", "not", "self", ".", "search_hidden", ":", "exclude_path_regexes", ".", "append", "(", "self", ".", "hidd...
add a search of the directory to the queue
[ "add", "a", "search", "of", "the", "directory", "to", "the", "queue" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L103-L158
249,912
elijahr/lk
lk.py
SearchManager.search_worker
def search_worker(self, regex, directory_path, names, binary=False, callback=None): """ build a DirectoryResult for the given regex, directory path, and file names """ try: result = DirectoryResult(directory_path) def find_matches(name): ...
python
def search_worker(self, regex, directory_path, names, binary=False, callback=None): """ build a DirectoryResult for the given regex, directory path, and file names """ try: result = DirectoryResult(directory_path) def find_matches(name): ...
[ "def", "search_worker", "(", "self", ",", "regex", ",", "directory_path", ",", "names", ",", "binary", "=", "False", ",", "callback", "=", "None", ")", ":", "try", ":", "result", "=", "DirectoryResult", "(", "directory_path", ")", "def", "find_matches", "(...
build a DirectoryResult for the given regex, directory path, and file names
[ "build", "a", "DirectoryResult", "for", "the", "given", "regex", "directory", "path", "and", "file", "names" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L160-L184
249,913
elijahr/lk
lk.py
ColorWriter.print_result
def print_result(self, directory_result): """ Print out the contents of the directory result, using ANSI color codes if supported """ for file_name, line_results_dict in directory_result.iter_line_results_items(): full_path = path.join(directory_result.directory_path,...
python
def print_result(self, directory_result): """ Print out the contents of the directory result, using ANSI color codes if supported """ for file_name, line_results_dict in directory_result.iter_line_results_items(): full_path = path.join(directory_result.directory_path,...
[ "def", "print_result", "(", "self", ",", "directory_result", ")", ":", "for", "file_name", ",", "line_results_dict", "in", "directory_result", ".", "iter_line_results_items", "(", ")", ":", "full_path", "=", "path", ".", "join", "(", "directory_result", ".", "di...
Print out the contents of the directory result, using ANSI color codes if supported
[ "Print", "out", "the", "contents", "of", "the", "directory", "result", "using", "ANSI", "color", "codes", "if", "supported" ]
78f10909b1d8bb3ebe16223dd5438a1201b7db97
https://github.com/elijahr/lk/blob/78f10909b1d8bb3ebe16223dd5438a1201b7db97/lk.py#L237-L256
249,914
ojake/django-tracked-model
tracked_model/models.py
RequestInfo.create_or_get_from_request
def create_or_get_from_request(request): """Returns `RequestInfo` instance. If object was already created during ``request`` it is returned. Otherwise new instance is created with details populated from ``request``. New instance is then cached for reuse on subsequential calls. ...
python
def create_or_get_from_request(request): """Returns `RequestInfo` instance. If object was already created during ``request`` it is returned. Otherwise new instance is created with details populated from ``request``. New instance is then cached for reuse on subsequential calls. ...
[ "def", "create_or_get_from_request", "(", "request", ")", ":", "saved", "=", "getattr", "(", "request", ",", "REQUEST_CACHE_FIELD", ",", "None", ")", "if", "isinstance", "(", "saved", ",", "RequestInfo", ")", ":", "return", "saved", "req", "=", "RequestInfo", ...
Returns `RequestInfo` instance. If object was already created during ``request`` it is returned. Otherwise new instance is created with details populated from ``request``. New instance is then cached for reuse on subsequential calls.
[ "Returns", "RequestInfo", "instance", "." ]
19bc48874dd2e5fb5defedc6b8c5c3915cce1424
https://github.com/ojake/django-tracked-model/blob/19bc48874dd2e5fb5defedc6b8c5c3915cce1424/tracked_model/models.py#L21-L42
249,915
ojake/django-tracked-model
tracked_model/models.py
History.materialize
def materialize(self): """Returns instance of ``TrackedModel`` created from current ``History`` snapshot. To rollback to current snapshot, simply call ``save`` on materialized object. """ if self.action_type == ActionType.DELETE: # On deletion current state is...
python
def materialize(self): """Returns instance of ``TrackedModel`` created from current ``History`` snapshot. To rollback to current snapshot, simply call ``save`` on materialized object. """ if self.action_type == ActionType.DELETE: # On deletion current state is...
[ "def", "materialize", "(", "self", ")", ":", "if", "self", ".", "action_type", "==", "ActionType", ".", "DELETE", ":", "# On deletion current state is dumped to change_log", "# so it's enough to just restore it to object", "data", "=", "serializer", ".", "from_json", "(",...
Returns instance of ``TrackedModel`` created from current ``History`` snapshot. To rollback to current snapshot, simply call ``save`` on materialized object.
[ "Returns", "instance", "of", "TrackedModel", "created", "from", "current", "History", "snapshot", ".", "To", "rollback", "to", "current", "snapshot", "simply", "call", "save", "on", "materialized", "object", "." ]
19bc48874dd2e5fb5defedc6b8c5c3915cce1424
https://github.com/ojake/django-tracked-model/blob/19bc48874dd2e5fb5defedc6b8c5c3915cce1424/tracked_model/models.py#L79-L108
249,916
xtrementl/focus
focus/plugin/registration.py
_is_plugin_disabled
def _is_plugin_disabled(plugin): """ Determines if provided plugin is disabled from running for the active task. """ item = _registered.get(plugin.name) if not item: return False _, props = item return bool(props.get('disabled'))
python
def _is_plugin_disabled(plugin): """ Determines if provided plugin is disabled from running for the active task. """ item = _registered.get(plugin.name) if not item: return False _, props = item return bool(props.get('disabled'))
[ "def", "_is_plugin_disabled", "(", "plugin", ")", ":", "item", "=", "_registered", ".", "get", "(", "plugin", ".", "name", ")", "if", "not", "item", ":", "return", "False", "_", ",", "props", "=", "item", "return", "bool", "(", "props", ".", "get", "...
Determines if provided plugin is disabled from running for the active task.
[ "Determines", "if", "provided", "plugin", "is", "disabled", "from", "running", "for", "the", "active", "task", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L25-L34
249,917
xtrementl/focus
focus/plugin/registration.py
_setup_events
def _setup_events(plugin): """ Handles setup or teardown of event hook registration for the provided plugin. `plugin` ``Plugin`` class. """ events = plugin.events if events and isinstance(events, (list, tuple)): for event in [e for e in events if e in _EVENT_VA...
python
def _setup_events(plugin): """ Handles setup or teardown of event hook registration for the provided plugin. `plugin` ``Plugin`` class. """ events = plugin.events if events and isinstance(events, (list, tuple)): for event in [e for e in events if e in _EVENT_VA...
[ "def", "_setup_events", "(", "plugin", ")", ":", "events", "=", "plugin", ".", "events", "if", "events", "and", "isinstance", "(", "events", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "event", "in", "[", "e", "for", "e", "in", "events", ...
Handles setup or teardown of event hook registration for the provided plugin. `plugin` ``Plugin`` class.
[ "Handles", "setup", "or", "teardown", "of", "event", "hook", "registration", "for", "the", "provided", "plugin", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L49-L61
249,918
xtrementl/focus
focus/plugin/registration.py
_setup_options
def _setup_options(plugin): """ Handles setup or teardown of option hook registration for the provided plugin. `plugin` ``Plugin`` class. """ options = plugin.options if options and isinstance(options, (list, tuple)): for props in options: if isinst...
python
def _setup_options(plugin): """ Handles setup or teardown of option hook registration for the provided plugin. `plugin` ``Plugin`` class. """ options = plugin.options if options and isinstance(options, (list, tuple)): for props in options: if isinst...
[ "def", "_setup_options", "(", "plugin", ")", ":", "options", "=", "plugin", ".", "options", "if", "options", "and", "isinstance", "(", "options", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "props", "in", "options", ":", "if", "isinstance", "...
Handles setup or teardown of option hook registration for the provided plugin. `plugin` ``Plugin`` class.
[ "Handles", "setup", "or", "teardown", "of", "option", "hook", "registration", "for", "the", "provided", "plugin", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L64-L94
249,919
xtrementl/focus
focus/plugin/registration.py
register
def register(hook_type, key, plugin_cls, properties=None): """ Handles registration of a plugin hook in the global registries. `hook_type` Type of hook to register ('event', 'command', or 'option') `key` Unique key associated with `hook_type` and `plugin`. Value ...
python
def register(hook_type, key, plugin_cls, properties=None): """ Handles registration of a plugin hook in the global registries. `hook_type` Type of hook to register ('event', 'command', or 'option') `key` Unique key associated with `hook_type` and `plugin`. Value ...
[ "def", "register", "(", "hook_type", ",", "key", ",", "plugin_cls", ",", "properties", "=", "None", ")", ":", "def", "fetch_plugin", "(", ")", ":", "\"\"\" This function is used as a lazy evaluation of fetching the\n specified plugin. This is required, because at the...
Handles registration of a plugin hook in the global registries. `hook_type` Type of hook to register ('event', 'command', or 'option') `key` Unique key associated with `hook_type` and `plugin`. Value depends on type:: 'command' - Name of the command ...
[ "Handles", "registration", "of", "a", "plugin", "hook", "in", "the", "global", "registries", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L106-L167
249,920
xtrementl/focus
focus/plugin/registration.py
setup_sudo_access
def setup_sudo_access(plugin): """ Injects a `run_root` method into the provided plugin instance that forks a shell command using sudo. Used for command plugin needs. `plugin` ``Plugin`` instance. """ def run_root(self, command): """ Executes a shell command as root...
python
def setup_sudo_access(plugin): """ Injects a `run_root` method into the provided plugin instance that forks a shell command using sudo. Used for command plugin needs. `plugin` ``Plugin`` instance. """ def run_root(self, command): """ Executes a shell command as root...
[ "def", "setup_sudo_access", "(", "plugin", ")", ":", "def", "run_root", "(", "self", ",", "command", ")", ":", "\"\"\" Executes a shell command as root.\n\n `command`\n Shell command string.\n\n Returns boolean.\n \"\"\"", "try", ":", ...
Injects a `run_root` method into the provided plugin instance that forks a shell command using sudo. Used for command plugin needs. `plugin` ``Plugin`` instance.
[ "Injects", "a", "run_root", "method", "into", "the", "provided", "plugin", "instance", "that", "forks", "a", "shell", "command", "using", "sudo", ".", "Used", "for", "command", "plugin", "needs", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L181-L203
249,921
xtrementl/focus
focus/plugin/registration.py
get_registered
def get_registered(option_hooks=None, event_hooks=None, command_hooks=None, root_access=None, task_active=True): """ Returns a generator of registered plugins matching filters. `option_hooks` Boolean to include or exclude plugins using option hooks. ...
python
def get_registered(option_hooks=None, event_hooks=None, command_hooks=None, root_access=None, task_active=True): """ Returns a generator of registered plugins matching filters. `option_hooks` Boolean to include or exclude plugins using option hooks. ...
[ "def", "get_registered", "(", "option_hooks", "=", "None", ",", "event_hooks", "=", "None", ",", "command_hooks", "=", "None", ",", "root_access", "=", "None", ",", "task_active", "=", "True", ")", ":", "plugins", "=", "[", "]", "for", "_", ",", "item", ...
Returns a generator of registered plugins matching filters. `option_hooks` Boolean to include or exclude plugins using option hooks. `event_hooks` Boolean to include or exclude task event plugins. `command_hooks` Boolean to include or exclude command plugins....
[ "Returns", "a", "generator", "of", "registered", "plugins", "matching", "filters", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L206-L256
249,922
xtrementl/focus
focus/plugin/registration.py
get_command_hook
def get_command_hook(command, task_active=True): """ Gets registered command ``Plugin`` instance for the provided command. `command` Command string registered to a plugin. `task_active` Set to ``False`` to indicate no active tasks. Returns ``Plugin`` instanc...
python
def get_command_hook(command, task_active=True): """ Gets registered command ``Plugin`` instance for the provided command. `command` Command string registered to a plugin. `task_active` Set to ``False`` to indicate no active tasks. Returns ``Plugin`` instanc...
[ "def", "get_command_hook", "(", "command", ",", "task_active", "=", "True", ")", ":", "plugin_obj", "=", "_command_hooks", ".", "get", "(", "command", ")", "if", "plugin_obj", ":", "if", "task_active", "or", "(", "not", "plugin_obj", ".", "options", "and", ...
Gets registered command ``Plugin`` instance for the provided command. `command` Command string registered to a plugin. `task_active` Set to ``False`` to indicate no active tasks. Returns ``Plugin`` instance or ``None``.
[ "Gets", "registered", "command", "Plugin", "instance", "for", "the", "provided", "command", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L259-L280
249,923
xtrementl/focus
focus/plugin/registration.py
run_event_hooks
def run_event_hooks(event, task): """ Executes registered task event plugins for the provided event and task. `event` Name of the event to trigger for the plugin: ('task_start', 'task_run', 'task_end') `task` ``Task`` instance. """ # get chain of...
python
def run_event_hooks(event, task): """ Executes registered task event plugins for the provided event and task. `event` Name of the event to trigger for the plugin: ('task_start', 'task_run', 'task_end') `task` ``Task`` instance. """ # get chain of...
[ "def", "run_event_hooks", "(", "event", ",", "task", ")", ":", "# get chain of classes registered for this event", "call_chain", "=", "_event_hooks", ".", "get", "(", "event", ")", "if", "call_chain", ":", "# lookup the associated class method for this event", "event_method...
Executes registered task event plugins for the provided event and task. `event` Name of the event to trigger for the plugin: ('task_start', 'task_run', 'task_end') `task` ``Task`` instance.
[ "Executes", "registered", "task", "event", "plugins", "for", "the", "provided", "event", "and", "task", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L283-L314
249,924
xtrementl/focus
focus/plugin/registration.py
run_option_hooks
def run_option_hooks(parser, disable_missing=True): """ Executes registered plugins using option hooks for the provided ``SettingParser`` instance. `parser` ``SettingParser`` instance. `disable_missing` Set to ``True`` to disable any plugins using option hooks whose ...
python
def run_option_hooks(parser, disable_missing=True): """ Executes registered plugins using option hooks for the provided ``SettingParser`` instance. `parser` ``SettingParser`` instance. `disable_missing` Set to ``True`` to disable any plugins using option hooks whose ...
[ "def", "run_option_hooks", "(", "parser", ",", "disable_missing", "=", "True", ")", ":", "plugins", "=", "[", "]", "state", "=", "{", "}", "# state information", "def", "_raise_error", "(", "msg", ",", "block", ")", ":", "\"\"\" Raises ``InvalidTaskConfig`` exce...
Executes registered plugins using option hooks for the provided ``SettingParser`` instance. `parser` ``SettingParser`` instance. `disable_missing` Set to ``True`` to disable any plugins using option hooks whose defined option hooks are not available in the da...
[ "Executes", "registered", "plugins", "using", "option", "hooks", "for", "the", "provided", "SettingParser", "instance", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/registration.py#L317-L395
249,925
shoppimon/figcan
figcan/figcan.py
_recursive_merge
def _recursive_merge(dct, merge_dct, raise_on_missing): # type: (Dict[str, Any], Dict[str, Any], bool) -> Dict[str, Any] """Recursive dict merge This modifies `dct` in place. Use `copy.deepcopy` if this behavior is not desired. """ for k, v in merge_dct.items(): if k in dct: if ...
python
def _recursive_merge(dct, merge_dct, raise_on_missing): # type: (Dict[str, Any], Dict[str, Any], bool) -> Dict[str, Any] """Recursive dict merge This modifies `dct` in place. Use `copy.deepcopy` if this behavior is not desired. """ for k, v in merge_dct.items(): if k in dct: if ...
[ "def", "_recursive_merge", "(", "dct", ",", "merge_dct", ",", "raise_on_missing", ")", ":", "# type: (Dict[str, Any], Dict[str, Any], bool) -> Dict[str, Any]", "for", "k", ",", "v", "in", "merge_dct", ".", "items", "(", ")", ":", "if", "k", "in", "dct", ":", "if...
Recursive dict merge This modifies `dct` in place. Use `copy.deepcopy` if this behavior is not desired.
[ "Recursive", "dict", "merge" ]
bdfa59ceed33277c060fc009fbf44c41b9852681
https://github.com/shoppimon/figcan/blob/bdfa59ceed33277c060fc009fbf44c41b9852681/figcan/figcan.py#L109-L130
249,926
shoppimon/figcan
figcan/figcan.py
Configuration.apply
def apply(self, config, raise_on_unknown_key=True): # type: (Dict[str, Any], bool) -> None """Apply additional configuration from a dictionary This will look for dictionary items that exist in the base_config any apply their values on the current configuration object """ ...
python
def apply(self, config, raise_on_unknown_key=True): # type: (Dict[str, Any], bool) -> None """Apply additional configuration from a dictionary This will look for dictionary items that exist in the base_config any apply their values on the current configuration object """ ...
[ "def", "apply", "(", "self", ",", "config", ",", "raise_on_unknown_key", "=", "True", ")", ":", "# type: (Dict[str, Any], bool) -> None", "_recursive_merge", "(", "self", ".", "_data", ",", "config", ",", "raise_on_unknown_key", ")" ]
Apply additional configuration from a dictionary This will look for dictionary items that exist in the base_config any apply their values on the current configuration object
[ "Apply", "additional", "configuration", "from", "a", "dictionary" ]
bdfa59ceed33277c060fc009fbf44c41b9852681
https://github.com/shoppimon/figcan/blob/bdfa59ceed33277c060fc009fbf44c41b9852681/figcan/figcan.py#L35-L42
249,927
shoppimon/figcan
figcan/figcan.py
Configuration.apply_object
def apply_object(self, config_obj, apply_on=None): # type: (object, Optional[Tuple[str, ...]]) -> None """Apply additional configuration from any Python object This will look for object attributes that exist in the base_config and apply their values on the current configuration object ...
python
def apply_object(self, config_obj, apply_on=None): # type: (object, Optional[Tuple[str, ...]]) -> None """Apply additional configuration from any Python object This will look for object attributes that exist in the base_config and apply their values on the current configuration object ...
[ "def", "apply_object", "(", "self", ",", "config_obj", ",", "apply_on", "=", "None", ")", ":", "# type: (object, Optional[Tuple[str, ...]]) -> None", "self", ".", "_init_flat_pointers", "(", ")", "try", ":", "config_obj_keys", "=", "vars", "(", "config_obj", ")", ...
Apply additional configuration from any Python object This will look for object attributes that exist in the base_config and apply their values on the current configuration object
[ "Apply", "additional", "configuration", "from", "any", "Python", "object" ]
bdfa59ceed33277c060fc009fbf44c41b9852681
https://github.com/shoppimon/figcan/blob/bdfa59ceed33277c060fc009fbf44c41b9852681/figcan/figcan.py#L44-L65
249,928
shoppimon/figcan
figcan/figcan.py
Configuration.apply_flat
def apply_flat(self, config, namespace_separator='_', prefix=''): # type: (Dict[str, Any], str, str) -> None """Apply additional configuration from a flattened dictionary This will look for dictionary items that match flattened keys from base_config and apply their values on the current...
python
def apply_flat(self, config, namespace_separator='_', prefix=''): # type: (Dict[str, Any], str, str) -> None """Apply additional configuration from a flattened dictionary This will look for dictionary items that match flattened keys from base_config and apply their values on the current...
[ "def", "apply_flat", "(", "self", ",", "config", ",", "namespace_separator", "=", "'_'", ",", "prefix", "=", "''", ")", ":", "# type: (Dict[str, Any], str, str) -> None", "self", ".", "_init_flat_pointers", "(", ")", "for", "key_stack", ",", "(", "container", ",...
Apply additional configuration from a flattened dictionary This will look for dictionary items that match flattened keys from base_config and apply their values on the current configuration object. This can be useful for applying configuration from environment variables and flat configuration ...
[ "Apply", "additional", "configuration", "from", "a", "flattened", "dictionary" ]
bdfa59ceed33277c060fc009fbf44c41b9852681
https://github.com/shoppimon/figcan/blob/bdfa59ceed33277c060fc009fbf44c41b9852681/figcan/figcan.py#L67-L81
249,929
databuild/databuild
databuild/functions/data.py
cross
def cross(environment, book, row, sheet_source, column_source, column_key): """ Returns a single value from a column from a different dataset, matching by the key. """ a = book.sheets[sheet_source] return environment.copy(a.get(**{column_key: row[column_key]})[column_source])
python
def cross(environment, book, row, sheet_source, column_source, column_key): """ Returns a single value from a column from a different dataset, matching by the key. """ a = book.sheets[sheet_source] return environment.copy(a.get(**{column_key: row[column_key]})[column_source])
[ "def", "cross", "(", "environment", ",", "book", ",", "row", ",", "sheet_source", ",", "column_source", ",", "column_key", ")", ":", "a", "=", "book", ".", "sheets", "[", "sheet_source", "]", "return", "environment", ".", "copy", "(", "a", ".", "get", ...
Returns a single value from a column from a different dataset, matching by the key.
[ "Returns", "a", "single", "value", "from", "a", "column", "from", "a", "different", "dataset", "matching", "by", "the", "key", "." ]
4c8ee04fad1748f5b966753057ac05efbc289b10
https://github.com/databuild/databuild/blob/4c8ee04fad1748f5b966753057ac05efbc289b10/databuild/functions/data.py#L1-L7
249,930
databuild/databuild
databuild/functions/data.py
column
def column(environment, book, sheet_name, sheet_source, column_source, column_key): """ Returns an array of values from column from a different dataset, ordered as the key. """ a = book.sheets[sheet_source] b = book.sheets[sheet_name] return environment.copy([a.get(**{column_key: row[column_key...
python
def column(environment, book, sheet_name, sheet_source, column_source, column_key): """ Returns an array of values from column from a different dataset, ordered as the key. """ a = book.sheets[sheet_source] b = book.sheets[sheet_name] return environment.copy([a.get(**{column_key: row[column_key...
[ "def", "column", "(", "environment", ",", "book", ",", "sheet_name", ",", "sheet_source", ",", "column_source", ",", "column_key", ")", ":", "a", "=", "book", ".", "sheets", "[", "sheet_source", "]", "b", "=", "book", ".", "sheets", "[", "sheet_name", "]...
Returns an array of values from column from a different dataset, ordered as the key.
[ "Returns", "an", "array", "of", "values", "from", "column", "from", "a", "different", "dataset", "ordered", "as", "the", "key", "." ]
4c8ee04fad1748f5b966753057ac05efbc289b10
https://github.com/databuild/databuild/blob/4c8ee04fad1748f5b966753057ac05efbc289b10/databuild/functions/data.py#L10-L17
249,931
hyperknot/image2leaflet
image2leaflet/cli.py
main
def main(input_file, output, format): """Converts an image file to a Leaflet map.""" try: process_image(input_file, subfolder=output, ext=format) except Exception as e: sys.exit(e)
python
def main(input_file, output, format): """Converts an image file to a Leaflet map.""" try: process_image(input_file, subfolder=output, ext=format) except Exception as e: sys.exit(e)
[ "def", "main", "(", "input_file", ",", "output", ",", "format", ")", ":", "try", ":", "process_image", "(", "input_file", ",", "subfolder", "=", "output", ",", "ext", "=", "format", ")", "except", "Exception", "as", "e", ":", "sys", ".", "exit", "(", ...
Converts an image file to a Leaflet map.
[ "Converts", "an", "image", "file", "to", "a", "Leaflet", "map", "." ]
b89bef03b8ac99227386a2a9fa12e2998a508d64
https://github.com/hyperknot/image2leaflet/blob/b89bef03b8ac99227386a2a9fa12e2998a508d64/image2leaflet/cli.py#L11-L17
249,932
rackerlabs/silverberg
silverberg/lock.py
with_lock
def with_lock(lock, func, *args, **kwargs): """A 'context manager' for performing operations requiring a lock. :param lock: A BasicLock instance :type lock: silverberg.lock.BasicLock :param func: A callable to execute while the lock is held. :type func: function """ d = lock.acquire() ...
python
def with_lock(lock, func, *args, **kwargs): """A 'context manager' for performing operations requiring a lock. :param lock: A BasicLock instance :type lock: silverberg.lock.BasicLock :param func: A callable to execute while the lock is held. :type func: function """ d = lock.acquire() ...
[ "def", "with_lock", "(", "lock", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "d", "=", "lock", ".", "acquire", "(", ")", "def", "release_lock", "(", "result", ")", ":", "deferred", "=", "lock", ".", "release", "(", ")", "ret...
A 'context manager' for performing operations requiring a lock. :param lock: A BasicLock instance :type lock: silverberg.lock.BasicLock :param func: A callable to execute while the lock is held. :type func: function
[ "A", "context", "manager", "for", "performing", "operations", "requiring", "a", "lock", "." ]
c6fae78923a019f1615e9516ab30fa105c72a542
https://github.com/rackerlabs/silverberg/blob/c6fae78923a019f1615e9516ab30fa105c72a542/silverberg/lock.py#L217-L236
249,933
fedora-infra/fmn.rules
fmn/rules/buildsys.py
koji_instance
def koji_instance(config, message, instance=None, *args, **kw): """ Particular koji instances You may not have even known it, but we have multiple instances of the koji build system. There is the **primary** buildsystem at `koji.fedoraproject.org <http://koji.fedoraproject.org>`_ and also secondar...
python
def koji_instance(config, message, instance=None, *args, **kw): """ Particular koji instances You may not have even known it, but we have multiple instances of the koji build system. There is the **primary** buildsystem at `koji.fedoraproject.org <http://koji.fedoraproject.org>`_ and also secondar...
[ "def", "koji_instance", "(", "config", ",", "message", ",", "instance", "=", "None", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "instance", "=", "kw", ".", "get", "(", "'instance'", ",", "instance", ")", "if", "not", "instance", ":", "return", ...
Particular koji instances You may not have even known it, but we have multiple instances of the koji build system. There is the **primary** buildsystem at `koji.fedoraproject.org <http://koji.fedoraproject.org>`_ and also secondary instances for `ppc <http://ppc.koji.fedoraproject.org>`_, `arm <ht...
[ "Particular", "koji", "instances" ]
f9ec790619fcc8b41803077c4dec094e5127fc24
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/buildsys.py#L17-L42
249,934
kervi/kervi-core
kervi/values/value_list.py
ValueList.add
def add(self, value_id, name, value_class): """ Factory function that creates a value. :param value_id: id of the value, used to reference the value within this list.BaseException :param value_class: The class of the value that should be created with this function. """ ...
python
def add(self, value_id, name, value_class): """ Factory function that creates a value. :param value_id: id of the value, used to reference the value within this list.BaseException :param value_class: The class of the value that should be created with this function. """ ...
[ "def", "add", "(", "self", ",", "value_id", ",", "name", ",", "value_class", ")", ":", "item", "=", "value_class", "(", "name", ",", "value_id", "=", "self", ".", "controller", ".", "component_id", "+", "\".\"", "+", "value_id", ",", "is_input", "=", "...
Factory function that creates a value. :param value_id: id of the value, used to reference the value within this list.BaseException :param value_class: The class of the value that should be created with this function.
[ "Factory", "function", "that", "creates", "a", "value", "." ]
3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23
https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/values/value_list.py#L20-L44
249,935
bmweiner/skillful
skillful/controller.py
Skill.register
def register(self, name): """Decorator for registering a named function in the sesion logic. Args: name: str. Function name. func: obj. Parameterless function to register. The following named functions must be registered: 'LaunchRequest' - logic for launch r...
python
def register(self, name): """Decorator for registering a named function in the sesion logic. Args: name: str. Function name. func: obj. Parameterless function to register. The following named functions must be registered: 'LaunchRequest' - logic for launch r...
[ "def", "register", "(", "self", ",", "name", ")", ":", "def", "decorator", "(", "func", ")", ":", "\"\"\"Inner decorator, not used directly.\n\n Args:\n func: obj. Parameterless function to register.\n\n Returns:\n func: decorated funct...
Decorator for registering a named function in the sesion logic. Args: name: str. Function name. func: obj. Parameterless function to register. The following named functions must be registered: 'LaunchRequest' - logic for launch request. 'SessionEndedRequ...
[ "Decorator", "for", "registering", "a", "named", "function", "in", "the", "sesion", "logic", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/controller.py#L49-L81
249,936
bmweiner/skillful
skillful/controller.py
Skill.pass_session_attributes
def pass_session_attributes(self): """Copies request attributes to response""" for key, value in six.iteritems(self.request.session.attributes): self.response.sessionAttributes[key] = value
python
def pass_session_attributes(self): """Copies request attributes to response""" for key, value in six.iteritems(self.request.session.attributes): self.response.sessionAttributes[key] = value
[ "def", "pass_session_attributes", "(", "self", ")", ":", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "self", ".", "request", ".", "session", ".", "attributes", ")", ":", "self", ".", "response", ".", "sessionAttributes", "[", "key", "...
Copies request attributes to response
[ "Copies", "request", "attributes", "to", "response" ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/controller.py#L83-L86
249,937
bmweiner/skillful
skillful/controller.py
Skill.dispatch
def dispatch(self): """Calls the matching logic function by request type or intent name.""" if self.request.request.type == 'IntentRequest': name = self.request.request.intent.name else: name = self.request.request.type if name in self.logic: self.lo...
python
def dispatch(self): """Calls the matching logic function by request type or intent name.""" if self.request.request.type == 'IntentRequest': name = self.request.request.intent.name else: name = self.request.request.type if name in self.logic: self.lo...
[ "def", "dispatch", "(", "self", ")", ":", "if", "self", ".", "request", ".", "request", ".", "type", "==", "'IntentRequest'", ":", "name", "=", "self", ".", "request", ".", "request", ".", "intent", ".", "name", "else", ":", "name", "=", "self", ".",...
Calls the matching logic function by request type or intent name.
[ "Calls", "the", "matching", "logic", "function", "by", "request", "type", "or", "intent", "name", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/controller.py#L92-L104
249,938
bmweiner/skillful
skillful/controller.py
Skill.process
def process(self, body, url=None, sig=None): """Process request body given skill logic. To validate a request, both, url and sig are required. Attributes received through body will be automatically added to the response. Args: body: str. HTTP request body. ...
python
def process(self, body, url=None, sig=None): """Process request body given skill logic. To validate a request, both, url and sig are required. Attributes received through body will be automatically added to the response. Args: body: str. HTTP request body. ...
[ "def", "process", "(", "self", ",", "body", ",", "url", "=", "None", ",", "sig", "=", "None", ")", ":", "self", ".", "request", "=", "RequestBody", "(", ")", "self", ".", "response", "=", "ResponseBody", "(", ")", "self", ".", "request", ".", "pars...
Process request body given skill logic. To validate a request, both, url and sig are required. Attributes received through body will be automatically added to the response. Args: body: str. HTTP request body. url: str. SignatureCertChainUrl header value sen...
[ "Process", "request", "body", "given", "skill", "logic", "." ]
8646f54faf62cb63f165f7699b8ace5b4a08233c
https://github.com/bmweiner/skillful/blob/8646f54faf62cb63f165f7699b8ace5b4a08233c/skillful/controller.py#L106-L142
249,939
hkff/FodtlMon
fodtlmon/ltl/ltl.py
Formula.walk
def walk(self, filters: str=None, filter_type: type=None, pprint=False, depth=-1): """ Iterate tree in pre-order wide-first search order :param filters: filter by python expression :param filter_type: Filter by class :return: """ children = self.children() ...
python
def walk(self, filters: str=None, filter_type: type=None, pprint=False, depth=-1): """ Iterate tree in pre-order wide-first search order :param filters: filter by python expression :param filter_type: Filter by class :return: """ children = self.children() ...
[ "def", "walk", "(", "self", ",", "filters", ":", "str", "=", "None", ",", "filter_type", ":", "type", "=", "None", ",", "pprint", "=", "False", ",", "depth", "=", "-", "1", ")", ":", "children", "=", "self", ".", "children", "(", ")", "if", "chil...
Iterate tree in pre-order wide-first search order :param filters: filter by python expression :param filter_type: Filter by class :return:
[ "Iterate", "tree", "in", "pre", "-", "order", "wide", "-", "first", "search", "order" ]
0c9015a1a1f0a4a64d52945c86b45441d5871c56
https://github.com/hkff/FodtlMon/blob/0c9015a1a1f0a4a64d52945c86b45441d5871c56/fodtlmon/ltl/ltl.py#L73-L113
249,940
knagra/farnsworth
workshift/redirects.py
red_workshift
def red_workshift(request, message=None): ''' Redirects to the base workshift page for users who are logged in ''' if message: messages.add_message(request, messages.ERROR, message) return HttpResponseRedirect(reverse('workshift:view_semester'))
python
def red_workshift(request, message=None): ''' Redirects to the base workshift page for users who are logged in ''' if message: messages.add_message(request, messages.ERROR, message) return HttpResponseRedirect(reverse('workshift:view_semester'))
[ "def", "red_workshift", "(", "request", ",", "message", "=", "None", ")", ":", "if", "message", ":", "messages", ".", "add_message", "(", "request", ",", "messages", ".", "ERROR", ",", "message", ")", "return", "HttpResponseRedirect", "(", "reverse", "(", ...
Redirects to the base workshift page for users who are logged in
[ "Redirects", "to", "the", "base", "workshift", "page", "for", "users", "who", "are", "logged", "in" ]
1b6589f0d9fea154f0a1e2231ed906764ed26d26
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/workshift/redirects.py#L6-L12
249,941
raphendyr/django-settingsdict
django_settingsdict/__init__.py
SettingsDict._user_settings
def _user_settings(self): """ Resolve settings dict from django settings module. Validate that all the required keys are present and also that none of the removed keys do. Result is cached. """ user_settings = getattr(settings, self._name, {}) if not user_...
python
def _user_settings(self): """ Resolve settings dict from django settings module. Validate that all the required keys are present and also that none of the removed keys do. Result is cached. """ user_settings = getattr(settings, self._name, {}) if not user_...
[ "def", "_user_settings", "(", "self", ")", ":", "user_settings", "=", "getattr", "(", "settings", ",", "self", ".", "_name", ",", "{", "}", ")", "if", "not", "user_settings", "and", "self", ".", "_required", ":", "raise", "ImproperlyConfigured", "(", "\"Se...
Resolve settings dict from django settings module. Validate that all the required keys are present and also that none of the removed keys do. Result is cached.
[ "Resolve", "settings", "dict", "from", "django", "settings", "module", ".", "Validate", "that", "all", "the", "required", "keys", "are", "present", "and", "also", "that", "none", "of", "the", "removed", "keys", "do", ".", "Result", "is", "cached", "." ]
655f8e86b0af46ee6a5615fdbeeaf81ae7ec8e0f
https://github.com/raphendyr/django-settingsdict/blob/655f8e86b0af46ee6a5615fdbeeaf81ae7ec8e0f/django_settingsdict/__init__.py#L18-L38
249,942
MickaelRigault/propobject
propobject/baseobject.py
BaseObject.copy
def copy(self, empty=False): """returns an independent copy of the current object.""" # Create an empty object newobject = self.__new__(self.__class__) if empty: return # And fill it ! for prop in ["_properties","_side_properties", ...
python
def copy(self, empty=False): """returns an independent copy of the current object.""" # Create an empty object newobject = self.__new__(self.__class__) if empty: return # And fill it ! for prop in ["_properties","_side_properties", ...
[ "def", "copy", "(", "self", ",", "empty", "=", "False", ")", ":", "# Create an empty object", "newobject", "=", "self", ".", "__new__", "(", "self", ".", "__class__", ")", "if", "empty", ":", "return", "# And fill it !", "for", "prop", "in", "[", "\"_prope...
returns an independent copy of the current object.
[ "returns", "an", "independent", "copy", "of", "the", "current", "object", "." ]
e58614f85e2df9811012807836a7b3c5f3b267f2
https://github.com/MickaelRigault/propobject/blob/e58614f85e2df9811012807836a7b3c5f3b267f2/propobject/baseobject.py#L97-L119
249,943
Gwildor/Pyromancer
pyromancer/objects.py
Match.msg
def msg(self, message, *args, **kwargs): """Shortcut to send a message through the connection. This function sends the input message through the connection. A target can be defined, else it will send it to the channel or user from the input Line, effectively responding on whatever trigg...
python
def msg(self, message, *args, **kwargs): """Shortcut to send a message through the connection. This function sends the input message through the connection. A target can be defined, else it will send it to the channel or user from the input Line, effectively responding on whatever trigg...
[ "def", "msg", "(", "self", ",", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "target", "=", "kwargs", ".", "pop", "(", "'target'", ",", "None", ")", "raw", "=", "kwargs", ".", "pop", "(", "'raw'", ",", "False", ")", "if", "no...
Shortcut to send a message through the connection. This function sends the input message through the connection. A target can be defined, else it will send it to the channel or user from the input Line, effectively responding on whatever triggered the command which calls this function t...
[ "Shortcut", "to", "send", "a", "message", "through", "the", "connection", "." ]
250a83ad4b6e87560bea8f2e0526ad0bba678f3d
https://github.com/Gwildor/Pyromancer/blob/250a83ad4b6e87560bea8f2e0526ad0bba678f3d/pyromancer/objects.py#L313-L353
249,944
spookey/photon
photon/util/system.py
shell_run
def shell_run(cmd, cin=None, cwd=None, timeout=10, critical=True, verbose=True): ''' Runs a shell command within a controlled environment. .. note:: |use_photon_m| :param cmd: The command to run * A string one would type into a console like \ :command:`git push -u origin...
python
def shell_run(cmd, cin=None, cwd=None, timeout=10, critical=True, verbose=True): ''' Runs a shell command within a controlled environment. .. note:: |use_photon_m| :param cmd: The command to run * A string one would type into a console like \ :command:`git push -u origin...
[ "def", "shell_run", "(", "cmd", ",", "cin", "=", "None", ",", "cwd", "=", "None", ",", "timeout", "=", "10", ",", "critical", "=", "True", ",", "verbose", "=", "True", ")", ":", "res", "=", "dict", "(", "command", "=", "cmd", ")", "if", "cin", ...
Runs a shell command within a controlled environment. .. note:: |use_photon_m| :param cmd: The command to run * A string one would type into a console like \ :command:`git push -u origin master`. * Will be split using :py:func:`shlex.split`. * It is possible to use a list he...
[ "Runs", "a", "shell", "command", "within", "a", "controlled", "environment", "." ]
57212a26ce713ab7723910ee49e3d0ba1697799f
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/util/system.py#L75-L180
249,945
spookey/photon
photon/util/system.py
get_timestamp
def get_timestamp(time=True, precice=False): ''' What time is it? :param time: Append ``-%H.%M.%S`` to the final string. :param precice: Append ``-%f`` to the final string. Is only recognized when `time` is set to ``True`` :returns: A timestamp string of now in the f...
python
def get_timestamp(time=True, precice=False): ''' What time is it? :param time: Append ``-%H.%M.%S`` to the final string. :param precice: Append ``-%f`` to the final string. Is only recognized when `time` is set to ``True`` :returns: A timestamp string of now in the f...
[ "def", "get_timestamp", "(", "time", "=", "True", ",", "precice", "=", "False", ")", ":", "f", "=", "'%Y.%m.%d'", "if", "time", ":", "f", "+=", "'-%H.%M.%S'", "if", "precice", ":", "f", "+=", "'-%f'", "return", "_datetime", ".", "now", "(", ")", ".",...
What time is it? :param time: Append ``-%H.%M.%S`` to the final string. :param precice: Append ``-%f`` to the final string. Is only recognized when `time` is set to ``True`` :returns: A timestamp string of now in the format ``%Y.%m.%d-%H.%M.%S-%f`` .. seealso:: `strftim...
[ "What", "time", "is", "it?" ]
57212a26ce713ab7723910ee49e3d0ba1697799f
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/util/system.py#L183-L203
249,946
spookey/photon
photon/util/system.py
get_hostname
def get_hostname(): ''' Determines the current hostname by probing ``uname -n``. Falls back to ``hostname`` in case of problems. |appteardown| if both failed (usually they don't but consider this if you are debugging weird problems..) :returns: The hostname as string. Domain parts wil...
python
def get_hostname(): ''' Determines the current hostname by probing ``uname -n``. Falls back to ``hostname`` in case of problems. |appteardown| if both failed (usually they don't but consider this if you are debugging weird problems..) :returns: The hostname as string. Domain parts wil...
[ "def", "get_hostname", "(", ")", ":", "h", "=", "shell_run", "(", "'uname -n'", ",", "critical", "=", "False", ",", "verbose", "=", "False", ")", "if", "not", "h", ":", "h", "=", "shell_run", "(", "'hostname'", ",", "critical", "=", "False", ",", "ve...
Determines the current hostname by probing ``uname -n``. Falls back to ``hostname`` in case of problems. |appteardown| if both failed (usually they don't but consider this if you are debugging weird problems..) :returns: The hostname as string. Domain parts will be split off
[ "Determines", "the", "current", "hostname", "by", "probing", "uname", "-", "n", ".", "Falls", "back", "to", "hostname", "in", "case", "of", "problems", "." ]
57212a26ce713ab7723910ee49e3d0ba1697799f
https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/util/system.py#L206-L223
249,947
coumbole/mailscanner
mailscanner/reader.py
ImapReader.open_connection
def open_connection(self, verbose=False): """ Initializes a new IMAP4_SSL connection to an email server.""" # Connect to server hostname = self.configs.get('IMAP', 'hostname') if verbose: print('Connecting to ' + hostname) connection = imaplib.IMAP4_SSL(hostname) ...
python
def open_connection(self, verbose=False): """ Initializes a new IMAP4_SSL connection to an email server.""" # Connect to server hostname = self.configs.get('IMAP', 'hostname') if verbose: print('Connecting to ' + hostname) connection = imaplib.IMAP4_SSL(hostname) ...
[ "def", "open_connection", "(", "self", ",", "verbose", "=", "False", ")", ":", "# Connect to server", "hostname", "=", "self", ".", "configs", ".", "get", "(", "'IMAP'", ",", "'hostname'", ")", "if", "verbose", ":", "print", "(", "'Connecting to '", "+", "...
Initializes a new IMAP4_SSL connection to an email server.
[ "Initializes", "a", "new", "IMAP4_SSL", "connection", "to", "an", "email", "server", "." ]
ead19ac8c7dee27e507c1593032863232c13f636
https://github.com/coumbole/mailscanner/blob/ead19ac8c7dee27e507c1593032863232c13f636/mailscanner/reader.py#L16-L32
249,948
coumbole/mailscanner
mailscanner/reader.py
ImapReader.get_body
def get_body(self, msg): """ Extracts and returns the decoded body from an EmailMessage object""" body = "" charset = "" if msg.is_multipart(): for part in msg.walk(): ctype = part.get_content_type() cdispo = str(part.get('Content-Disposition...
python
def get_body(self, msg): """ Extracts and returns the decoded body from an EmailMessage object""" body = "" charset = "" if msg.is_multipart(): for part in msg.walk(): ctype = part.get_content_type() cdispo = str(part.get('Content-Disposition...
[ "def", "get_body", "(", "self", ",", "msg", ")", ":", "body", "=", "\"\"", "charset", "=", "\"\"", "if", "msg", ".", "is_multipart", "(", ")", ":", "for", "part", "in", "msg", ".", "walk", "(", ")", ":", "ctype", "=", "part", ".", "get_content_type...
Extracts and returns the decoded body from an EmailMessage object
[ "Extracts", "and", "returns", "the", "decoded", "body", "from", "an", "EmailMessage", "object" ]
ead19ac8c7dee27e507c1593032863232c13f636
https://github.com/coumbole/mailscanner/blob/ead19ac8c7dee27e507c1593032863232c13f636/mailscanner/reader.py#L35-L57
249,949
coumbole/mailscanner
mailscanner/reader.py
ImapReader.get_subject
def get_subject(self, msg): """Extracts the subject line from an EmailMessage object.""" text, encoding = decode_header(msg['subject'])[-1] try: text = text.decode(encoding) # If it's already decoded, ignore error except AttributeError: pass re...
python
def get_subject(self, msg): """Extracts the subject line from an EmailMessage object.""" text, encoding = decode_header(msg['subject'])[-1] try: text = text.decode(encoding) # If it's already decoded, ignore error except AttributeError: pass re...
[ "def", "get_subject", "(", "self", ",", "msg", ")", ":", "text", ",", "encoding", "=", "decode_header", "(", "msg", "[", "'subject'", "]", ")", "[", "-", "1", "]", "try", ":", "text", "=", "text", ".", "decode", "(", "encoding", ")", "# If it's alrea...
Extracts the subject line from an EmailMessage object.
[ "Extracts", "the", "subject", "line", "from", "an", "EmailMessage", "object", "." ]
ead19ac8c7dee27e507c1593032863232c13f636
https://github.com/coumbole/mailscanner/blob/ead19ac8c7dee27e507c1593032863232c13f636/mailscanner/reader.py#L60-L72
249,950
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/action_plugins/async.py
ActionModule.run
def run(self, conn, tmp, module_name, module_args, inject): ''' transfer the given module name, plus the async module, then run it ''' # shell and command module are the same if module_name == 'shell': module_name = 'command' module_args += " #USE_SHELL" (module...
python
def run(self, conn, tmp, module_name, module_args, inject): ''' transfer the given module name, plus the async module, then run it ''' # shell and command module are the same if module_name == 'shell': module_name = 'command' module_args += " #USE_SHELL" (module...
[ "def", "run", "(", "self", ",", "conn", ",", "tmp", ",", "module_name", ",", "module_args", ",", "inject", ")", ":", "# shell and command module are the same", "if", "module_name", "==", "'shell'", ":", "module_name", "=", "'command'", "module_args", "+=", "\" #...
transfer the given module name, plus the async module, then run it
[ "transfer", "the", "given", "module", "name", "plus", "the", "async", "module", "then", "run", "it" ]
977409929dd81322d886425cdced10608117d5d7
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/action_plugins/async.py#L23-L39
249,951
b3j0f/conf
b3j0f/conf/model/cat.py
Category.getparams
def getparams(self, param): """Get parameters which match with input param. :param Parameter param: parameter to compare with this parameters. :rtype: list """ return list(cparam for cparam in self.values() if cparam == param)
python
def getparams(self, param): """Get parameters which match with input param. :param Parameter param: parameter to compare with this parameters. :rtype: list """ return list(cparam for cparam in self.values() if cparam == param)
[ "def", "getparams", "(", "self", ",", "param", ")", ":", "return", "list", "(", "cparam", "for", "cparam", "in", "self", ".", "values", "(", ")", "if", "cparam", "==", "param", ")" ]
Get parameters which match with input param. :param Parameter param: parameter to compare with this parameters. :rtype: list
[ "Get", "parameters", "which", "match", "with", "input", "param", "." ]
18dd6d5d6560f9b202793739e2330a2181163511
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/cat.py#L52-L59
249,952
mattimck/python-exist
exist/cli.py
main
def main(): """ Parse the arguments and use them to create a ExistCli object """ version = 'Python Exist %s' % __version__ arguments = docopt(__doc__, version=version) ExistCli(arguments)
python
def main(): """ Parse the arguments and use them to create a ExistCli object """ version = 'Python Exist %s' % __version__ arguments = docopt(__doc__, version=version) ExistCli(arguments)
[ "def", "main", "(", ")", ":", "version", "=", "'Python Exist %s'", "%", "__version__", "arguments", "=", "docopt", "(", "__doc__", ",", "version", "=", "version", ")", "ExistCli", "(", "arguments", ")" ]
Parse the arguments and use them to create a ExistCli object
[ "Parse", "the", "arguments", "and", "use", "them", "to", "create", "a", "ExistCli", "object" ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L210-L214
249,953
mattimck/python-exist
exist/cli.py
ExistCli.read_config
def read_config(self): """ Read credentials from the config file """ with open(self.config_file) as cfg: try: self.config.read_file(cfg) except AttributeError: self.config.readfp(cfg) self.client_id = self.config.get('exist', 'client_id') ...
python
def read_config(self): """ Read credentials from the config file """ with open(self.config_file) as cfg: try: self.config.read_file(cfg) except AttributeError: self.config.readfp(cfg) self.client_id = self.config.get('exist', 'client_id') ...
[ "def", "read_config", "(", "self", ")", ":", "with", "open", "(", "self", ".", "config_file", ")", "as", "cfg", ":", "try", ":", "self", ".", "config", ".", "read_file", "(", "cfg", ")", "except", "AttributeError", ":", "self", ".", "config", ".", "r...
Read credentials from the config file
[ "Read", "credentials", "from", "the", "config", "file" ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L86-L96
249,954
mattimck/python-exist
exist/cli.py
ExistCli.write_config
def write_config(self, access_token): """ Write credentials to the config file """ self.config.add_section('exist') # TODO: config is reading 'None' as string during authorization, so clearing this out # if no id or secret is set - need to fix this later if self.client_id: ...
python
def write_config(self, access_token): """ Write credentials to the config file """ self.config.add_section('exist') # TODO: config is reading 'None' as string during authorization, so clearing this out # if no id or secret is set - need to fix this later if self.client_id: ...
[ "def", "write_config", "(", "self", ",", "access_token", ")", ":", "self", ".", "config", ".", "add_section", "(", "'exist'", ")", "# TODO: config is reading 'None' as string during authorization, so clearing this out", "# if no id or secret is set - need to fix this later", "if"...
Write credentials to the config file
[ "Write", "credentials", "to", "the", "config", "file" ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L98-L118
249,955
mattimck/python-exist
exist/cli.py
ExistCli.get_resource
def get_resource(self, arguments): """ Gets the resource requested in the arguments """ attribute_name = arguments['<attribute_name>'] limit = arguments['--limit'] page = arguments['--page'] date_min = arguments['--date_min'] date_max = arguments['--date_max'] # ...
python
def get_resource(self, arguments): """ Gets the resource requested in the arguments """ attribute_name = arguments['<attribute_name>'] limit = arguments['--limit'] page = arguments['--page'] date_min = arguments['--date_min'] date_max = arguments['--date_max'] # ...
[ "def", "get_resource", "(", "self", ",", "arguments", ")", ":", "attribute_name", "=", "arguments", "[", "'<attribute_name>'", "]", "limit", "=", "arguments", "[", "'--limit'", "]", "page", "=", "arguments", "[", "'--page'", "]", "date_min", "=", "arguments", ...
Gets the resource requested in the arguments
[ "Gets", "the", "resource", "requested", "in", "the", "arguments" ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L120-L159
249,956
mattimck/python-exist
exist/cli.py
ExistCli.authorize
def authorize(self, api_token=None, username=None, password=None): """ Authorize a user using the browser and a CherryPy server, and write the resulting credentials to a config file. """ access_token = None if username and password: # if we have a username a...
python
def authorize(self, api_token=None, username=None, password=None): """ Authorize a user using the browser and a CherryPy server, and write the resulting credentials to a config file. """ access_token = None if username and password: # if we have a username a...
[ "def", "authorize", "(", "self", ",", "api_token", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ")", ":", "access_token", "=", "None", "if", "username", "and", "password", ":", "# if we have a username and password, go and collect a tok...
Authorize a user using the browser and a CherryPy server, and write the resulting credentials to a config file.
[ "Authorize", "a", "user", "using", "the", "browser", "and", "a", "CherryPy", "server", "and", "write", "the", "resulting", "credentials", "to", "a", "config", "file", "." ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L161-L190
249,957
mattimck/python-exist
exist/cli.py
ExistCli.refresh_token
def refresh_token(self, arguments): """ Refresh a user's access token, using existing the refresh token previously received in the auth flow. """ new_access_token = None auth = ExistAuth(self.client_id, self.client_secret) resp = auth.refresh_token(self.access_t...
python
def refresh_token(self, arguments): """ Refresh a user's access token, using existing the refresh token previously received in the auth flow. """ new_access_token = None auth = ExistAuth(self.client_id, self.client_secret) resp = auth.refresh_token(self.access_t...
[ "def", "refresh_token", "(", "self", ",", "arguments", ")", ":", "new_access_token", "=", "None", "auth", "=", "ExistAuth", "(", "self", ".", "client_id", ",", "self", ".", "client_secret", ")", "resp", "=", "auth", ".", "refresh_token", "(", "self", ".", ...
Refresh a user's access token, using existing the refresh token previously received in the auth flow.
[ "Refresh", "a", "user", "s", "access", "token", "using", "existing", "the", "refresh", "token", "previously", "received", "in", "the", "auth", "flow", "." ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/cli.py#L192-L207
249,958
eisensheng/kaviar
tasks.py
_version_find_existing
def _version_find_existing(): """Returns set of existing versions in this repository. This information is backed by previously used version tags in git. Available tags are pulled from origin repository before. :return: available versions :rtype: set """ _tool_run('git fetch...
python
def _version_find_existing(): """Returns set of existing versions in this repository. This information is backed by previously used version tags in git. Available tags are pulled from origin repository before. :return: available versions :rtype: set """ _tool_run('git fetch...
[ "def", "_version_find_existing", "(", ")", ":", "_tool_run", "(", "'git fetch origin -t'", ")", "git_tags", "=", "[", "x", "for", "x", "in", "(", "y", ".", "strip", "(", ")", "for", "y", "in", "(", "_tool_run", "(", "'git tag -l'", ")", ".", "stdout", ...
Returns set of existing versions in this repository. This information is backed by previously used version tags in git. Available tags are pulled from origin repository before. :return: available versions :rtype: set
[ "Returns", "set", "of", "existing", "versions", "in", "this", "repository", ".", "This", "information", "is", "backed", "by", "previously", "used", "version", "tags", "in", "git", ".", "Available", "tags", "are", "pulled", "from", "origin", "repository", "befo...
77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f
https://github.com/eisensheng/kaviar/blob/77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f/tasks.py#L34-L48
249,959
eisensheng/kaviar
tasks.py
_git_enable_branch
def _git_enable_branch(desired_branch): """Enable desired branch name.""" preserved_branch = _git_get_current_branch() try: if preserved_branch != desired_branch: _tool_run('git checkout ' + desired_branch) yield finally: if preserved_branch and preserved_branch != de...
python
def _git_enable_branch(desired_branch): """Enable desired branch name.""" preserved_branch = _git_get_current_branch() try: if preserved_branch != desired_branch: _tool_run('git checkout ' + desired_branch) yield finally: if preserved_branch and preserved_branch != de...
[ "def", "_git_enable_branch", "(", "desired_branch", ")", ":", "preserved_branch", "=", "_git_get_current_branch", "(", ")", "try", ":", "if", "preserved_branch", "!=", "desired_branch", ":", "_tool_run", "(", "'git checkout '", "+", "desired_branch", ")", "yield", "...
Enable desired branch name.
[ "Enable", "desired", "branch", "name", "." ]
77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f
https://github.com/eisensheng/kaviar/blob/77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f/tasks.py#L98-L107
249,960
eisensheng/kaviar
tasks.py
mk_travis_config
def mk_travis_config(): """Generate configuration for travis.""" t = dedent("""\ language: python python: 3.4 env: {jobs} install: - pip install -r requirements/ci.txt script: - invoke ci_run_job $TOX_JOB after_success: ...
python
def mk_travis_config(): """Generate configuration for travis.""" t = dedent("""\ language: python python: 3.4 env: {jobs} install: - pip install -r requirements/ci.txt script: - invoke ci_run_job $TOX_JOB after_success: ...
[ "def", "mk_travis_config", "(", ")", ":", "t", "=", "dedent", "(", "\"\"\"\\\n language: python\n python: 3.4\n env:\n {jobs}\n install:\n - pip install -r requirements/ci.txt\n script:\n - invoke ci_run_job $TOX_JOB\n after_su...
Generate configuration for travis.
[ "Generate", "configuration", "for", "travis", "." ]
77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f
https://github.com/eisensheng/kaviar/blob/77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f/tasks.py#L160-L178
249,961
eisensheng/kaviar
tasks.py
mkrelease
def mkrelease(finish='yes', version=''): """Allocates the next version number and marks current develop branch state as a new release with the allocated version number. Syncs new state with origin repository. """ if not version: version = _version_format(_version_guess_next()) if _git_g...
python
def mkrelease(finish='yes', version=''): """Allocates the next version number and marks current develop branch state as a new release with the allocated version number. Syncs new state with origin repository. """ if not version: version = _version_format(_version_guess_next()) if _git_g...
[ "def", "mkrelease", "(", "finish", "=", "'yes'", ",", "version", "=", "''", ")", ":", "if", "not", "version", ":", "version", "=", "_version_format", "(", "_version_guess_next", "(", ")", ")", "if", "_git_get_current_branch", "(", ")", "!=", "'release/'", ...
Allocates the next version number and marks current develop branch state as a new release with the allocated version number. Syncs new state with origin repository.
[ "Allocates", "the", "next", "version", "number", "and", "marks", "current", "develop", "branch", "state", "as", "a", "new", "release", "with", "the", "allocated", "version", "number", ".", "Syncs", "new", "state", "with", "origin", "repository", "." ]
77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f
https://github.com/eisensheng/kaviar/blob/77ab934a3dd7b1cfabc0ec96acc0b8ed26edcb3f/tasks.py#L193-L216
249,962
developersociety/django-glitter-news
glitter_news/views.py
PostDetailView.get_allow_future
def get_allow_future(self): """ Only superusers and users with the permission can edit the post. """ qs = self.get_queryset() post_edit_permission = '{}.edit_{}'.format( qs.model._meta.app_label, qs.model._meta.model_name ) if self.request.user.has_per...
python
def get_allow_future(self): """ Only superusers and users with the permission can edit the post. """ qs = self.get_queryset() post_edit_permission = '{}.edit_{}'.format( qs.model._meta.app_label, qs.model._meta.model_name ) if self.request.user.has_per...
[ "def", "get_allow_future", "(", "self", ")", ":", "qs", "=", "self", ".", "get_queryset", "(", ")", "post_edit_permission", "=", "'{}.edit_{}'", ".", "format", "(", "qs", ".", "model", ".", "_meta", ".", "app_label", ",", "qs", ".", "model", ".", "_meta"...
Only superusers and users with the permission can edit the post.
[ "Only", "superusers", "and", "users", "with", "the", "permission", "can", "edit", "the", "post", "." ]
e3c7f9932b3225549c444048b4866263357de58e
https://github.com/developersociety/django-glitter-news/blob/e3c7f9932b3225549c444048b4866263357de58e/glitter_news/views.py#L67-L77
249,963
minhhoit/yacms
yacms/project_template/fabfile.py
update_changed_requirements
def update_changed_requirements(): """ Checks for changes in the requirements file across an update, and gets new requirements if changes have occurred. """ reqs_path = join(env.proj_path, env.reqs_path) get_reqs = lambda: run("cat %s" % reqs_path, show=False) old_reqs = get_reqs() if env.re...
python
def update_changed_requirements(): """ Checks for changes in the requirements file across an update, and gets new requirements if changes have occurred. """ reqs_path = join(env.proj_path, env.reqs_path) get_reqs = lambda: run("cat %s" % reqs_path, show=False) old_reqs = get_reqs() if env.re...
[ "def", "update_changed_requirements", "(", ")", ":", "reqs_path", "=", "join", "(", "env", ".", "proj_path", ",", "env", ".", "reqs_path", ")", "get_reqs", "=", "lambda", ":", "run", "(", "\"cat %s\"", "%", "reqs_path", ",", "show", "=", "False", ")", "o...
Checks for changes in the requirements file across an update, and gets new requirements if changes have occurred.
[ "Checks", "for", "changes", "in", "the", "requirements", "file", "across", "an", "update", "and", "gets", "new", "requirements", "if", "changes", "have", "occurred", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L140-L165
249,964
minhhoit/yacms
yacms/project_template/fabfile.py
run
def run(command, show=True, *args, **kwargs): """ Runs a shell comand on the remote server. """ if show: print_command(command) with hide("running"): return _run(command, *args, **kwargs)
python
def run(command, show=True, *args, **kwargs): """ Runs a shell comand on the remote server. """ if show: print_command(command) with hide("running"): return _run(command, *args, **kwargs)
[ "def", "run", "(", "command", ",", "show", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "show", ":", "print_command", "(", "command", ")", "with", "hide", "(", "\"running\"", ")", ":", "return", "_run", "(", "command", ",...
Runs a shell comand on the remote server.
[ "Runs", "a", "shell", "comand", "on", "the", "remote", "server", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L185-L192
249,965
minhhoit/yacms
yacms/project_template/fabfile.py
sudo
def sudo(command, show=True, *args, **kwargs): """ Runs a command as sudo on the remote server. """ if show: print_command(command) with hide("running"): return _sudo(command, *args, **kwargs)
python
def sudo(command, show=True, *args, **kwargs): """ Runs a command as sudo on the remote server. """ if show: print_command(command) with hide("running"): return _sudo(command, *args, **kwargs)
[ "def", "sudo", "(", "command", ",", "show", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "show", ":", "print_command", "(", "command", ")", "with", "hide", "(", "\"running\"", ")", ":", "return", "_sudo", "(", "command", ...
Runs a command as sudo on the remote server.
[ "Runs", "a", "command", "as", "sudo", "on", "the", "remote", "server", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L196-L203
249,966
minhhoit/yacms
yacms/project_template/fabfile.py
get_templates
def get_templates(): """ Returns each of the templates with env vars injected. """ injected = {} for name, data in templates.items(): injected[name] = dict([(k, v % env) for k, v in data.items()]) return injected
python
def get_templates(): """ Returns each of the templates with env vars injected. """ injected = {} for name, data in templates.items(): injected[name] = dict([(k, v % env) for k, v in data.items()]) return injected
[ "def", "get_templates", "(", ")", ":", "injected", "=", "{", "}", "for", "name", ",", "data", "in", "templates", ".", "items", "(", ")", ":", "injected", "[", "name", "]", "=", "dict", "(", "[", "(", "k", ",", "v", "%", "env", ")", "for", "k", ...
Returns each of the templates with env vars injected.
[ "Returns", "each", "of", "the", "templates", "with", "env", "vars", "injected", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L215-L222
249,967
minhhoit/yacms
yacms/project_template/fabfile.py
upload_template_and_reload
def upload_template_and_reload(name): """ Uploads a template only if it has changed, and if so, reload the related service. """ template = get_templates()[name] local_path = template["local_path"] if not os.path.exists(local_path): project_root = os.path.dirname(os.path.abspath(__fil...
python
def upload_template_and_reload(name): """ Uploads a template only if it has changed, and if so, reload the related service. """ template = get_templates()[name] local_path = template["local_path"] if not os.path.exists(local_path): project_root = os.path.dirname(os.path.abspath(__fil...
[ "def", "upload_template_and_reload", "(", "name", ")", ":", "template", "=", "get_templates", "(", ")", "[", "name", "]", "local_path", "=", "template", "[", "\"local_path\"", "]", "if", "not", "os", ".", "path", ".", "exists", "(", "local_path", ")", ":",...
Uploads a template only if it has changed, and if so, reload the related service.
[ "Uploads", "a", "template", "only", "if", "it", "has", "changed", "and", "if", "so", "reload", "the", "related", "service", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L225-L259
249,968
minhhoit/yacms
yacms/project_template/fabfile.py
rsync_upload
def rsync_upload(): """ Uploads the project with rsync excluding some files and folders. """ excludes = ["*.pyc", "*.pyo", "*.db", ".DS_Store", ".coverage", "local_settings.py", "/static", "/.git", "/.hg"] local_dir = os.getcwd() + os.sep return rsync_project(remote_dir=env.proj_...
python
def rsync_upload(): """ Uploads the project with rsync excluding some files and folders. """ excludes = ["*.pyc", "*.pyo", "*.db", ".DS_Store", ".coverage", "local_settings.py", "/static", "/.git", "/.hg"] local_dir = os.getcwd() + os.sep return rsync_project(remote_dir=env.proj_...
[ "def", "rsync_upload", "(", ")", ":", "excludes", "=", "[", "\"*.pyc\"", ",", "\"*.pyo\"", ",", "\"*.db\"", ",", "\".DS_Store\"", ",", "\".coverage\"", ",", "\"local_settings.py\"", ",", "\"/static\"", ",", "\"/.git\"", ",", "\"/.hg\"", "]", "local_dir", "=", ...
Uploads the project with rsync excluding some files and folders.
[ "Uploads", "the", "project", "with", "rsync", "excluding", "some", "files", "and", "folders", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L262-L270
249,969
minhhoit/yacms
yacms/project_template/fabfile.py
vcs_upload
def vcs_upload(): """ Uploads the project with the selected VCS tool. """ if env.deploy_tool == "git": remote_path = "ssh://%s@%s%s" % (env.user, env.host_string, env.repo_path) if not exists(env.repo_path): run("mkdir -p %s" % env.rep...
python
def vcs_upload(): """ Uploads the project with the selected VCS tool. """ if env.deploy_tool == "git": remote_path = "ssh://%s@%s%s" % (env.user, env.host_string, env.repo_path) if not exists(env.repo_path): run("mkdir -p %s" % env.rep...
[ "def", "vcs_upload", "(", ")", ":", "if", "env", ".", "deploy_tool", "==", "\"git\"", ":", "remote_path", "=", "\"ssh://%s@%s%s\"", "%", "(", "env", ".", "user", ",", "env", ".", "host_string", ",", "env", ".", "repo_path", ")", "if", "not", "exists", ...
Uploads the project with the selected VCS tool.
[ "Uploads", "the", "project", "with", "the", "selected", "VCS", "tool", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L273-L299
249,970
minhhoit/yacms
yacms/project_template/fabfile.py
postgres
def postgres(command): """ Runs the given command as the postgres user. """ show = not command.startswith("psql") return sudo(command, show=show, user="postgres")
python
def postgres(command): """ Runs the given command as the postgres user. """ show = not command.startswith("psql") return sudo(command, show=show, user="postgres")
[ "def", "postgres", "(", "command", ")", ":", "show", "=", "not", "command", ".", "startswith", "(", "\"psql\"", ")", "return", "sudo", "(", "command", ",", "show", "=", "show", ",", "user", "=", "\"postgres\"", ")" ]
Runs the given command as the postgres user.
[ "Runs", "the", "given", "command", "as", "the", "postgres", "user", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L328-L333
249,971
minhhoit/yacms
yacms/project_template/fabfile.py
psql
def psql(sql, show=True): """ Runs SQL against the project's database. """ out = postgres('psql -c "%s"' % sql) if show: print_command(sql) return out
python
def psql(sql, show=True): """ Runs SQL against the project's database. """ out = postgres('psql -c "%s"' % sql) if show: print_command(sql) return out
[ "def", "psql", "(", "sql", ",", "show", "=", "True", ")", ":", "out", "=", "postgres", "(", "'psql -c \"%s\"'", "%", "sql", ")", "if", "show", ":", "print_command", "(", "sql", ")", "return", "out" ]
Runs SQL against the project's database.
[ "Runs", "SQL", "against", "the", "project", "s", "database", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L337-L344
249,972
minhhoit/yacms
yacms/project_template/fabfile.py
backup
def backup(filename): """ Backs up the project database. """ tmp_file = "/tmp/%s" % filename # We dump to /tmp because user "postgres" can't write to other user folders # We cd to / because user "postgres" might not have read permissions # elsewhere. with cd("/"): postgres("pg_du...
python
def backup(filename): """ Backs up the project database. """ tmp_file = "/tmp/%s" % filename # We dump to /tmp because user "postgres" can't write to other user folders # We cd to / because user "postgres" might not have read permissions # elsewhere. with cd("/"): postgres("pg_du...
[ "def", "backup", "(", "filename", ")", ":", "tmp_file", "=", "\"/tmp/%s\"", "%", "filename", "# We dump to /tmp because user \"postgres\" can't write to other user folders", "# We cd to / because user \"postgres\" might not have read permissions", "# elsewhere.", "with", "cd", "(", ...
Backs up the project database.
[ "Backs", "up", "the", "project", "database", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L348-L359
249,973
minhhoit/yacms
yacms/project_template/fabfile.py
python
def python(code, show=True): """ Runs Python code in the project's virtual environment, with Django loaded. """ setup = "import os;" \ "os.environ[\'DJANGO_SETTINGS_MODULE\']=\'%s.settings\';" \ "import django;" \ "django.setup();" % env.proj_app full_code = 'pyth...
python
def python(code, show=True): """ Runs Python code in the project's virtual environment, with Django loaded. """ setup = "import os;" \ "os.environ[\'DJANGO_SETTINGS_MODULE\']=\'%s.settings\';" \ "import django;" \ "django.setup();" % env.proj_app full_code = 'pyth...
[ "def", "python", "(", "code", ",", "show", "=", "True", ")", ":", "setup", "=", "\"import os;\"", "\"os.environ[\\'DJANGO_SETTINGS_MODULE\\']=\\'%s.settings\\';\"", "\"import django;\"", "\"django.setup();\"", "%", "env", ".", "proj_app", "full_code", "=", "'python -c \"%...
Runs Python code in the project's virtual environment, with Django loaded.
[ "Runs", "Python", "code", "in", "the", "project", "s", "virtual", "environment", "with", "Django", "loaded", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L371-L384
249,974
minhhoit/yacms
yacms/project_template/fabfile.py
install
def install(): """ Installs the base system and Python requirements for the entire server. """ # Install system requirements sudo("apt-get update -y -q") apt("nginx libjpeg-dev python-dev python-setuptools git-core " "postgresql libpq-dev memcached supervisor python-pip") run("mkdir ...
python
def install(): """ Installs the base system and Python requirements for the entire server. """ # Install system requirements sudo("apt-get update -y -q") apt("nginx libjpeg-dev python-dev python-setuptools git-core " "postgresql libpq-dev memcached supervisor python-pip") run("mkdir ...
[ "def", "install", "(", ")", ":", "# Install system requirements", "sudo", "(", "\"apt-get update -y -q\"", ")", "apt", "(", "\"nginx libjpeg-dev python-dev python-setuptools git-core \"", "\"postgresql libpq-dev memcached supervisor python-pip\"", ")", "run", "(", "\"mkdir -p /home...
Installs the base system and Python requirements for the entire server.
[ "Installs", "the", "base", "system", "and", "Python", "requirements", "for", "the", "entire", "server", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L432-L452
249,975
minhhoit/yacms
yacms/project_template/fabfile.py
remove
def remove(): """ Blow away the current project. """ if exists(env.venv_path): run("rm -rf %s" % env.venv_path) if exists(env.proj_path): run("rm -rf %s" % env.proj_path) for template in get_templates().values(): remote_path = template["remote_path"] if exists(rem...
python
def remove(): """ Blow away the current project. """ if exists(env.venv_path): run("rm -rf %s" % env.venv_path) if exists(env.proj_path): run("rm -rf %s" % env.proj_path) for template in get_templates().values(): remote_path = template["remote_path"] if exists(rem...
[ "def", "remove", "(", ")", ":", "if", "exists", "(", "env", ".", "venv_path", ")", ":", "run", "(", "\"rm -rf %s\"", "%", "env", ".", "venv_path", ")", "if", "exists", "(", "env", ".", "proj_path", ")", ":", "run", "(", "\"rm -rf %s\"", "%", "env", ...
Blow away the current project.
[ "Blow", "away", "the", "current", "project", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L556-L572
249,976
minhhoit/yacms
yacms/project_template/fabfile.py
deploy
def deploy(): """ Deploy latest version of the project. Backup current version of the project, push latest version of the project via version control or rsync, install new requirements, sync and migrate the database, collect any new static assets, and restart gunicorn's worker processes for the ...
python
def deploy(): """ Deploy latest version of the project. Backup current version of the project, push latest version of the project via version control or rsync, install new requirements, sync and migrate the database, collect any new static assets, and restart gunicorn's worker processes for the ...
[ "def", "deploy", "(", ")", ":", "if", "not", "exists", "(", "env", ".", "proj_path", ")", ":", "if", "confirm", "(", "\"Project does not exist in host server: %s\"", "\"\\nWould you like to create it?\"", "%", "env", ".", "proj_name", ")", ":", "create", "(", ")...
Deploy latest version of the project. Backup current version of the project, push latest version of the project via version control or rsync, install new requirements, sync and migrate the database, collect any new static assets, and restart gunicorn's worker processes for the project.
[ "Deploy", "latest", "version", "of", "the", "project", ".", "Backup", "current", "version", "of", "the", "project", "push", "latest", "version", "of", "the", "project", "via", "version", "control", "or", "rsync", "install", "new", "requirements", "sync", "and"...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L595-L642
249,977
minhhoit/yacms
yacms/project_template/fabfile.py
rollback
def rollback(): """ Reverts project state to the last deploy. When a deploy is performed, the current state of the project is backed up. This includes the project files, the database, and all static files. Calling rollback will revert all of these to their state prior to the last deploy. """...
python
def rollback(): """ Reverts project state to the last deploy. When a deploy is performed, the current state of the project is backed up. This includes the project files, the database, and all static files. Calling rollback will revert all of these to their state prior to the last deploy. """...
[ "def", "rollback", "(", ")", ":", "with", "update_changed_requirements", "(", ")", ":", "if", "env", ".", "deploy_tool", "in", "env", ".", "vcs_tools", ":", "with", "cd", "(", "env", ".", "repo_path", ")", ":", "if", "env", ".", "deploy_tool", "==", "\...
Reverts project state to the last deploy. When a deploy is performed, the current state of the project is backed up. This includes the project files, the database, and all static files. Calling rollback will revert all of these to their state prior to the last deploy.
[ "Reverts", "project", "state", "to", "the", "last", "deploy", ".", "When", "a", "deploy", "is", "performed", "the", "current", "state", "of", "the", "project", "is", "backed", "up", ".", "This", "includes", "the", "project", "files", "the", "database", "an...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/project_template/fabfile.py#L647-L672
249,978
FujiMakoto/IPS-Vagrant
ips_vagrant/commands/delete/__init__.py
delete_single
def delete_single(site, domain, delete_code=False, no_prompt=False): """ Delete a single site @type site: Site @type domain: Domain @type delete_code: bool @type no_prompt: bool """ click.secho('Deleting installation "{sn}" hosted on the domain {dn}'.for...
python
def delete_single(site, domain, delete_code=False, no_prompt=False): """ Delete a single site @type site: Site @type domain: Domain @type delete_code: bool @type no_prompt: bool """ click.secho('Deleting installation "{sn}" hosted on the domain {dn}'.for...
[ "def", "delete_single", "(", "site", ",", "domain", ",", "delete_code", "=", "False", ",", "no_prompt", "=", "False", ")", ":", "click", ".", "secho", "(", "'Deleting installation \"{sn}\" hosted on the domain {dn}'", ".", "format", "(", "sn", "=", "site", ".", ...
Delete a single site @type site: Site @type domain: Domain @type delete_code: bool @type no_prompt: bool
[ "Delete", "a", "single", "site" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/commands/delete/__init__.py#L47-L92
249,979
FujiMakoto/IPS-Vagrant
ips_vagrant/commands/delete/__init__.py
_remove_code
def _remove_code(site): """ Delete project files @type site: Site """ def handle_error(function, path, excinfo): click.secho('Failed to remove path ({em}): {p}'.format(em=excinfo.message, p=path), err=True, fg='red') if os.path.exists(site.root): shutil.rmtree(site.root, one...
python
def _remove_code(site): """ Delete project files @type site: Site """ def handle_error(function, path, excinfo): click.secho('Failed to remove path ({em}): {p}'.format(em=excinfo.message, p=path), err=True, fg='red') if os.path.exists(site.root): shutil.rmtree(site.root, one...
[ "def", "_remove_code", "(", "site", ")", ":", "def", "handle_error", "(", "function", ",", "path", ",", "excinfo", ")", ":", "click", ".", "secho", "(", "'Failed to remove path ({em}): {p}'", ".", "format", "(", "em", "=", "excinfo", ".", "message", ",", "...
Delete project files @type site: Site
[ "Delete", "project", "files" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/commands/delete/__init__.py#L145-L154
249,980
pydsigner/taskit
taskit/backend.py
BackEnd._handler
def _handler(self, conn): """ Connection handler thread. Takes care of communication with the client and running the proper task or applying a signal. """ incoming = self.recv(conn) self.log(DEBUG, incoming) try: # E.g. ['twister', [7, 'invert'], {'gu...
python
def _handler(self, conn): """ Connection handler thread. Takes care of communication with the client and running the proper task or applying a signal. """ incoming = self.recv(conn) self.log(DEBUG, incoming) try: # E.g. ['twister', [7, 'invert'], {'gu...
[ "def", "_handler", "(", "self", ",", "conn", ")", ":", "incoming", "=", "self", ".", "recv", "(", "conn", ")", "self", ".", "log", "(", "DEBUG", ",", "incoming", ")", "try", ":", "# E.g. ['twister', [7, 'invert'], {'guess_type': True}]", "task", ",", "args",...
Connection handler thread. Takes care of communication with the client and running the proper task or applying a signal.
[ "Connection", "handler", "thread", ".", "Takes", "care", "of", "communication", "with", "the", "client", "and", "running", "the", "proper", "task", "or", "applying", "a", "signal", "." ]
3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f
https://github.com/pydsigner/taskit/blob/3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f/taskit/backend.py#L125-L161
249,981
pydsigner/taskit
taskit/backend.py
BackEnd.stop_server
def stop_server(self): """ Stop receiving connections, wait for all tasks to end, and then terminate the server. """ self.stop = True while self.task_count: time.sleep(END_RESP) self.terminate = True
python
def stop_server(self): """ Stop receiving connections, wait for all tasks to end, and then terminate the server. """ self.stop = True while self.task_count: time.sleep(END_RESP) self.terminate = True
[ "def", "stop_server", "(", "self", ")", ":", "self", ".", "stop", "=", "True", "while", "self", ".", "task_count", ":", "time", ".", "sleep", "(", "END_RESP", ")", "self", ".", "terminate", "=", "True" ]
Stop receiving connections, wait for all tasks to end, and then terminate the server.
[ "Stop", "receiving", "connections", "wait", "for", "all", "tasks", "to", "end", "and", "then", "terminate", "the", "server", "." ]
3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f
https://github.com/pydsigner/taskit/blob/3b228e2dbac16b3b84b2581f5b46e027d1d8fa7f/taskit/backend.py#L198-L206
249,982
pjuren/pyokit
src/pyokit/io/fastqIterators.py
fastqIterator
def fastqIterator(fn, verbose=False, allowNameMissmatch=False): """ A generator function which yields FastqSequence objects read from a file or stream. This is a general function which wraps fastqIteratorSimple. In future releases, we may allow dynamic switching of which base iterator is used. :p...
python
def fastqIterator(fn, verbose=False, allowNameMissmatch=False): """ A generator function which yields FastqSequence objects read from a file or stream. This is a general function which wraps fastqIteratorSimple. In future releases, we may allow dynamic switching of which base iterator is used. :p...
[ "def", "fastqIterator", "(", "fn", ",", "verbose", "=", "False", ",", "allowNameMissmatch", "=", "False", ")", ":", "it", "=", "fastqIteratorSimple", "(", "fn", ",", "verbose", "=", "verbose", ",", "allowNameMissmatch", "=", "allowNameMissmatch", ")", "for", ...
A generator function which yields FastqSequence objects read from a file or stream. This is a general function which wraps fastqIteratorSimple. In future releases, we may allow dynamic switching of which base iterator is used. :param fn: A file-like stream or a string; if this is a ...
[ "A", "generator", "function", "which", "yields", "FastqSequence", "objects", "read", "from", "a", "file", "or", "stream", ".", "This", "is", "a", "general", "function", "which", "wraps", "fastqIteratorSimple", ".", "In", "future", "releases", "we", "may", "all...
fddae123b5d817daa39496183f19c000d9c3791f
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/fastqIterators.py#L154-L182
249,983
b3j0f/task
b3j0f/task/condition.py
during
def during(rrule, duration=None, timestamp=None, **kwargs): """ Check if input timestamp is in rrule+duration period :param rrule: rrule to check :type rrule: str or dict (freq, dtstart, interval, count, wkst, until, bymonth, byminute, etc.) :param dict duration: time duration from rrule st...
python
def during(rrule, duration=None, timestamp=None, **kwargs): """ Check if input timestamp is in rrule+duration period :param rrule: rrule to check :type rrule: str or dict (freq, dtstart, interval, count, wkst, until, bymonth, byminute, etc.) :param dict duration: time duration from rrule st...
[ "def", "during", "(", "rrule", ",", "duration", "=", "None", ",", "timestamp", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "# if rrule is a string expression", "if", "isinstance", "(", "rrule", ",", "string_types", ")", ":", "rr...
Check if input timestamp is in rrule+duration period :param rrule: rrule to check :type rrule: str or dict (freq, dtstart, interval, count, wkst, until, bymonth, byminute, etc.) :param dict duration: time duration from rrule step. Ex:{'minutes': 60} :param float timestamp: timestamp to check be...
[ "Check", "if", "input", "timestamp", "is", "in", "rrule", "+", "duration", "period" ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L43-L84
249,984
b3j0f/task
b3j0f/task/condition.py
_any
def _any(confs=None, **kwargs): """ True iif at least one input condition is equivalent to True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if at least one condition is checked (compared to True, but not an st...
python
def _any(confs=None, **kwargs): """ True iif at least one input condition is equivalent to True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if at least one condition is checked (compared to True, but not an st...
[ "def", "_any", "(", "confs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "if", "confs", "is", "not", "None", ":", "# ensure confs is a list", "if", "isinstance", "(", "confs", ",", "string_types", ")", "or", "isinstance", "(",...
True iif at least one input condition is equivalent to True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if at least one condition is checked (compared to True, but not an strict equivalence to True). False otherwise. ...
[ "True", "iif", "at", "least", "one", "input", "condition", "is", "equivalent", "to", "True", "." ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L88-L112
249,985
b3j0f/task
b3j0f/task/condition.py
_all
def _all(confs=None, **kwargs): """ True iif all input confs are True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if all conditions are checked. False otherwise. :rtype: bool """ result = False if confs ...
python
def _all(confs=None, **kwargs): """ True iif all input confs are True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if all conditions are checked. False otherwise. :rtype: bool """ result = False if confs ...
[ "def", "_all", "(", "confs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "if", "confs", "is", "not", "None", ":", "# ensure confs is a list", "if", "isinstance", "(", "confs", ",", "string_types", ")", "or", "isinstance", "(",...
True iif all input confs are True. :param confs: confs to check. :type confs: list or dict or str :param kwargs: additional task kwargs. :return: True if all conditions are checked. False otherwise. :rtype: bool
[ "True", "iif", "all", "input", "confs", "are", "True", "." ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L116-L142
249,986
b3j0f/task
b3j0f/task/condition.py
_not
def _not(condition=None, **kwargs): """ Return the opposite of input condition. :param condition: condition to process. :result: not condition. :rtype: bool """ result = True if condition is not None: result = not run(condition, **kwargs) return result
python
def _not(condition=None, **kwargs): """ Return the opposite of input condition. :param condition: condition to process. :result: not condition. :rtype: bool """ result = True if condition is not None: result = not run(condition, **kwargs) return result
[ "def", "_not", "(", "condition", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "True", "if", "condition", "is", "not", "None", ":", "result", "=", "not", "run", "(", "condition", ",", "*", "*", "kwargs", ")", "return", "result" ]
Return the opposite of input condition. :param condition: condition to process. :result: not condition. :rtype: bool
[ "Return", "the", "opposite", "of", "input", "condition", "." ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L149-L164
249,987
b3j0f/task
b3j0f/task/condition.py
condition
def condition(condition=None, statement=None, _else=None, **kwargs): """ Run an statement if input condition is checked and return statement result. :param condition: condition to check. :type condition: str or dict :param statement: statement to process if condition is checked. :type statement...
python
def condition(condition=None, statement=None, _else=None, **kwargs): """ Run an statement if input condition is checked and return statement result. :param condition: condition to check. :type condition: str or dict :param statement: statement to process if condition is checked. :type statement...
[ "def", "condition", "(", "condition", "=", "None", ",", "statement", "=", "None", ",", "_else", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "None", "checked", "=", "False", "if", "condition", "is", "not", "None", ":", "checked", "=...
Run an statement if input condition is checked and return statement result. :param condition: condition to check. :type condition: str or dict :param statement: statement to process if condition is checked. :type statement: str or dict :param _else: else statement. :type _else: str or dict ...
[ "Run", "an", "statement", "if", "input", "condition", "is", "checked", "and", "return", "statement", "result", "." ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L168-L197
249,988
b3j0f/task
b3j0f/task/condition.py
switch
def switch( confs=None, remain=False, all_checked=False, _default=None, **kwargs ): """ Execute first statement among conf where task result is True. If remain, process all statements conf starting from the first checked conf. :param confs: task confs to check. Each one may contain a task a...
python
def switch( confs=None, remain=False, all_checked=False, _default=None, **kwargs ): """ Execute first statement among conf where task result is True. If remain, process all statements conf starting from the first checked conf. :param confs: task confs to check. Each one may contain a task a...
[ "def", "switch", "(", "confs", "=", "None", ",", "remain", "=", "False", ",", "all_checked", "=", "False", ",", "_default", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# init result", "result", "=", "[", "]", "if", "remain", "else", "None", "# c...
Execute first statement among conf where task result is True. If remain, process all statements conf starting from the first checked conf. :param confs: task confs to check. Each one may contain a task action at the key 'action' in conf. :type confs: str or dict or list :param bool remain: ...
[ "Execute", "first", "statement", "among", "conf", "where", "task", "result", "is", "True", ".", "If", "remain", "process", "all", "statements", "conf", "starting", "from", "the", "first", "checked", "conf", "." ]
3e3e48633b1c9a52911c19df3a44fba4b744f60e
https://github.com/b3j0f/task/blob/3e3e48633b1c9a52911c19df3a44fba4b744f60e/b3j0f/task/condition.py#L201-L277
249,989
jthacker/terseparse
terseparse/root_parser.py
RootParser.error
def error(self, message): """Overrides error to control printing output""" if self._debug: import pdb _, _, tb = sys.exc_info() if tb: pdb.post_mortem(tb) else: pdb.set_trace() self.print_usage(sys.stderr) se...
python
def error(self, message): """Overrides error to control printing output""" if self._debug: import pdb _, _, tb = sys.exc_info() if tb: pdb.post_mortem(tb) else: pdb.set_trace() self.print_usage(sys.stderr) se...
[ "def", "error", "(", "self", ",", "message", ")", ":", "if", "self", ".", "_debug", ":", "import", "pdb", "_", ",", "_", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "if", "tb", ":", "pdb", ".", "post_mortem", "(", "tb", ")", "else", ":", ...
Overrides error to control printing output
[ "Overrides", "error", "to", "control", "printing", "output" ]
236a31faf819f3ae9019a545613b8e7a6808f7b2
https://github.com/jthacker/terseparse/blob/236a31faf819f3ae9019a545613b8e7a6808f7b2/terseparse/root_parser.py#L108-L118
249,990
jthacker/terseparse
terseparse/root_parser.py
RootParser.format_help
def format_help(self): """Overrides format_help to not print subparsers""" formatter = self._get_formatter() # usage formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups) # description formatter.add_text(self.descrip...
python
def format_help(self): """Overrides format_help to not print subparsers""" formatter = self._get_formatter() # usage formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_groups) # description formatter.add_text(self.descrip...
[ "def", "format_help", "(", "self", ")", ":", "formatter", "=", "self", ".", "_get_formatter", "(", ")", "# usage", "formatter", ".", "add_usage", "(", "self", ".", "usage", ",", "self", ".", "_actions", ",", "self", ".", "_mutually_exclusive_groups", ")", ...
Overrides format_help to not print subparsers
[ "Overrides", "format_help", "to", "not", "print", "subparsers" ]
236a31faf819f3ae9019a545613b8e7a6808f7b2
https://github.com/jthacker/terseparse/blob/236a31faf819f3ae9019a545613b8e7a6808f7b2/terseparse/root_parser.py#L120-L144
249,991
OpenGov/python_data_wrap
datawrap/savable.py
AttributeSavable.open_attributes_file
def open_attributes_file(self): ''' Called during initialization. Only needs to be explicitly called if save_and_close_attributes is explicitly called beforehand. ''' if not self.saveable(): raise AttributeError("Cannot open attribute file without a valid file...
python
def open_attributes_file(self): ''' Called during initialization. Only needs to be explicitly called if save_and_close_attributes is explicitly called beforehand. ''' if not self.saveable(): raise AttributeError("Cannot open attribute file without a valid file...
[ "def", "open_attributes_file", "(", "self", ")", ":", "if", "not", "self", ".", "saveable", "(", ")", ":", "raise", "AttributeError", "(", "\"Cannot open attribute file without a valid file\"", ")", "if", "self", ".", "_db_closed", ":", "self", ".", "_fd", "=", ...
Called during initialization. Only needs to be explicitly called if save_and_close_attributes is explicitly called beforehand.
[ "Called", "during", "initialization", ".", "Only", "needs", "to", "be", "explicitly", "called", "if", "save_and_close_attributes", "is", "explicitly", "called", "beforehand", "." ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/savable.py#L46-L59
249,992
OpenGov/python_data_wrap
datawrap/savable.py
AttributeSavable.save_and_close_attributes
def save_and_close_attributes(self): ''' Performs the same function as save_attributes but also closes the attribute file. ''' if not self.saveable(): raise AttributeError("Cannot save attribute file without a valid file") if not self._db_closed: s...
python
def save_and_close_attributes(self): ''' Performs the same function as save_attributes but also closes the attribute file. ''' if not self.saveable(): raise AttributeError("Cannot save attribute file without a valid file") if not self._db_closed: s...
[ "def", "save_and_close_attributes", "(", "self", ")", ":", "if", "not", "self", ".", "saveable", "(", ")", ":", "raise", "AttributeError", "(", "\"Cannot save attribute file without a valid file\"", ")", "if", "not", "self", ".", "_db_closed", ":", "self", ".", ...
Performs the same function as save_attributes but also closes the attribute file.
[ "Performs", "the", "same", "function", "as", "save_attributes", "but", "also", "closes", "the", "attribute", "file", "." ]
7de38bb30d7a500adc336a4a7999528d753e5600
https://github.com/OpenGov/python_data_wrap/blob/7de38bb30d7a500adc336a4a7999528d753e5600/datawrap/savable.py#L77-L88
249,993
hmartiniano/faz
faz/parser.py
split_task_parameters
def split_task_parameters(line): """ Split a string of comma separated words.""" if line is None: result = [] else: result = [parameter.strip() for parameter in line.split(",")] return result
python
def split_task_parameters(line): """ Split a string of comma separated words.""" if line is None: result = [] else: result = [parameter.strip() for parameter in line.split(",")] return result
[ "def", "split_task_parameters", "(", "line", ")", ":", "if", "line", "is", "None", ":", "result", "=", "[", "]", "else", ":", "result", "=", "[", "parameter", ".", "strip", "(", ")", "for", "parameter", "in", "line", ".", "split", "(", "\",\"", ")", ...
Split a string of comma separated words.
[ "Split", "a", "string", "of", "comma", "separated", "words", "." ]
36a58c45e8c0718d38cb3c533542c8743e7e7a65
https://github.com/hmartiniano/faz/blob/36a58c45e8c0718d38cb3c533542c8743e7e7a65/faz/parser.py#L18-L24
249,994
hmartiniano/faz
faz/parser.py
find_tasks
def find_tasks(lines): """ Find task lines and corresponding line numbers in a list of lines. """ tasks = [] linenumbers = [] pattern = re.compile(TASK_PATTERN) for n, line in enumerate(lines): if "#" in line and "<-" in line: m = pattern.match(line) if m is n...
python
def find_tasks(lines): """ Find task lines and corresponding line numbers in a list of lines. """ tasks = [] linenumbers = [] pattern = re.compile(TASK_PATTERN) for n, line in enumerate(lines): if "#" in line and "<-" in line: m = pattern.match(line) if m is n...
[ "def", "find_tasks", "(", "lines", ")", ":", "tasks", "=", "[", "]", "linenumbers", "=", "[", "]", "pattern", "=", "re", ".", "compile", "(", "TASK_PATTERN", ")", "for", "n", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "\"#\"", "i...
Find task lines and corresponding line numbers in a list of lines.
[ "Find", "task", "lines", "and", "corresponding", "line", "numbers", "in", "a", "list", "of", "lines", "." ]
36a58c45e8c0718d38cb3c533542c8743e7e7a65
https://github.com/hmartiniano/faz/blob/36a58c45e8c0718d38cb3c533542c8743e7e7a65/faz/parser.py#L35-L54
249,995
hmartiniano/faz
faz/parser.py
create_environment
def create_environment(preamble): """ Create a dictionary of variables obtained from the preamble of the task file and the environment the program is running on. """ environment = copy.deepcopy(os.environ) for line in preamble: logging.debug(line) if "=" in line and not line.star...
python
def create_environment(preamble): """ Create a dictionary of variables obtained from the preamble of the task file and the environment the program is running on. """ environment = copy.deepcopy(os.environ) for line in preamble: logging.debug(line) if "=" in line and not line.star...
[ "def", "create_environment", "(", "preamble", ")", ":", "environment", "=", "copy", ".", "deepcopy", "(", "os", ".", "environ", ")", "for", "line", "in", "preamble", ":", "logging", ".", "debug", "(", "line", ")", "if", "\"=\"", "in", "line", "and", "n...
Create a dictionary of variables obtained from the preamble of the task file and the environment the program is running on.
[ "Create", "a", "dictionary", "of", "variables", "obtained", "from", "the", "preamble", "of", "the", "task", "file", "and", "the", "environment", "the", "program", "is", "running", "on", "." ]
36a58c45e8c0718d38cb3c533542c8743e7e7a65
https://github.com/hmartiniano/faz/blob/36a58c45e8c0718d38cb3c533542c8743e7e7a65/faz/parser.py#L57-L73
249,996
hmartiniano/faz
faz/parser.py
parse_input_file
def parse_input_file(text, variables=None): """ Parser for a file with syntax somewhat similar to Drake.""" text = find_includes(text) lines = text.splitlines() tasks, linenumbers = find_tasks(lines) preamble = [line for line in lines[:linenumbers[0]]] logging.debug("Preamble:\n{}".format("\n".j...
python
def parse_input_file(text, variables=None): """ Parser for a file with syntax somewhat similar to Drake.""" text = find_includes(text) lines = text.splitlines() tasks, linenumbers = find_tasks(lines) preamble = [line for line in lines[:linenumbers[0]]] logging.debug("Preamble:\n{}".format("\n".j...
[ "def", "parse_input_file", "(", "text", ",", "variables", "=", "None", ")", ":", "text", "=", "find_includes", "(", "text", ")", "lines", "=", "text", ".", "splitlines", "(", ")", "tasks", ",", "linenumbers", "=", "find_tasks", "(", "lines", ")", "preamb...
Parser for a file with syntax somewhat similar to Drake.
[ "Parser", "for", "a", "file", "with", "syntax", "somewhat", "similar", "to", "Drake", "." ]
36a58c45e8c0718d38cb3c533542c8743e7e7a65
https://github.com/hmartiniano/faz/blob/36a58c45e8c0718d38cb3c533542c8743e7e7a65/faz/parser.py#L76-L95
249,997
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionWithMethods._to_fields
def _to_fields(self, *values): """ Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields. """ result = [] for related_instance in values: if not isinstance(related_instance, model.R...
python
def _to_fields(self, *values): """ Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields. """ result = [] for related_instance in values: if not isinstance(related_instance, model.R...
[ "def", "_to_fields", "(", "self", ",", "*", "values", ")", ":", "result", "=", "[", "]", "for", "related_instance", "in", "values", ":", "if", "not", "isinstance", "(", "related_instance", ",", "model", ".", "RedisModel", ")", ":", "related_instance", "=",...
Take a list of values, which must be primary keys of the model linked to the related collection, and return a list of related fields.
[ "Take", "a", "list", "of", "values", "which", "must", "be", "primary", "keys", "of", "the", "model", "linked", "to", "the", "related", "collection", "and", "return", "a", "list", "of", "related", "fields", "." ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L20-L30
249,998
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionWithMethods._reverse_call
def _reverse_call(self, related_method, *values): """ Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which...
python
def _reverse_call(self, related_method, *values): """ Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which...
[ "def", "_reverse_call", "(", "self", ",", "related_method", ",", "*", "values", ")", ":", "related_fields", "=", "self", ".", "_to_fields", "(", "*", "values", ")", "for", "related_field", "in", "related_fields", ":", "if", "callable", "(", "related_method", ...
Convert each value to a related field, then call the method on each field, passing self.instance as argument. If related_method is a string, it will be the method of the related field. If it's a callable, it's a function which accept the related field and self.instance.
[ "Convert", "each", "value", "to", "a", "related", "field", "then", "call", "the", "method", "on", "each", "field", "passing", "self", ".", "instance", "as", "argument", ".", "If", "related_method", "is", "a", "string", "it", "will", "be", "the", "method", ...
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L32-L45
249,999
limpyd/redis-limpyd-extensions
limpyd_extensions/related.py
_RelatedCollectionForFK.srem
def srem(self, *values): """ Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model. """ self._reverse_call(lambda related_field, value: related_field.delete(), *values)
python
def srem(self, *values): """ Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model. """ self._reverse_call(lambda related_field, value: related_field.delete(), *values)
[ "def", "srem", "(", "self", ",", "*", "values", ")", ":", "self", ".", "_reverse_call", "(", "lambda", "related_field", ",", "value", ":", "related_field", ".", "delete", "(", ")", ",", "*", "values", ")" ]
Do a "set" call with self.instance as parameter for each value. Values must be primary keys of the related model.
[ "Do", "a", "set", "call", "with", "self", ".", "instance", "as", "parameter", "for", "each", "value", ".", "Values", "must", "be", "primary", "keys", "of", "the", "related", "model", "." ]
13f34e39efd2f802761457da30ab2a4213b63934
https://github.com/limpyd/redis-limpyd-extensions/blob/13f34e39efd2f802761457da30ab2a4213b63934/limpyd_extensions/related.py#L58-L63