repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
zaturox/glin
glin/zmq/messages.py
MessageParser.mainswitch_state
def mainswitch_state(frames): """parse a mainswitch.state message""" reader = MessageReader(frames) res = reader.string("command").bool("state").assert_end().get() if res.command != "mainswitch.state": raise MessageParserError("Command is not 'mainswitch.state'") retu...
python
def mainswitch_state(frames): """parse a mainswitch.state message""" reader = MessageReader(frames) res = reader.string("command").bool("state").assert_end().get() if res.command != "mainswitch.state": raise MessageParserError("Command is not 'mainswitch.state'") retu...
[ "def", "mainswitch_state", "(", "frames", ")", ":", "reader", "=", "MessageReader", "(", "frames", ")", "res", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "bool", "(", "\"state\"", ")", ".", "assert_end", "(", ")", ".", "get", "(", ")",...
parse a mainswitch.state message
[ "parse", "a", "mainswitch", ".", "state", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L117-L123
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_add
def scene_add(frames): """parse a scene.add message""" reader = MessageReader(frames) results = reader.string("command").uint32("animation_id").string("name").uint8_3("color").uint32("velocity").string("config").get() if results.command != "scene.add": raise MessageParserErro...
python
def scene_add(frames): """parse a scene.add message""" reader = MessageReader(frames) results = reader.string("command").uint32("animation_id").string("name").uint8_3("color").uint32("velocity").string("config").get() if results.command != "scene.add": raise MessageParserErro...
[ "def", "scene_add", "(", "frames", ")", ":", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"animation_id\"", ")", ".", "string", "(", "\"name\"", ")", ".", "uin...
parse a scene.add message
[ "parse", "a", "scene", ".", "add", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L126-L133
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_color
def scene_color(frames): """parse a scene.color message""" # "scene.color" <scene_id> <color> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").uint8_3("color").assert_end().get() if results.command != "scene.color": raise MessagePar...
python
def scene_color(frames): """parse a scene.color message""" # "scene.color" <scene_id> <color> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").uint8_3("color").assert_end().get() if results.command != "scene.color": raise MessagePar...
[ "def", "scene_color", "(", "frames", ")", ":", "# \"scene.color\" <scene_id> <color>", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"scene_id\"", ")", ".", "uint8_3", ...
parse a scene.color message
[ "parse", "a", "scene", ".", "color", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L136-L143
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_config
def scene_config(frames): """parse a scene.config message""" # "scene.config" <scene_id> <config> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").string("config").assert_end().get() if results.command != "scene.config": raise Messa...
python
def scene_config(frames): """parse a scene.config message""" # "scene.config" <scene_id> <config> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").string("config").assert_end().get() if results.command != "scene.config": raise Messa...
[ "def", "scene_config", "(", "frames", ")", ":", "# \"scene.config\" <scene_id> <config>", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"scene_id\"", ")", ".", "string"...
parse a scene.config message
[ "parse", "a", "scene", ".", "config", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L146-L153
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_name
def scene_name(frames): """parse a scene.name message""" # "scene.name" <scene_id> <config> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").string("name").assert_end().get() if results.command != "scene.name": raise MessageParserEr...
python
def scene_name(frames): """parse a scene.name message""" # "scene.name" <scene_id> <config> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").string("name").assert_end().get() if results.command != "scene.name": raise MessageParserEr...
[ "def", "scene_name", "(", "frames", ")", ":", "# \"scene.name\" <scene_id> <config>", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"scene_id\"", ")", ".", "string", ...
parse a scene.name message
[ "parse", "a", "scene", ".", "name", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L156-L163
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_remove
def scene_remove(frames): """parse a scene.rm message""" # "scene.rm" <scene_id> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").assert_end().get() if results.command != "scene.rm": raise MessageParserError("Command is not 'scene.r...
python
def scene_remove(frames): """parse a scene.rm message""" # "scene.rm" <scene_id> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").assert_end().get() if results.command != "scene.rm": raise MessageParserError("Command is not 'scene.r...
[ "def", "scene_remove", "(", "frames", ")", ":", "# \"scene.rm\" <scene_id>", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"scene_id\"", ")", ".", "assert_end", "(", ...
parse a scene.rm message
[ "parse", "a", "scene", ".", "rm", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L166-L173
zaturox/glin
glin/zmq/messages.py
MessageParser.scene_velocity
def scene_velocity(frames): """parse a scene.velocity message""" # "scene.velocity" <scene_id> <velocity> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").uint32("velocity").assert_end().get() if results.command != "scene.velocity": ...
python
def scene_velocity(frames): """parse a scene.velocity message""" # "scene.velocity" <scene_id> <velocity> reader = MessageReader(frames) results = reader.string("command").uint32("scene_id").uint32("velocity").assert_end().get() if results.command != "scene.velocity": ...
[ "def", "scene_velocity", "(", "frames", ")", ":", "# \"scene.velocity\" <scene_id> <velocity>", "reader", "=", "MessageReader", "(", "frames", ")", "results", "=", "reader", ".", "string", "(", "\"command\"", ")", ".", "uint32", "(", "\"scene_id\"", ")", ".", "u...
parse a scene.velocity message
[ "parse", "a", "scene", ".", "velocity", "message" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L186-L193
zaturox/glin
glin/zmq/messages.py
MessageReader.string
def string(self, name): """parse a string frame""" self._assert_is_string(name) frame = self._next_frame() try: val = frame.decode('utf-8') self.results.__dict__[name] = val except UnicodeError as err: raise MessageParserError("Message containe...
python
def string(self, name): """parse a string frame""" self._assert_is_string(name) frame = self._next_frame() try: val = frame.decode('utf-8') self.results.__dict__[name] = val except UnicodeError as err: raise MessageParserError("Message containe...
[ "def", "string", "(", "self", ",", "name", ")", ":", "self", ".", "_assert_is_string", "(", "name", ")", "frame", "=", "self", ".", "_next_frame", "(", ")", "try", ":", "val", "=", "frame", ".", "decode", "(", "'utf-8'", ")", "self", ".", "results", ...
parse a string frame
[ "parse", "a", "string", "frame" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L219-L229
zaturox/glin
glin/zmq/messages.py
MessageReader.bool
def bool(self, name): """parse a boolean frame""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 1: raise MessageParserError("Expected exacty 1 byte for boolean value") val = frame != b"\x00" self.results.__dict__[name] = val ...
python
def bool(self, name): """parse a boolean frame""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 1: raise MessageParserError("Expected exacty 1 byte for boolean value") val = frame != b"\x00" self.results.__dict__[name] = val ...
[ "def", "bool", "(", "self", ",", "name", ")", ":", "self", ".", "_assert_is_string", "(", "name", ")", "frame", "=", "self", ".", "_next_frame", "(", ")", "if", "len", "(", "frame", ")", "!=", "1", ":", "raise", "MessageParserError", "(", "\"Expected e...
parse a boolean frame
[ "parse", "a", "boolean", "frame" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L231-L239
zaturox/glin
glin/zmq/messages.py
MessageReader.uint8_3
def uint8_3(self, name): """parse a tuple of 3 uint8 values""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 3: raise MessageParserError("Expected exacty 3 byte for 3 unit8 values") vals = unpack("BBB", frame) self.results.__dict__[n...
python
def uint8_3(self, name): """parse a tuple of 3 uint8 values""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 3: raise MessageParserError("Expected exacty 3 byte for 3 unit8 values") vals = unpack("BBB", frame) self.results.__dict__[n...
[ "def", "uint8_3", "(", "self", ",", "name", ")", ":", "self", ".", "_assert_is_string", "(", "name", ")", "frame", "=", "self", ".", "_next_frame", "(", ")", "if", "len", "(", "frame", ")", "!=", "3", ":", "raise", "MessageParserError", "(", "\"Expecte...
parse a tuple of 3 uint8 values
[ "parse", "a", "tuple", "of", "3", "uint8", "values" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L241-L249
zaturox/glin
glin/zmq/messages.py
MessageReader.uint32
def uint32(self, name): """parse a uint32 value""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 4: raise MessageParserError("Expected exacty 4 byte for uint32 value") (val,) = unpack("!I", frame) self.results.__dict__[name] = val ...
python
def uint32(self, name): """parse a uint32 value""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 4: raise MessageParserError("Expected exacty 4 byte for uint32 value") (val,) = unpack("!I", frame) self.results.__dict__[name] = val ...
[ "def", "uint32", "(", "self", ",", "name", ")", ":", "self", ".", "_assert_is_string", "(", "name", ")", "frame", "=", "self", ".", "_next_frame", "(", ")", "if", "len", "(", "frame", ")", "!=", "4", ":", "raise", "MessageParserError", "(", "\"Expected...
parse a uint32 value
[ "parse", "a", "uint32", "value" ]
train
https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/zmq/messages.py#L250-L258
tbreitenfeldt/invisible_ui
invisible_ui/elements/group.py
Group.activate
def activate(self, event): """Change the value.""" self._index += 1 if self._index >= len(self._values): self._index = 0 self._selection = self._values[self._index] self.ao2.speak(self._selection)
python
def activate(self, event): """Change the value.""" self._index += 1 if self._index >= len(self._values): self._index = 0 self._selection = self._values[self._index] self.ao2.speak(self._selection)
[ "def", "activate", "(", "self", ",", "event", ")", ":", "self", ".", "_index", "+=", "1", "if", "self", ".", "_index", ">=", "len", "(", "self", ".", "_values", ")", ":", "self", ".", "_index", "=", "0", "self", ".", "_selection", "=", "self", "....
Change the value.
[ "Change", "the", "value", "." ]
train
https://github.com/tbreitenfeldt/invisible_ui/blob/1a6907bfa61bded13fa9fb83ec7778c0df84487f/invisible_ui/elements/group.py#L25-L32
untergeek/es_stats
es_stats/classes.py
Stats.cached_read
def cached_read(self, kind): """Cache stats calls to prevent hammering the API""" if not kind in self.cache: self.pull_stats(kind) if self.epochnow() - self.cache[kind]['lastcall'] > self.cache_timeout: self.pull_stats(kind) return self.cache[kind]['lastvalue']
python
def cached_read(self, kind): """Cache stats calls to prevent hammering the API""" if not kind in self.cache: self.pull_stats(kind) if self.epochnow() - self.cache[kind]['lastcall'] > self.cache_timeout: self.pull_stats(kind) return self.cache[kind]['lastvalue']
[ "def", "cached_read", "(", "self", ",", "kind", ")", ":", "if", "not", "kind", "in", "self", ".", "cache", ":", "self", ".", "pull_stats", "(", "kind", ")", "if", "self", ".", "epochnow", "(", ")", "-", "self", ".", "cache", "[", "kind", "]", "["...
Cache stats calls to prevent hammering the API
[ "Cache", "stats", "calls", "to", "prevent", "hammering", "the", "API" ]
train
https://github.com/untergeek/es_stats/blob/107754b703d3f618b849303048af570698ff70b5/es_stats/classes.py#L41-L47
untergeek/es_stats
es_stats/classes.py
Stats.get
def get(self, key, name=None): """Return value for specific key""" if name is None: self.nodename = self.local_name self.nodeid = self.local_id else: self.logger.debug('Replacing nodename "{0}" with "{1}"'.format(self.nodename, name)) self.nodename...
python
def get(self, key, name=None): """Return value for specific key""" if name is None: self.nodename = self.local_name self.nodeid = self.local_id else: self.logger.debug('Replacing nodename "{0}" with "{1}"'.format(self.nodename, name)) self.nodename...
[ "def", "get", "(", "self", ",", "key", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "self", ".", "nodename", "=", "self", ".", "local_name", "self", ".", "nodeid", "=", "self", ".", "local_id", "else", ":", "self", ".", "l...
Return value for specific key
[ "Return", "value", "for", "specific", "key" ]
train
https://github.com/untergeek/es_stats/blob/107754b703d3f618b849303048af570698ff70b5/es_stats/classes.py#L65-L74
refinery29/chassis
chassis/services/dependency_injection/resolver.py
detect_circle
def detect_circle(nodes): """ Wrapper for recursive _detect_circle function """ # Verify nodes and traveled types if not isinstance(nodes, dict): raise TypeError('"nodes" must be a dictionary') dependencies = set(nodes.keys()) traveled = [] heads = _detect_circle(nodes, dependencies, t...
python
def detect_circle(nodes): """ Wrapper for recursive _detect_circle function """ # Verify nodes and traveled types if not isinstance(nodes, dict): raise TypeError('"nodes" must be a dictionary') dependencies = set(nodes.keys()) traveled = [] heads = _detect_circle(nodes, dependencies, t...
[ "def", "detect_circle", "(", "nodes", ")", ":", "# Verify nodes and traveled types", "if", "not", "isinstance", "(", "nodes", ",", "dict", ")", ":", "raise", "TypeError", "(", "'\"nodes\" must be a dictionary'", ")", "dependencies", "=", "set", "(", "nodes", ".", ...
Wrapper for recursive _detect_circle function
[ "Wrapper", "for", "recursive", "_detect_circle", "function" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L18-L29
refinery29/chassis
chassis/services/dependency_injection/resolver.py
_detect_circle
def _detect_circle(nodes=None, dependencies=None, traveled=None, path=None): """ Recursively iterate over nodes checking if we've traveled to that node before. """ # Verify nodes and traveled types if nodes is None: nodes = {} elif not isinstance(nodes, dict): raise T...
python
def _detect_circle(nodes=None, dependencies=None, traveled=None, path=None): """ Recursively iterate over nodes checking if we've traveled to that node before. """ # Verify nodes and traveled types if nodes is None: nodes = {} elif not isinstance(nodes, dict): raise T...
[ "def", "_detect_circle", "(", "nodes", "=", "None", ",", "dependencies", "=", "None", ",", "traveled", "=", "None", ",", "path", "=", "None", ")", ":", "# Verify nodes and traveled types", "if", "nodes", "is", "None", ":", "nodes", "=", "{", "}", "elif", ...
Recursively iterate over nodes checking if we've traveled to that node before.
[ "Recursively", "iterate", "over", "nodes", "checking", "if", "we", "ve", "traveled", "to", "that", "node", "before", "." ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L32-L83
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver.do
def do(self): """ Instantiate Services """ if not self._nodes: return # Let's retain original copy of _nodes node_copy = dict(self._nodes) self._do(node_copy) return self._factory.get_instantiated_services()
python
def do(self): """ Instantiate Services """ if not self._nodes: return # Let's retain original copy of _nodes node_copy = dict(self._nodes) self._do(node_copy) return self._factory.get_instantiated_services()
[ "def", "do", "(", "self", ")", ":", "if", "not", "self", ".", "_nodes", ":", "return", "# Let's retain original copy of _nodes", "node_copy", "=", "dict", "(", "self", ".", "_nodes", ")", "self", ".", "_do", "(", "node_copy", ")", "return", "self", ".", ...
Instantiate Services
[ "Instantiate", "Services" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L120-L129
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver._do
def _do(self, nodes): """ Recursive method to instantiate services """ if not isinstance(nodes, dict): raise TypeError('"nodes" must be a dictionary') if not nodes: # we're done! return starting_num_nodes = len(nodes) newly_instantiated = set(...
python
def _do(self, nodes): """ Recursive method to instantiate services """ if not isinstance(nodes, dict): raise TypeError('"nodes" must be a dictionary') if not nodes: # we're done! return starting_num_nodes = len(nodes) newly_instantiated = set(...
[ "def", "_do", "(", "self", ",", "nodes", ")", ":", "if", "not", "isinstance", "(", "nodes", ",", "dict", ")", ":", "raise", "TypeError", "(", "'\"nodes\" must be a dictionary'", ")", "if", "not", "nodes", ":", "# we're done!", "return", "starting_num_nodes", ...
Recursive method to instantiate services
[ "Recursive", "method", "to", "instantiate", "services" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L131-L175
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver._init_nodes
def _init_nodes(self, config): """ Gathers dependency sets onto _nodes """ if not isinstance(config, dict): raise TypeError('"config" must be a dictionary') for (name, conf) in six.iteritems(config): args = [] if 'args' not in conf else conf['args'] kwargs = ...
python
def _init_nodes(self, config): """ Gathers dependency sets onto _nodes """ if not isinstance(config, dict): raise TypeError('"config" must be a dictionary') for (name, conf) in six.iteritems(config): args = [] if 'args' not in conf else conf['args'] kwargs = ...
[ "def", "_init_nodes", "(", "self", ",", "config", ")", ":", "if", "not", "isinstance", "(", "config", ",", "dict", ")", ":", "raise", "TypeError", "(", "'\"config\" must be a dictionary'", ")", "for", "(", "name", ",", "conf", ")", "in", "six", ".", "ite...
Gathers dependency sets onto _nodes
[ "Gathers", "dependency", "sets", "onto", "_nodes" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L177-L193
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver._get_dependencies_from_args
def _get_dependencies_from_args(self, args): """ Parse arguments """ if not isinstance(args, list): raise TypeError('"args" must be a list') dependency_names = set() for arg in args: new_names = self._check_arg(arg) dependency_names.update(new_names) ...
python
def _get_dependencies_from_args(self, args): """ Parse arguments """ if not isinstance(args, list): raise TypeError('"args" must be a list') dependency_names = set() for arg in args: new_names = self._check_arg(arg) dependency_names.update(new_names) ...
[ "def", "_get_dependencies_from_args", "(", "self", ",", "args", ")", ":", "if", "not", "isinstance", "(", "args", ",", "list", ")", ":", "raise", "TypeError", "(", "'\"args\" must be a list'", ")", "dependency_names", "=", "set", "(", ")", "for", "arg", "in"...
Parse arguments
[ "Parse", "arguments" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L195-L204
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver._get_dependencies_from_kwargs
def _get_dependencies_from_kwargs(self, args): """ Parse keyed arguments """ if not isinstance(args, dict): raise TypeError('"kwargs" must be a dictionary') dependency_names = set() for arg in args.values(): new_names = self._check_arg(arg) dependency...
python
def _get_dependencies_from_kwargs(self, args): """ Parse keyed arguments """ if not isinstance(args, dict): raise TypeError('"kwargs" must be a dictionary') dependency_names = set() for arg in args.values(): new_names = self._check_arg(arg) dependency...
[ "def", "_get_dependencies_from_kwargs", "(", "self", ",", "args", ")", ":", "if", "not", "isinstance", "(", "args", ",", "dict", ")", ":", "raise", "TypeError", "(", "'\"kwargs\" must be a dictionary'", ")", "dependency_names", "=", "set", "(", ")", "for", "ar...
Parse keyed arguments
[ "Parse", "keyed", "arguments" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L206-L215
refinery29/chassis
chassis/services/dependency_injection/resolver.py
Resolver._check_arg
def _check_arg(self, arg): """ Check individual argument (list/tuple/string/etc) """ if isinstance(arg, list): return self._get_dependencies_from_args(arg) elif isinstance(arg, dict): return self._get_dependencies_from_kwargs(arg) if not is_dependency_name(arg): ...
python
def _check_arg(self, arg): """ Check individual argument (list/tuple/string/etc) """ if isinstance(arg, list): return self._get_dependencies_from_args(arg) elif isinstance(arg, dict): return self._get_dependencies_from_kwargs(arg) if not is_dependency_name(arg): ...
[ "def", "_check_arg", "(", "self", ",", "arg", ")", ":", "if", "isinstance", "(", "arg", ",", "list", ")", ":", "return", "self", ".", "_get_dependencies_from_args", "(", "arg", ")", "elif", "isinstance", "(", "arg", ",", "dict", ")", ":", "return", "se...
Check individual argument (list/tuple/string/etc)
[ "Check", "individual", "argument", "(", "list", "/", "tuple", "/", "string", "/", "etc", ")" ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/services/dependency_injection/resolver.py#L217-L226
miquelo/resort
packages/resort/engine/__init__.py
ProfileManager.load
def load(self, prof_name): """ Load the profile with the given name. :param str prof_name: Profile name. :rtype: ProfileStub :return: An stub to loaded profile. """ prof_dir = self.__profile_dir(prof_name) prof_ini_path = self.__profile_ini_path(prof_dir) if not os.path.exists(p...
python
def load(self, prof_name): """ Load the profile with the given name. :param str prof_name: Profile name. :rtype: ProfileStub :return: An stub to loaded profile. """ prof_dir = self.__profile_dir(prof_name) prof_ini_path = self.__profile_ini_path(prof_dir) if not os.path.exists(p...
[ "def", "load", "(", "self", ",", "prof_name", ")", ":", "prof_dir", "=", "self", ".", "__profile_dir", "(", "prof_name", ")", "prof_ini_path", "=", "self", ".", "__profile_ini_path", "(", "prof_dir", ")", "if", "not", "os", ".", "path", ".", "exists", "(...
Load the profile with the given name. :param str prof_name: Profile name. :rtype: ProfileStub :return: An stub to loaded profile.
[ "Load", "the", "profile", "with", "the", "given", "name", ".", ":", "param", "str", "prof_name", ":", "Profile", "name", ".", ":", "rtype", ":", "ProfileStub", ":", "return", ":", "An", "stub", "to", "loaded", "profile", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L69-L99
miquelo/resort
packages/resort/engine/__init__.py
ProfileManager.store
def store(self, prof_name, prof_type): """ Store a profile with the given name and type. :param str prof_name: Profile name. :param str prof_type: Profile type. """ prof_dir = self.__profile_dir(prof_name) prof_stub = self.__profile_stub(prof_name, prof_type, prof_dir) if not os.path.e...
python
def store(self, prof_name, prof_type): """ Store a profile with the given name and type. :param str prof_name: Profile name. :param str prof_type: Profile type. """ prof_dir = self.__profile_dir(prof_name) prof_stub = self.__profile_stub(prof_name, prof_type, prof_dir) if not os.path.e...
[ "def", "store", "(", "self", ",", "prof_name", ",", "prof_type", ")", ":", "prof_dir", "=", "self", ".", "__profile_dir", "(", "prof_name", ")", "prof_stub", "=", "self", ".", "__profile_stub", "(", "prof_name", ",", "prof_type", ",", "prof_dir", ")", "if"...
Store a profile with the given name and type. :param str prof_name: Profile name. :param str prof_type: Profile type.
[ "Store", "a", "profile", "with", "the", "given", "name", "and", "type", ".", ":", "param", "str", "prof_name", ":", "Profile", "name", ".", ":", "param", "str", "prof_type", ":", "Profile", "type", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L101-L135
miquelo/resort
packages/resort/engine/__init__.py
ProfileStub.context
def context(self): """ Create an exectution context. :rtype: execution.Context :return: The created execution context. """ return execution.Context(self.__base_dir, self.__prof_dir, self.__prof_name)
python
def context(self): """ Create an exectution context. :rtype: execution.Context :return: The created execution context. """ return execution.Context(self.__base_dir, self.__prof_dir, self.__prof_name)
[ "def", "context", "(", "self", ")", ":", "return", "execution", ".", "Context", "(", "self", ".", "__base_dir", ",", "self", ".", "__prof_dir", ",", "self", ".", "__prof_name", ")" ]
Create an exectution context. :rtype: execution.Context :return: The created execution context.
[ "Create", "an", "exectution", "context", ".", ":", "rtype", ":", "execution", ".", "Context", ":", "return", ":", "The", "created", "execution", "context", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L165-L177
miquelo/resort
packages/resort/engine/__init__.py
ProfileStub.component_list
def component_list(self): """ List of :class:`ComponentStub` instances for this profile. :rtype: list """ comp_list = [] self.__component_list(self.component(None), comp_list) return sorted(comp_list)
python
def component_list(self): """ List of :class:`ComponentStub` instances for this profile. :rtype: list """ comp_list = [] self.__component_list(self.component(None), comp_list) return sorted(comp_list)
[ "def", "component_list", "(", "self", ")", ":", "comp_list", "=", "[", "]", "self", ".", "__component_list", "(", "self", ".", "component", "(", "None", ")", ",", "comp_list", ")", "return", "sorted", "(", "comp_list", ")" ]
List of :class:`ComponentStub` instances for this profile. :rtype: list
[ "List", "of", ":", "class", ":", "ComponentStub", "instances", "for", "this", "profile", ".", ":", "rtype", ":", "list" ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L194-L205
miquelo/resort
packages/resort/engine/__init__.py
ComponentStub.dependencies
def dependencies(self): """ Yield :class:`ComponentStub` of dependencies of this component. """ try: for dep_name in self.__prof.dependencies(self.name()): yield self.__comp_stub_reg.get(dep_name) except TypeError: yield from ()
python
def dependencies(self): """ Yield :class:`ComponentStub` of dependencies of this component. """ try: for dep_name in self.__prof.dependencies(self.name()): yield self.__comp_stub_reg.get(dep_name) except TypeError: yield from ()
[ "def", "dependencies", "(", "self", ")", ":", "try", ":", "for", "dep_name", "in", "self", ".", "__prof", ".", "dependencies", "(", "self", ".", "name", "(", ")", ")", ":", "yield", "self", ".", "__comp_stub_reg", ".", "get", "(", "dep_name", ")", "e...
Yield :class:`ComponentStub` of dependencies of this component.
[ "Yield", ":", "class", ":", "ComponentStub", "of", "dependencies", "of", "this", "component", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L336-L346
miquelo/resort
packages/resort/engine/__init__.py
ComponentStub.insert
def insert(self, context, plan): """ Include an insert operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances. """ op = execution.Insert(self.__comp_name, self.__comp()) if op not in plan ...
python
def insert(self, context, plan): """ Include an insert operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances. """ op = execution.Insert(self.__comp_name, self.__comp()) if op not in plan ...
[ "def", "insert", "(", "self", ",", "context", ",", "plan", ")", ":", "op", "=", "execution", ".", "Insert", "(", "self", ".", "__comp_name", ",", "self", ".", "__comp", "(", ")", ")", "if", "op", "not", "in", "plan", "and", "self", ".", "available"...
Include an insert operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances.
[ "Include", "an", "insert", "operation", "to", "the", "given", "plan", ".", ":", "param", "execution", ".", "Context", "context", ":", "Current", "execution", "context", ".", ":", "param", "list", "plan", ":", "List", "of", ":", "class", ":", "execution", ...
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L361-L376
miquelo/resort
packages/resort/engine/__init__.py
ComponentStub.delete
def delete(self, context, plan): """ Include a delete operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances. """ op = execution.Delete(self.__comp_name, self.__comp()) if op not in plan a...
python
def delete(self, context, plan): """ Include a delete operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances. """ op = execution.Delete(self.__comp_name, self.__comp()) if op not in plan a...
[ "def", "delete", "(", "self", ",", "context", ",", "plan", ")", ":", "op", "=", "execution", ".", "Delete", "(", "self", ".", "__comp_name", ",", "self", ".", "__comp", "(", ")", ")", "if", "op", "not", "in", "plan", "and", "self", ".", "available"...
Include a delete operation to the given plan. :param execution.Context context: Current execution context. :param list plan: List of :class:`execution.Operation` instances.
[ "Include", "a", "delete", "operation", "to", "the", "given", "plan", ".", ":", "param", "execution", ".", "Context", "context", ":", "Current", "execution", "context", ".", ":", "param", "list", "plan", ":", "List", "of", ":", "class", ":", "execution", ...
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L378-L393
miquelo/resort
packages/resort/engine/__init__.py
ComponentStubRegistry.get
def get(self, comp_name): """ Get the specified component. :param str comp_name: Specified component name. :rtype: ComponentStub :return: Specified component stub. """ try: return self.__cache[comp_name] except KeyError: comp_stub = ComponentStub(self, comp_name, self.__prof...
python
def get(self, comp_name): """ Get the specified component. :param str comp_name: Specified component name. :rtype: ComponentStub :return: Specified component stub. """ try: return self.__cache[comp_name] except KeyError: comp_stub = ComponentStub(self, comp_name, self.__prof...
[ "def", "get", "(", "self", ",", "comp_name", ")", ":", "try", ":", "return", "self", ".", "__cache", "[", "comp_name", "]", "except", "KeyError", ":", "comp_stub", "=", "ComponentStub", "(", "self", ",", "comp_name", ",", "self", ".", "__prof", ")", "s...
Get the specified component. :param str comp_name: Specified component name. :rtype: ComponentStub :return: Specified component stub.
[ "Get", "the", "specified", "component", ".", ":", "param", "str", "comp_name", ":", "Specified", "component", "name", ".", ":", "rtype", ":", "ComponentStub", ":", "return", ":", "Specified", "component", "stub", "." ]
train
https://github.com/miquelo/resort/blob/097a25d3257c91a75c194fd44c2797ab356f85dd/packages/resort/engine/__init__.py#L409-L427
evetrivia/thanatos
thanatos/database/universe.py
get_all_regions
def get_all_regions(db_connection): """ Gets a list of all regions. :return: A list of all regions. Results have regionID and regionName. :rtype: list """ if not hasattr(get_all_regions, '_results'): sql = 'CALL get_all_regions();' results = execute_sql(sql, db_connection) ...
python
def get_all_regions(db_connection): """ Gets a list of all regions. :return: A list of all regions. Results have regionID and regionName. :rtype: list """ if not hasattr(get_all_regions, '_results'): sql = 'CALL get_all_regions();' results = execute_sql(sql, db_connection) ...
[ "def", "get_all_regions", "(", "db_connection", ")", ":", "if", "not", "hasattr", "(", "get_all_regions", ",", "'_results'", ")", ":", "sql", "=", "'CALL get_all_regions();'", "results", "=", "execute_sql", "(", "sql", ",", "db_connection", ")", "get_all_regions",...
Gets a list of all regions. :return: A list of all regions. Results have regionID and regionName. :rtype: list
[ "Gets", "a", "list", "of", "all", "regions", "." ]
train
https://github.com/evetrivia/thanatos/blob/664c12a8ccf4d27ab0e06e0969bbb6381f74789c/thanatos/database/universe.py#L10-L22
evetrivia/thanatos
thanatos/database/universe.py
get_all_not_wh_regions
def get_all_not_wh_regions(db_connection): """ Gets a list of all regions that are not WH regions. :return: A list of all regions not including wormhole regions. Results have regionID and regionName. :rtype: list """ if not hasattr(get_all_not_wh_regions, '_results'): sql = 'CALL get_all_n...
python
def get_all_not_wh_regions(db_connection): """ Gets a list of all regions that are not WH regions. :return: A list of all regions not including wormhole regions. Results have regionID and regionName. :rtype: list """ if not hasattr(get_all_not_wh_regions, '_results'): sql = 'CALL get_all_n...
[ "def", "get_all_not_wh_regions", "(", "db_connection", ")", ":", "if", "not", "hasattr", "(", "get_all_not_wh_regions", ",", "'_results'", ")", ":", "sql", "=", "'CALL get_all_not_wh_regions();'", "results", "=", "execute_sql", "(", "sql", ",", "db_connection", ")",...
Gets a list of all regions that are not WH regions. :return: A list of all regions not including wormhole regions. Results have regionID and regionName. :rtype: list
[ "Gets", "a", "list", "of", "all", "regions", "that", "are", "not", "WH", "regions", "." ]
train
https://github.com/evetrivia/thanatos/blob/664c12a8ccf4d27ab0e06e0969bbb6381f74789c/thanatos/database/universe.py#L25-L37
evetrivia/thanatos
thanatos/database/universe.py
get_all_regions_connected_to_region
def get_all_regions_connected_to_region(db_connection, region_id): """ Gets a list of all regions connected to the region ID passed in. :param region_id: Region ID to find all regions connected to. :type region_id: int :return: A list of all regions connected to the specified region ID. Results have r...
python
def get_all_regions_connected_to_region(db_connection, region_id): """ Gets a list of all regions connected to the region ID passed in. :param region_id: Region ID to find all regions connected to. :type region_id: int :return: A list of all regions connected to the specified region ID. Results have r...
[ "def", "get_all_regions_connected_to_region", "(", "db_connection", ",", "region_id", ")", ":", "sql", "=", "'CALL get_all_regions_connected_to_region({});'", ".", "format", "(", "region_id", ")", "results", "=", "execute_sql", "(", "sql", ",", "db_connection", ")", "...
Gets a list of all regions connected to the region ID passed in. :param region_id: Region ID to find all regions connected to. :type region_id: int :return: A list of all regions connected to the specified region ID. Results have regionID and regionName. :rtype: list
[ "Gets", "a", "list", "of", "all", "regions", "connected", "to", "the", "region", "ID", "passed", "in", "." ]
train
https://github.com/evetrivia/thanatos/blob/664c12a8ccf4d27ab0e06e0969bbb6381f74789c/thanatos/database/universe.py#L40-L53
edeposit/edeposit.amqp.antivirus
bin/edeposit_clamd_init.py
update_configuration
def update_configuration(configuration): """ Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. """ for key, val in REQUIRED_SETTINGS.items(): if val in ["$username", ...
python
def update_configuration(configuration): """ Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration. """ for key, val in REQUIRED_SETTINGS.items(): if val in ["$username", ...
[ "def", "update_configuration", "(", "configuration", ")", ":", "for", "key", ",", "val", "in", "REQUIRED_SETTINGS", ".", "items", "(", ")", ":", "if", "val", "in", "[", "\"$username\"", ",", "\"$groupname\"", "]", ":", "val", "=", "get_username", "(", ")",...
Set all configuration specified in :attr:`REQUIRED_SETTINGS`. Args: configuration (str): Configuration file content. Returns: str: Updated configuration.
[ "Set", "all", "configuration", "specified", "in", ":", "attr", ":", "REQUIRED_SETTINGS", "." ]
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/bin/edeposit_clamd_init.py#L199-L215
edeposit/edeposit.amqp.antivirus
bin/edeposit_clamd_init.py
create_config
def create_config(cnf_file, uid, overwrite): """ Creates configuration file and the directory where it should be stored and set correct permissions. Args: cnf_file (str): Path to the configuration file. uid (int): User ID - will be used for chown. overwrite (bool): Overwrite the...
python
def create_config(cnf_file, uid, overwrite): """ Creates configuration file and the directory where it should be stored and set correct permissions. Args: cnf_file (str): Path to the configuration file. uid (int): User ID - will be used for chown. overwrite (bool): Overwrite the...
[ "def", "create_config", "(", "cnf_file", ",", "uid", ",", "overwrite", ")", ":", "conf", "=", "None", "# needed also on suse, because pyClamd module", "if", "not", "os", ".", "path", ".", "exists", "(", "settings", ".", "DEB_CONF_PATH", ")", ":", "os", ".", ...
Creates configuration file and the directory where it should be stored and set correct permissions. Args: cnf_file (str): Path to the configuration file. uid (int): User ID - will be used for chown. overwrite (bool): Overwrite the configuration with :attr:`CLEAN_CONFIG`.
[ "Creates", "configuration", "file", "and", "the", "directory", "where", "it", "should", "be", "stored", "and", "set", "correct", "permissions", "." ]
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/bin/edeposit_clamd_init.py#L218-L260
edeposit/edeposit.amqp.antivirus
bin/edeposit_clamd_init.py
create_log
def create_log(log_file, uid): """ Create log file and set necessary permissions. Args: log_file (str): Path to the log file. uid (int): User ID - will be used for chown. """ if not os.path.exists(log_file): # create new log file dir_name = os.path.dirname(log_file) ...
python
def create_log(log_file, uid): """ Create log file and set necessary permissions. Args: log_file (str): Path to the log file. uid (int): User ID - will be used for chown. """ if not os.path.exists(log_file): # create new log file dir_name = os.path.dirname(log_file) ...
[ "def", "create_log", "(", "log_file", ",", "uid", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "log_file", ")", ":", "# create new log file", "dir_name", "=", "os", ".", "path", ".", "dirname", "(", "log_file", ")", "if", "not", "os", ...
Create log file and set necessary permissions. Args: log_file (str): Path to the log file. uid (int): User ID - will be used for chown.
[ "Create", "log", "file", "and", "set", "necessary", "permissions", "." ]
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/bin/edeposit_clamd_init.py#L263-L281
edeposit/edeposit.amqp.antivirus
bin/edeposit_clamd_init.py
main
def main(conf_file, overwrite, logger): """ Create configuration and log file. Restart the daemon when configuration is done. Args: conf_file (str): Path to the configuration file. overwrite (bool): Overwrite the configuration file with `clean` config? """ uid = pwd.getpwnam(get...
python
def main(conf_file, overwrite, logger): """ Create configuration and log file. Restart the daemon when configuration is done. Args: conf_file (str): Path to the configuration file. overwrite (bool): Overwrite the configuration file with `clean` config? """ uid = pwd.getpwnam(get...
[ "def", "main", "(", "conf_file", ",", "overwrite", ",", "logger", ")", ":", "uid", "=", "pwd", ".", "getpwnam", "(", "get_username", "(", ")", ")", ".", "pw_uid", "# stop the daemon", "logger", ".", "info", "(", "\"Stopping the daemon.\"", ")", "sh", ".", ...
Create configuration and log file. Restart the daemon when configuration is done. Args: conf_file (str): Path to the configuration file. overwrite (bool): Overwrite the configuration file with `clean` config?
[ "Create", "configuration", "and", "log", "file", ".", "Restart", "the", "daemon", "when", "configuration", "is", "done", "." ]
train
https://github.com/edeposit/edeposit.amqp.antivirus/blob/011b38bbe920819fab99a5891b1e70732321a598/bin/edeposit_clamd_init.py#L292-L322
20c/xbahn
xbahn/engineer.py
setup_debug_logging
def setup_debug_logging(): """ set up debug logging """ logger = logging.getLogger("xbahn") logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter("%(name)s: %(message)s")) logger.addHandler(ch)
python
def setup_debug_logging(): """ set up debug logging """ logger = logging.getLogger("xbahn") logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter("%(name)s: %(message)s")) logger.addHandler(ch)
[ "def", "setup_debug_logging", "(", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "\"xbahn\"", ")", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "ch", "=", "logging", ".", "StreamHandler", "(", ")", "ch", ".", "setLevel", "("...
set up debug logging
[ "set", "up", "debug", "logging" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L17-L29
20c/xbahn
xbahn/engineer.py
shell
def shell(ctx): """ open an engineer shell """ shell = code.InteractiveConsole({"engineer": getattr(ctx.parent, "widget", None)}) shell.interact("\n".join([ "Engineer connected to %s" % ctx.parent.params["host"], "Dispatch available through the 'engineer' object" ]))
python
def shell(ctx): """ open an engineer shell """ shell = code.InteractiveConsole({"engineer": getattr(ctx.parent, "widget", None)}) shell.interact("\n".join([ "Engineer connected to %s" % ctx.parent.params["host"], "Dispatch available through the 'engineer' object" ]))
[ "def", "shell", "(", "ctx", ")", ":", "shell", "=", "code", ".", "InteractiveConsole", "(", "{", "\"engineer\"", ":", "getattr", "(", "ctx", ".", "parent", ",", "\"widget\"", ",", "None", ")", "}", ")", "shell", ".", "interact", "(", "\"\\n\"", ".", ...
open an engineer shell
[ "open", "an", "engineer", "shell" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L258-L267
20c/xbahn
xbahn/engineer.py
ServerWidget.engineer_list_commands
def engineer_list_commands(self): """ Returns a list of all api end points (commands) exposed to engineer """ rv = [] for k in dir(self): attr = getattr(self,k) if type(getattr(attr, "engineer", None)) == dict: rv.append(k) ...
python
def engineer_list_commands(self): """ Returns a list of all api end points (commands) exposed to engineer """ rv = [] for k in dir(self): attr = getattr(self,k) if type(getattr(attr, "engineer", None)) == dict: rv.append(k) ...
[ "def", "engineer_list_commands", "(", "self", ")", ":", "rv", "=", "[", "]", "for", "k", "in", "dir", "(", "self", ")", ":", "attr", "=", "getattr", "(", "self", ",", "k", ")", "if", "type", "(", "getattr", "(", "attr", ",", "\"engineer\"", ",", ...
Returns a list of all api end points (commands) exposed to engineer
[ "Returns", "a", "list", "of", "all", "api", "end", "points", "(", "commands", ")", "exposed", "to", "engineer" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L115-L127
20c/xbahn
xbahn/engineer.py
ServerWidget.engineer_info
def engineer_info(self, action): """ Returns: dict: engineer command information - arguments (list<dict>): command arguments - args (list): args to pass through to click.argument - kwargs (dict): keyword arguments to pass through to c...
python
def engineer_info(self, action): """ Returns: dict: engineer command information - arguments (list<dict>): command arguments - args (list): args to pass through to click.argument - kwargs (dict): keyword arguments to pass through to c...
[ "def", "engineer_info", "(", "self", ",", "action", ")", ":", "fn", "=", "getattr", "(", "self", ",", "action", ",", "None", ")", "if", "not", "fn", ":", "raise", "AttributeError", "(", "\"Engineer action not found: %s\"", "%", "action", ")", "if", "not", ...
Returns: dict: engineer command information - arguments (list<dict>): command arguments - args (list): args to pass through to click.argument - kwargs (dict): keyword arguments to pass through to click.argument - options (list<dict>): ...
[ "Returns", ":", "dict", ":", "engineer", "command", "information", "-", "arguments", "(", "list<dict", ">", ")", ":", "command", "arguments", "-", "args", "(", "list", ")", ":", "args", "to", "pass", "through", "to", "click", ".", "argument", "-", "kwarg...
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L130-L149
20c/xbahn
xbahn/engineer.py
Engineer.connect
def connect(self, ctx): """ establish xbahn connection and store on click context """ if hasattr(ctx,"conn") or "host" not in ctx.params: return ctx.conn = conn = connect(ctx.params["host"]) lnk = link.Link() lnk.wire("main", receive=conn, send=conn...
python
def connect(self, ctx): """ establish xbahn connection and store on click context """ if hasattr(ctx,"conn") or "host" not in ctx.params: return ctx.conn = conn = connect(ctx.params["host"]) lnk = link.Link() lnk.wire("main", receive=conn, send=conn...
[ "def", "connect", "(", "self", ",", "ctx", ")", ":", "if", "hasattr", "(", "ctx", ",", "\"conn\"", ")", "or", "\"host\"", "not", "in", "ctx", ".", "params", ":", "return", "ctx", ".", "conn", "=", "conn", "=", "connect", "(", "ctx", ".", "params", ...
establish xbahn connection and store on click context
[ "establish", "xbahn", "connection", "and", "store", "on", "click", "context" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L163-L176
20c/xbahn
xbahn/engineer.py
Engineer.list_commands
def list_commands(self, ctx): """ list all commands exposed to engineer """ self.connect(ctx) if not hasattr(ctx, "widget"): return super(Engineer, self).list_commands(ctx) return ctx.widget.engineer_list_commands() + super(Engineer, self).list_commands(c...
python
def list_commands(self, ctx): """ list all commands exposed to engineer """ self.connect(ctx) if not hasattr(ctx, "widget"): return super(Engineer, self).list_commands(ctx) return ctx.widget.engineer_list_commands() + super(Engineer, self).list_commands(c...
[ "def", "list_commands", "(", "self", ",", "ctx", ")", ":", "self", ".", "connect", "(", "ctx", ")", "if", "not", "hasattr", "(", "ctx", ",", "\"widget\"", ")", ":", "return", "super", "(", "Engineer", ",", "self", ")", ".", "list_commands", "(", "ctx...
list all commands exposed to engineer
[ "list", "all", "commands", "exposed", "to", "engineer" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L179-L191
20c/xbahn
xbahn/engineer.py
Engineer.get_command
def get_command(self, ctx, name): """ get click command from engineer exposed xbahn command specs """ # connect to xbahn self.connect(ctx) if not hasattr(ctx, "widget") or name in ["shell"]: return super(Engineer, self).get_command(ctx, name) if na...
python
def get_command(self, ctx, name): """ get click command from engineer exposed xbahn command specs """ # connect to xbahn self.connect(ctx) if not hasattr(ctx, "widget") or name in ["shell"]: return super(Engineer, self).get_command(ctx, name) if na...
[ "def", "get_command", "(", "self", ",", "ctx", ",", "name", ")", ":", "# connect to xbahn", "self", ".", "connect", "(", "ctx", ")", "if", "not", "hasattr", "(", "ctx", ",", "\"widget\"", ")", "or", "name", "in", "[", "\"shell\"", "]", ":", "return", ...
get click command from engineer exposed xbahn command specs
[ "get", "click", "command", "from", "engineer", "exposed", "xbahn", "command", "specs" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L193-L212
20c/xbahn
xbahn/engineer.py
Engineer.make_command
def make_command(self, ctx, name, info): """ make click sub-command from command info gotten from xbahn engineer """ @self.command() @click.option("--debug/--no-debug", default=False, help="Show debug information") @doc(info.get("description")) def func(...
python
def make_command(self, ctx, name, info): """ make click sub-command from command info gotten from xbahn engineer """ @self.command() @click.option("--debug/--no-debug", default=False, help="Show debug information") @doc(info.get("description")) def func(...
[ "def", "make_command", "(", "self", ",", "ctx", ",", "name", ",", "info", ")", ":", "@", "self", ".", "command", "(", ")", "@", "click", ".", "option", "(", "\"--debug/--no-debug\"", ",", "default", "=", "False", ",", "help", "=", "\"Show debug informati...
make click sub-command from command info gotten from xbahn engineer
[ "make", "click", "sub", "-", "command", "from", "command", "info", "gotten", "from", "xbahn", "engineer" ]
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/engineer.py#L214-L241
RRostami/PyTBot
PyTBot/telegram.py
bot.getMe
def getMe(self): ''' returns User Object ''' response_str = self._command('getMe') if(not response_str): return False response = json.loads(response_str) return response
python
def getMe(self): ''' returns User Object ''' response_str = self._command('getMe') if(not response_str): return False response = json.loads(response_str) return response
[ "def", "getMe", "(", "self", ")", ":", "response_str", "=", "self", ".", "_command", "(", "'getMe'", ")", "if", "(", "not", "response_str", ")", ":", "return", "False", "response", "=", "json", ".", "loads", "(", "response_str", ")", "return", "response"...
returns User Object
[ "returns", "User", "Object" ]
train
https://github.com/RRostami/PyTBot/blob/a95bb9b3d3d19284b60c93b758a8aa26e3357929/PyTBot/telegram.py#L124-L130
RRostami/PyTBot
PyTBot/telegram.py
bot.sendMessage
def sendMessage(self,chat_id,text,parse_mode=None,disable_web=None,reply_msg_id=None,markup=None): ''' On failure returns False On success returns Message Object ''' payload={'chat_id' : chat_id, 'text' : text, 'parse_mode': parse_mode , 'disable_web_page_preview' : disable_web , 'reply_to_message_id' : reply_msg...
python
def sendMessage(self,chat_id,text,parse_mode=None,disable_web=None,reply_msg_id=None,markup=None): ''' On failure returns False On success returns Message Object ''' payload={'chat_id' : chat_id, 'text' : text, 'parse_mode': parse_mode , 'disable_web_page_preview' : disable_web , 'reply_to_message_id' : reply_msg...
[ "def", "sendMessage", "(", "self", ",", "chat_id", ",", "text", ",", "parse_mode", "=", "None", ",", "disable_web", "=", "None", ",", "reply_msg_id", "=", "None", ",", "markup", "=", "None", ")", ":", "payload", "=", "{", "'chat_id'", ":", "chat_id", "...
On failure returns False On success returns Message Object
[ "On", "failure", "returns", "False", "On", "success", "returns", "Message", "Object" ]
train
https://github.com/RRostami/PyTBot/blob/a95bb9b3d3d19284b60c93b758a8aa26e3357929/PyTBot/telegram.py#L132-L142
slarse/pdfebc-core
pdfebc_core/misc_utils.py
if_callable_call_with_formatted_string
def if_callable_call_with_formatted_string(callback, formattable_string, *args): """If the callback is callable, format the string with the args and make a call. Otherwise, do nothing. Args: callback (function): May or may not be callable. formattable_string (str): A string with '{}'s inser...
python
def if_callable_call_with_formatted_string(callback, formattable_string, *args): """If the callback is callable, format the string with the args and make a call. Otherwise, do nothing. Args: callback (function): May or may not be callable. formattable_string (str): A string with '{}'s inser...
[ "def", "if_callable_call_with_formatted_string", "(", "callback", ",", "formattable_string", ",", "*", "args", ")", ":", "try", ":", "formatted_string", "=", "formattable_string", ".", "format", "(", "*", "args", ")", "except", "IndexError", ":", "raise", "ValueEr...
If the callback is callable, format the string with the args and make a call. Otherwise, do nothing. Args: callback (function): May or may not be callable. formattable_string (str): A string with '{}'s inserted. *args: A variable amount of arguments for the string formatting. Must corre...
[ "If", "the", "callback", "is", "callable", "format", "the", "string", "with", "the", "args", "and", "make", "a", "call", ".", "Otherwise", "do", "nothing", "." ]
train
https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/misc_utils.py#L14-L32
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.feeling_lucky
def feeling_lucky(cls, obj): """Tries to convert given object to an UTC timestamp is ms, based on its type. """ if isinstance(obj, six.string_types): return cls.from_str(obj) elif isinstance(obj, six.integer_types) and obj <= MAX_POSIX_TIMESTAMP: return cl...
python
def feeling_lucky(cls, obj): """Tries to convert given object to an UTC timestamp is ms, based on its type. """ if isinstance(obj, six.string_types): return cls.from_str(obj) elif isinstance(obj, six.integer_types) and obj <= MAX_POSIX_TIMESTAMP: return cl...
[ "def", "feeling_lucky", "(", "cls", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "six", ".", "string_types", ")", ":", "return", "cls", ".", "from_str", "(", "obj", ")", "elif", "isinstance", "(", "obj", ",", "six", ".", "integer_types", ...
Tries to convert given object to an UTC timestamp is ms, based on its type.
[ "Tries", "to", "convert", "given", "object", "to", "an", "UTC", "timestamp", "is", "ms", "based", "on", "its", "type", "." ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L38-L51
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.fix_mispelled_day
def fix_mispelled_day(cls, timestr): """fix mispelled day when written in english :return: `None` if the day was not modified, the new date otherwise """ day_extraction = cls.START_WITH_DAY_OF_WEEK.match(timestr) if day_extraction is not None: day = day_extraction.gr...
python
def fix_mispelled_day(cls, timestr): """fix mispelled day when written in english :return: `None` if the day was not modified, the new date otherwise """ day_extraction = cls.START_WITH_DAY_OF_WEEK.match(timestr) if day_extraction is not None: day = day_extraction.gr...
[ "def", "fix_mispelled_day", "(", "cls", ",", "timestr", ")", ":", "day_extraction", "=", "cls", ".", "START_WITH_DAY_OF_WEEK", ".", "match", "(", "timestr", ")", "if", "day_extraction", "is", "not", "None", ":", "day", "=", "day_extraction", ".", "group", "(...
fix mispelled day when written in english :return: `None` if the day was not modified, the new date otherwise
[ "fix", "mispelled", "day", "when", "written", "in", "english" ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L54-L69
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.remove_parenthesis_around_tz
def remove_parenthesis_around_tz(cls, timestr): """get rid of parenthesis around timezone: (GMT) => GMT :return: the new string if parenthesis were found, `None` otherwise """ parenthesis = cls.TIMEZONE_PARENTHESIS.match(timestr) if parenthesis is not None: return pa...
python
def remove_parenthesis_around_tz(cls, timestr): """get rid of parenthesis around timezone: (GMT) => GMT :return: the new string if parenthesis were found, `None` otherwise """ parenthesis = cls.TIMEZONE_PARENTHESIS.match(timestr) if parenthesis is not None: return pa...
[ "def", "remove_parenthesis_around_tz", "(", "cls", ",", "timestr", ")", ":", "parenthesis", "=", "cls", ".", "TIMEZONE_PARENTHESIS", ".", "match", "(", "timestr", ")", "if", "parenthesis", "is", "not", "None", ":", "return", "parenthesis", ".", "group", "(", ...
get rid of parenthesis around timezone: (GMT) => GMT :return: the new string if parenthesis were found, `None` otherwise
[ "get", "rid", "of", "parenthesis", "around", "timezone", ":", "(", "GMT", ")", "=", ">", "GMT" ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L72-L79
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.remove_quotes_around_tz
def remove_quotes_around_tz(cls, timestr): """Remove quotes (single and double) around timezone otherwise `dateutil.parser.parse` raises """ quoted = cls.QUOTED_TIMEZONE.match(timestr) if quoted is not None: return quoted.group(1) + quoted.group(2)
python
def remove_quotes_around_tz(cls, timestr): """Remove quotes (single and double) around timezone otherwise `dateutil.parser.parse` raises """ quoted = cls.QUOTED_TIMEZONE.match(timestr) if quoted is not None: return quoted.group(1) + quoted.group(2)
[ "def", "remove_quotes_around_tz", "(", "cls", ",", "timestr", ")", ":", "quoted", "=", "cls", ".", "QUOTED_TIMEZONE", ".", "match", "(", "timestr", ")", "if", "quoted", "is", "not", "None", ":", "return", "quoted", ".", "group", "(", "1", ")", "+", "qu...
Remove quotes (single and double) around timezone otherwise `dateutil.parser.parse` raises
[ "Remove", "quotes", "(", "single", "and", "double", ")", "around", "timezone", "otherwise", "dateutil", ".", "parser", ".", "parse", "raises" ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L82-L88
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.remove_timezone
def remove_timezone(cls, timestr): """Completely remove timezone information, if any. :return: the new string if timezone was found, `None` otherwise """ if re.match(r".*[\-+]?\d{2}:\d{2}$", timestr): return re.sub( r"(.*)(\s[\+-]?\d\d:\d\d)$", ...
python
def remove_timezone(cls, timestr): """Completely remove timezone information, if any. :return: the new string if timezone was found, `None` otherwise """ if re.match(r".*[\-+]?\d{2}:\d{2}$", timestr): return re.sub( r"(.*)(\s[\+-]?\d\d:\d\d)$", ...
[ "def", "remove_timezone", "(", "cls", ",", "timestr", ")", ":", "if", "re", ".", "match", "(", "r\".*[\\-+]?\\d{2}:\\d{2}$\"", ",", "timestr", ")", ":", "return", "re", ".", "sub", "(", "r\"(.*)(\\s[\\+-]?\\d\\d:\\d\\d)$\"", ",", "r\"\\1\"", ",", "timestr", ")...
Completely remove timezone information, if any. :return: the new string if timezone was found, `None` otherwise
[ "Completely", "remove", "timezone", "information", "if", "any", "." ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L91-L101
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.fix_timezone_separator
def fix_timezone_separator(cls, timestr): """Replace invalid timezone separator to prevent `dateutil.parser.parse` to raise. :return: the new string if invalid separators were found, `None` otherwise """ tz_sep = cls.TIMEZONE_SEPARATOR.match(timestr) if ...
python
def fix_timezone_separator(cls, timestr): """Replace invalid timezone separator to prevent `dateutil.parser.parse` to raise. :return: the new string if invalid separators were found, `None` otherwise """ tz_sep = cls.TIMEZONE_SEPARATOR.match(timestr) if ...
[ "def", "fix_timezone_separator", "(", "cls", ",", "timestr", ")", ":", "tz_sep", "=", "cls", ".", "TIMEZONE_SEPARATOR", ".", "match", "(", "timestr", ")", "if", "tz_sep", "is", "not", "None", ":", "return", "tz_sep", ".", "group", "(", "1", ")", "+", "...
Replace invalid timezone separator to prevent `dateutil.parser.parse` to raise. :return: the new string if invalid separators were found, `None` otherwise
[ "Replace", "invalid", "timezone", "separator", "to", "prevent", "dateutil", ".", "parser", ".", "parse", "to", "raise", "." ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L104-L114
cogniteev/docido-python-sdk
docido_sdk/toolbox/date_ext.py
timestamp_ms.from_str
def from_str(cls, timestr, shaked=False): """Use `dateutil` module to parse the give string :param basestring timestr: string representing a date to parse :param bool shaked: whether the input parameter been already cleaned or not. """ orig = timestr if not shake...
python
def from_str(cls, timestr, shaked=False): """Use `dateutil` module to parse the give string :param basestring timestr: string representing a date to parse :param bool shaked: whether the input parameter been already cleaned or not. """ orig = timestr if not shake...
[ "def", "from_str", "(", "cls", ",", "timestr", ",", "shaked", "=", "False", ")", ":", "orig", "=", "timestr", "if", "not", "shaked", ":", "timestr", "=", "cls", ".", "fix_timezone_separator", "(", "timestr", ")", "try", ":", "date", "=", "parser", ".",...
Use `dateutil` module to parse the give string :param basestring timestr: string representing a date to parse :param bool shaked: whether the input parameter been already cleaned or not.
[ "Use", "dateutil", "module", "to", "parse", "the", "give", "string" ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/date_ext.py#L117-L156
tBaxter/tango-comments
build/lib/tango_comments/views/utils.py
next_redirect
def next_redirect(request, fallback, **get_kwargs): """ Handle the "where should I go next?" part of comment views. The next value could be a ``?next=...`` GET arg or the URL of a given view (``fallback``). See the view modules for examples. Returns an ``HttpResponseRedirect``. """ nex...
python
def next_redirect(request, fallback, **get_kwargs): """ Handle the "where should I go next?" part of comment views. The next value could be a ``?next=...`` GET arg or the URL of a given view (``fallback``). See the view modules for examples. Returns an ``HttpResponseRedirect``. """ nex...
[ "def", "next_redirect", "(", "request", ",", "fallback", ",", "*", "*", "get_kwargs", ")", ":", "next", "=", "request", ".", "POST", ".", "get", "(", "'next'", ")", "if", "not", "is_safe_url", "(", "url", "=", "next", ",", "allowed_hosts", "=", "reques...
Handle the "where should I go next?" part of comment views. The next value could be a ``?next=...`` GET arg or the URL of a given view (``fallback``). See the view modules for examples. Returns an ``HttpResponseRedirect``.
[ "Handle", "the", "where", "should", "I", "go", "next?", "part", "of", "comment", "views", "." ]
train
https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/views/utils.py#L15-L39
tBaxter/tango-comments
build/lib/tango_comments/views/utils.py
confirmation_view
def confirmation_view(template, doc="Display a confirmation view."): """ Confirmation view generator for the "comment was posted/flagged/deleted/approved" views. """ def confirmed(request): comment = None if 'c' in request.GET: try: comment = comments.get_...
python
def confirmation_view(template, doc="Display a confirmation view."): """ Confirmation view generator for the "comment was posted/flagged/deleted/approved" views. """ def confirmed(request): comment = None if 'c' in request.GET: try: comment = comments.get_...
[ "def", "confirmation_view", "(", "template", ",", "doc", "=", "\"Display a confirmation view.\"", ")", ":", "def", "confirmed", "(", "request", ")", ":", "comment", "=", "None", "if", "'c'", "in", "request", ".", "GET", ":", "try", ":", "comment", "=", "co...
Confirmation view generator for the "comment was posted/flagged/deleted/approved" views.
[ "Confirmation", "view", "generator", "for", "the", "comment", "was", "posted", "/", "flagged", "/", "deleted", "/", "approved", "views", "." ]
train
https://github.com/tBaxter/tango-comments/blob/1fd335c6fc9e81bba158e42e1483f1a149622ab4/build/lib/tango_comments/views/utils.py#L41-L64
cbrand/vpnchooser
src/vpnchooser/db/user.py
User.check
def check(self, password: str) -> bool: """ Checks the given password with the one stored in the database """ return ( pbkdf2_sha512.verify(password, self.password) or pbkdf2_sha512.verify(password, pbkdf2_sha512.encrypt(se...
python
def check(self, password: str) -> bool: """ Checks the given password with the one stored in the database """ return ( pbkdf2_sha512.verify(password, self.password) or pbkdf2_sha512.verify(password, pbkdf2_sha512.encrypt(se...
[ "def", "check", "(", "self", ",", "password", ":", "str", ")", "->", "bool", ":", "return", "(", "pbkdf2_sha512", ".", "verify", "(", "password", ",", "self", ".", "password", ")", "or", "pbkdf2_sha512", ".", "verify", "(", "password", ",", "pbkdf2_sha51...
Checks the given password with the one stored in the database
[ "Checks", "the", "given", "password", "with", "the", "one", "stored", "in", "the", "database" ]
train
https://github.com/cbrand/vpnchooser/blob/d153e3d05555c23cf5e8e15e507eecad86465923/src/vpnchooser/db/user.py#L31-L40
f213/rumetr-client
rumetr/roometr.py
Rumetr.complex_exists
def complex_exists(self, complex: str) -> bool: """ Shortcut to check if complex exists in our database. """ try: self.check_complex(complex) except exceptions.RumetrComplexNotFound: return False return True
python
def complex_exists(self, complex: str) -> bool: """ Shortcut to check if complex exists in our database. """ try: self.check_complex(complex) except exceptions.RumetrComplexNotFound: return False return True
[ "def", "complex_exists", "(", "self", ",", "complex", ":", "str", ")", "->", "bool", ":", "try", ":", "self", ".", "check_complex", "(", "complex", ")", "except", "exceptions", ".", "RumetrComplexNotFound", ":", "return", "False", "return", "True" ]
Shortcut to check if complex exists in our database.
[ "Shortcut", "to", "check", "if", "complex", "exists", "in", "our", "database", "." ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L39-L48
f213/rumetr-client
rumetr/roometr.py
Rumetr.house_exists
def house_exists(self, complex: str, house: str) -> bool: """ Shortcut to check if house exists in our database. """ try: self.check_house(complex, house) except exceptions.RumetrHouseNotFound: return False return True
python
def house_exists(self, complex: str, house: str) -> bool: """ Shortcut to check if house exists in our database. """ try: self.check_house(complex, house) except exceptions.RumetrHouseNotFound: return False return True
[ "def", "house_exists", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ")", "->", "bool", ":", "try", ":", "self", ".", "check_house", "(", "complex", ",", "house", ")", "except", "exceptions", ".", "RumetrHouseNotFound", ":", "return"...
Shortcut to check if house exists in our database.
[ "Shortcut", "to", "check", "if", "house", "exists", "in", "our", "database", "." ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L50-L59
f213/rumetr-client
rumetr/roometr.py
Rumetr.appt_exists
def appt_exists(self, complex: str, house: str, appt: str) -> bool: """ Shortcut to check if appt exists in our database. """ try: self.check_appt(complex, house, appt) except exceptions.RumetrApptNotFound: return False return True
python
def appt_exists(self, complex: str, house: str, appt: str) -> bool: """ Shortcut to check if appt exists in our database. """ try: self.check_appt(complex, house, appt) except exceptions.RumetrApptNotFound: return False return True
[ "def", "appt_exists", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ",", "appt", ":", "str", ")", "->", "bool", ":", "try", ":", "self", ".", "check_appt", "(", "complex", ",", "house", ",", "appt", ")", "except", "exceptions", ...
Shortcut to check if appt exists in our database.
[ "Shortcut", "to", "check", "if", "appt", "exists", "in", "our", "database", "." ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L61-L70
f213/rumetr-client
rumetr/roometr.py
Rumetr.post
def post(self, url: str, data: str, expected_status_code=201): """ Do a POST request """ r = requests.post(self._format_url(url), json=data, headers=self.headers, timeout=TIMEOUT) self._check_response(r, expected_status_code) return r.json()
python
def post(self, url: str, data: str, expected_status_code=201): """ Do a POST request """ r = requests.post(self._format_url(url), json=data, headers=self.headers, timeout=TIMEOUT) self._check_response(r, expected_status_code) return r.json()
[ "def", "post", "(", "self", ",", "url", ":", "str", ",", "data", ":", "str", ",", "expected_status_code", "=", "201", ")", ":", "r", "=", "requests", ".", "post", "(", "self", ".", "_format_url", "(", "url", ")", ",", "json", "=", "data", ",", "h...
Do a POST request
[ "Do", "a", "POST", "request" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L95-L102
f213/rumetr-client
rumetr/roometr.py
Rumetr.get
def get(self, url): """ Do a GET request """ r = requests.get(self._format_url(url), headers=self.headers, timeout=TIMEOUT) self._check_response(r, 200) return r.json()
python
def get(self, url): """ Do a GET request """ r = requests.get(self._format_url(url), headers=self.headers, timeout=TIMEOUT) self._check_response(r, 200) return r.json()
[ "def", "get", "(", "self", ",", "url", ")", ":", "r", "=", "requests", ".", "get", "(", "self", ".", "_format_url", "(", "url", ")", ",", "headers", "=", "self", ".", "headers", ",", "timeout", "=", "TIMEOUT", ")", "self", ".", "_check_response", "...
Do a GET request
[ "Do", "a", "GET", "request" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L113-L120
f213/rumetr-client
rumetr/roometr.py
Rumetr.check_developer
def check_developer(self) -> bool: """ Check if a given developer exists in the rumetr database """ if self._last_checked_developer == self.developer: return True try: self.get('developers/%s/' % self.developer) except exceptions.Rumetr404Exceptio...
python
def check_developer(self) -> bool: """ Check if a given developer exists in the rumetr database """ if self._last_checked_developer == self.developer: return True try: self.get('developers/%s/' % self.developer) except exceptions.Rumetr404Exceptio...
[ "def", "check_developer", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_last_checked_developer", "==", "self", ".", "developer", ":", "return", "True", "try", ":", "self", ".", "get", "(", "'developers/%s/'", "%", "self", ".", "developer", ")",...
Check if a given developer exists in the rumetr database
[ "Check", "if", "a", "given", "developer", "exists", "in", "the", "rumetr", "database" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L137-L150
f213/rumetr-client
rumetr/roometr.py
Rumetr.check_complex
def check_complex(self, complex: str) -> bool: """ Check if a given complex exists in the rumetr database """ self.check_developer() if complex in self._checked_complexes: return True try: self.get('developers/{developer}/complexes/{complex}/'.for...
python
def check_complex(self, complex: str) -> bool: """ Check if a given complex exists in the rumetr database """ self.check_developer() if complex in self._checked_complexes: return True try: self.get('developers/{developer}/complexes/{complex}/'.for...
[ "def", "check_complex", "(", "self", ",", "complex", ":", "str", ")", "->", "bool", ":", "self", ".", "check_developer", "(", ")", "if", "complex", "in", "self", ".", "_checked_complexes", ":", "return", "True", "try", ":", "self", ".", "get", "(", "'d...
Check if a given complex exists in the rumetr database
[ "Check", "if", "a", "given", "complex", "exists", "in", "the", "rumetr", "database" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L152-L169
f213/rumetr-client
rumetr/roometr.py
Rumetr.check_house
def check_house(self, complex: str, house: str) -> bool: """ Check if given house exists in the rumetr database """ self.check_complex(complex) if '%s__%s' % (complex, house) in self._checked_houses: return True try: self.get('developers/{develope...
python
def check_house(self, complex: str, house: str) -> bool: """ Check if given house exists in the rumetr database """ self.check_complex(complex) if '%s__%s' % (complex, house) in self._checked_houses: return True try: self.get('developers/{develope...
[ "def", "check_house", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ")", "->", "bool", ":", "self", ".", "check_complex", "(", "complex", ")", "if", "'%s__%s'", "%", "(", "complex", ",", "house", ")", "in", "self", ".", "_checked...
Check if given house exists in the rumetr database
[ "Check", "if", "given", "house", "exists", "in", "the", "rumetr", "database" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L171-L189
f213/rumetr-client
rumetr/roometr.py
Rumetr.check_appt
def check_appt(self, complex: str, house: str, appt: str) -> bool: """ Check if given appartment exists in the rumetr database """ self.check_house(complex, house) if '%s__%s__%s' % (complex, house, appt) in self._checked_appts: return True try: s...
python
def check_appt(self, complex: str, house: str, appt: str) -> bool: """ Check if given appartment exists in the rumetr database """ self.check_house(complex, house) if '%s__%s__%s' % (complex, house, appt) in self._checked_appts: return True try: s...
[ "def", "check_appt", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ",", "appt", ":", "str", ")", "->", "bool", ":", "self", ".", "check_house", "(", "complex", ",", "house", ")", "if", "'%s__%s__%s'", "%", "(", "complex", ",", ...
Check if given appartment exists in the rumetr database
[ "Check", "if", "given", "appartment", "exists", "in", "the", "rumetr", "database" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L191-L210
f213/rumetr-client
rumetr/roometr.py
Rumetr.add_complex
def add_complex(self, **kwargs): """ Add a new complex to the rumetr db """ self.check_developer() self.post('developers/%s/complexes/' % self.developer, data=kwargs)
python
def add_complex(self, **kwargs): """ Add a new complex to the rumetr db """ self.check_developer() self.post('developers/%s/complexes/' % self.developer, data=kwargs)
[ "def", "add_complex", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_developer", "(", ")", "self", ".", "post", "(", "'developers/%s/complexes/'", "%", "self", ".", "developer", ",", "data", "=", "kwargs", ")" ]
Add a new complex to the rumetr db
[ "Add", "a", "new", "complex", "to", "the", "rumetr", "db" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L212-L217
f213/rumetr-client
rumetr/roometr.py
Rumetr.add_house
def add_house(self, complex: str, **kwargs): """ Add a new house to the rumetr db """ self.check_complex(complex) self.post('developers/{developer}/complexes/{complex}/houses/'.format(developer=self.developer, complex=complex), data=kwargs)
python
def add_house(self, complex: str, **kwargs): """ Add a new house to the rumetr db """ self.check_complex(complex) self.post('developers/{developer}/complexes/{complex}/houses/'.format(developer=self.developer, complex=complex), data=kwargs)
[ "def", "add_house", "(", "self", ",", "complex", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_complex", "(", "complex", ")", "self", ".", "post", "(", "'developers/{developer}/complexes/{complex}/houses/'", ".", "format", "(", "developer"...
Add a new house to the rumetr db
[ "Add", "a", "new", "house", "to", "the", "rumetr", "db" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L219-L224
f213/rumetr-client
rumetr/roometr.py
Rumetr.add_appt
def add_appt(self, complex: str, house: str, price: str, square: str, **kwargs): """ Add a new appartment to the rumetr db """ self.check_house(complex, house) kwargs['price'] = self._format_decimal(price) kwargs['square'] = self._format_decimal(square) self.pos...
python
def add_appt(self, complex: str, house: str, price: str, square: str, **kwargs): """ Add a new appartment to the rumetr db """ self.check_house(complex, house) kwargs['price'] = self._format_decimal(price) kwargs['square'] = self._format_decimal(square) self.pos...
[ "def", "add_appt", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ",", "price", ":", "str", ",", "square", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_house", "(", "complex", ",", "house", ")", "kwargs", ...
Add a new appartment to the rumetr db
[ "Add", "a", "new", "appartment", "to", "the", "rumetr", "db" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L226-L239
f213/rumetr-client
rumetr/roometr.py
Rumetr.update_house
def update_house(self, complex: str, id: str, **kwargs): """ Update the existing house """ self.check_house(complex, id) self.put('developers/{developer}/complexes/{complex}/houses/{id}'.format( developer=self.developer, complex=complex, id=id,...
python
def update_house(self, complex: str, id: str, **kwargs): """ Update the existing house """ self.check_house(complex, id) self.put('developers/{developer}/complexes/{complex}/houses/{id}'.format( developer=self.developer, complex=complex, id=id,...
[ "def", "update_house", "(", "self", ",", "complex", ":", "str", ",", "id", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_house", "(", "complex", ",", "id", ")", "self", ".", "put", "(", "'developers/{developer}/complexes/{complex}/hous...
Update the existing house
[ "Update", "the", "existing", "house" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L241-L250
f213/rumetr-client
rumetr/roometr.py
Rumetr.update_appt
def update_appt(self, complex: str, house: str, price: str, square: str, id: str, **kwargs): """ Update existing appartment """ self.check_house(complex, house) kwargs['price'] = self._format_decimal(price) kwargs['square'] = self._format_decimal(square) self.pu...
python
def update_appt(self, complex: str, house: str, price: str, square: str, id: str, **kwargs): """ Update existing appartment """ self.check_house(complex, house) kwargs['price'] = self._format_decimal(price) kwargs['square'] = self._format_decimal(square) self.pu...
[ "def", "update_appt", "(", "self", ",", "complex", ":", "str", ",", "house", ":", "str", ",", "price", ":", "str", ",", "square", ":", "str", ",", "id", ":", "str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "check_house", "(", "complex", ",...
Update existing appartment
[ "Update", "existing", "appartment" ]
train
https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/roometr.py#L252-L267
dhain/potpy
potpy/context.py
Context.inject
def inject(self, func, **kwargs): """Inject arguments from context into a callable. :param func: The callable to inject arguments into. :param \*\*kwargs: Specify values to override context items. """ args, varargs, keywords, defaults = self._get_argspec(func) if default...
python
def inject(self, func, **kwargs): """Inject arguments from context into a callable. :param func: The callable to inject arguments into. :param \*\*kwargs: Specify values to override context items. """ args, varargs, keywords, defaults = self._get_argspec(func) if default...
[ "def", "inject", "(", "self", ",", "func", ",", "*", "*", "kwargs", ")", ":", "args", ",", "varargs", ",", "keywords", ",", "defaults", "=", "self", ".", "_get_argspec", "(", "func", ")", "if", "defaults", ":", "required_args", "=", "args", "[", ":",...
Inject arguments from context into a callable. :param func: The callable to inject arguments into. :param \*\*kwargs: Specify values to override context items.
[ "Inject", "arguments", "from", "context", "into", "a", "callable", "." ]
train
https://github.com/dhain/potpy/blob/e39a5a84f763fbf144b07a620afb02a5ff3741c9/potpy/context.py#L88-L110
hoersuppe/hoerapi.py
hoerapi/util.py
parse_date
def parse_date(val, zone='default'): val = parse_isodate(val, None) ''' date has no ISO zone information ''' if not val.tzinfo: val = timezone[zone].localize(val) return val
python
def parse_date(val, zone='default'): val = parse_isodate(val, None) ''' date has no ISO zone information ''' if not val.tzinfo: val = timezone[zone].localize(val) return val
[ "def", "parse_date", "(", "val", ",", "zone", "=", "'default'", ")", ":", "val", "=", "parse_isodate", "(", "val", ",", "None", ")", "if", "not", "val", ".", "tzinfo", ":", "val", "=", "timezone", "[", "zone", "]", ".", "localize", "(", "val", ")",...
date has no ISO zone information
[ "date", "has", "no", "ISO", "zone", "information" ]
train
https://github.com/hoersuppe/hoerapi.py/blob/50d6da5c2108e9960391a2bccb06f1d60af6b9e7/hoerapi/util.py#L11-L16
KelSolaar/Oncilla
oncilla/build_api.py
import_sanitizer
def import_sanitizer(sanitizer): """ Imports the sanitizer python module. :param sanitizer: Sanitizer python module file. :type sanitizer: unicode :return: Module. :rtype: object """ directory = os.path.dirname(sanitizer) not directory in sys.path and sys.path.append(directory) ...
python
def import_sanitizer(sanitizer): """ Imports the sanitizer python module. :param sanitizer: Sanitizer python module file. :type sanitizer: unicode :return: Module. :rtype: object """ directory = os.path.dirname(sanitizer) not directory in sys.path and sys.path.append(directory) ...
[ "def", "import_sanitizer", "(", "sanitizer", ")", ":", "directory", "=", "os", ".", "path", ".", "dirname", "(", "sanitizer", ")", "not", "directory", "in", "sys", ".", "path", "and", "sys", ".", "path", ".", "append", "(", "directory", ")", "namespace",...
Imports the sanitizer python module. :param sanitizer: Sanitizer python module file. :type sanitizer: unicode :return: Module. :rtype: object
[ "Imports", "the", "sanitizer", "python", "module", "." ]
train
https://github.com/KelSolaar/Oncilla/blob/2b4db3704cf2c22a09a207681cb041fff555a994/oncilla/build_api.py#L78-L96
KelSolaar/Oncilla
oncilla/build_api.py
build_api
def build_api(packages, input, output, sanitizer, excluded_modules=None): """ Builds the Sphinx documentation API. :param packages: Packages to include in the API. :type packages: list :param input: Input modules directory. :type input: unicode :param output: Output reStructuredText files d...
python
def build_api(packages, input, output, sanitizer, excluded_modules=None): """ Builds the Sphinx documentation API. :param packages: Packages to include in the API. :type packages: list :param input: Input modules directory. :type input: unicode :param output: Output reStructuredText files d...
[ "def", "build_api", "(", "packages", ",", "input", ",", "output", ",", "sanitizer", ",", "excluded_modules", "=", "None", ")", ":", "LOGGER", ".", "info", "(", "\"{0} | Building Sphinx documentation API!\"", ".", "format", "(", "build_api", ".", "__name__", ")",...
Builds the Sphinx documentation API. :param packages: Packages to include in the API. :type packages: list :param input: Input modules directory. :type input: unicode :param output: Output reStructuredText files directory. :type output: unicode :param sanitizer: Sanitizer python module. ...
[ "Builds", "the", "Sphinx", "documentation", "API", "." ]
train
https://github.com/KelSolaar/Oncilla/blob/2b4db3704cf2c22a09a207681cb041fff555a994/oncilla/build_api.py#L99-L218
KelSolaar/Oncilla
oncilla/build_api.py
main
def main(): """ Starts the Application. :return: Definition success. :rtype: bool """ args = get_command_line_arguments() args.sanitizer = args.sanitizer if foundations.common.path_exists(args.sanitizer) else SANITIZER args.excluded_modules = args.excluded_modules if all(args.excluded_...
python
def main(): """ Starts the Application. :return: Definition success. :rtype: bool """ args = get_command_line_arguments() args.sanitizer = args.sanitizer if foundations.common.path_exists(args.sanitizer) else SANITIZER args.excluded_modules = args.excluded_modules if all(args.excluded_...
[ "def", "main", "(", ")", ":", "args", "=", "get_command_line_arguments", "(", ")", "args", ".", "sanitizer", "=", "args", ".", "sanitizer", "if", "foundations", ".", "common", ".", "path_exists", "(", "args", ".", "sanitizer", ")", "else", "SANITIZER", "ar...
Starts the Application. :return: Definition success. :rtype: bool
[ "Starts", "the", "Application", "." ]
train
https://github.com/KelSolaar/Oncilla/blob/2b4db3704cf2c22a09a207681cb041fff555a994/oncilla/build_api.py#L274-L289
gersolar/linketurbidity
linketurbidity/instrument.py
pixels_from_coordinates
def pixels_from_coordinates(lat, lon, max_y, max_x): """ Return the 2 matrix with lat and lon of each pixel. Keyword arguments: lat -- A latitude matrix lon -- A longitude matrix max_y -- The max vertical pixels amount of an orthorectified image. max_x -- The max horizontal pixels amount of...
python
def pixels_from_coordinates(lat, lon, max_y, max_x): """ Return the 2 matrix with lat and lon of each pixel. Keyword arguments: lat -- A latitude matrix lon -- A longitude matrix max_y -- The max vertical pixels amount of an orthorectified image. max_x -- The max horizontal pixels amount of...
[ "def", "pixels_from_coordinates", "(", "lat", ",", "lon", ",", "max_y", ",", "max_x", ")", ":", "# The degrees by pixel of the orthorectified image.", "x_ratio", ",", "y_ratio", "=", "max_x", "/", "360.", ",", "max_y", "/", "180.", "x", ",", "y", "=", "np", ...
Return the 2 matrix with lat and lon of each pixel. Keyword arguments: lat -- A latitude matrix lon -- A longitude matrix max_y -- The max vertical pixels amount of an orthorectified image. max_x -- The max horizontal pixels amount of an orthorectified image.
[ "Return", "the", "2", "matrix", "with", "lat", "and", "lon", "of", "each", "pixel", "." ]
train
https://github.com/gersolar/linketurbidity/blob/0ba58fd623bf719d06d1a394d74f706f16d37295/linketurbidity/instrument.py#L9-L24
gersolar/linketurbidity
linketurbidity/instrument.py
obtain
def obtain(date, compressed=True): """ Return an integer matrix with the Linke turbidity multiplied by 20. So it should be divided by 20 in before the usage (over the CPU or the GPU). Keyword arguments: date -- the datetime of the file. compressed -- the true value if it should return a matrix ...
python
def obtain(date, compressed=True): """ Return an integer matrix with the Linke turbidity multiplied by 20. So it should be divided by 20 in before the usage (over the CPU or the GPU). Keyword arguments: date -- the datetime of the file. compressed -- the true value if it should return a matrix ...
[ "def", "obtain", "(", "date", ",", "compressed", "=", "True", ")", ":", "pattern", "=", "\"%s/tifs/%s_longlat_wgs84.tif\"", "ds", "=", "gdal", ".", "Open", "(", "pattern", "%", "(", "localpath", ",", "str", "(", "date", ".", "month", ")", ".", "zfill", ...
Return an integer matrix with the Linke turbidity multiplied by 20. So it should be divided by 20 in before the usage (over the CPU or the GPU). Keyword arguments: date -- the datetime of the file. compressed -- the true value if it should return a matrix of integers or if it should return an uncom...
[ "Return", "an", "integer", "matrix", "with", "the", "Linke", "turbidity", "multiplied", "by", "20", ".", "So", "it", "should", "be", "divided", "by", "20", "in", "before", "the", "usage", "(", "over", "the", "CPU", "or", "the", "GPU", ")", "." ]
train
https://github.com/gersolar/linketurbidity/blob/0ba58fd623bf719d06d1a394d74f706f16d37295/linketurbidity/instrument.py#L42-L55
gersolar/linketurbidity
linketurbidity/instrument.py
obtain_to
def obtain_to(filename, compressed=True): """ Return the linke turbidity projected to the lat lon matrix coordenates. Keyword arguments: filename -- the name of a netcdf file. """ files = glob.glob(filename) root, _ = nc.open(filename) lat, lon = nc.getvar(root, 'lat')[0,:], nc.getvar(r...
python
def obtain_to(filename, compressed=True): """ Return the linke turbidity projected to the lat lon matrix coordenates. Keyword arguments: filename -- the name of a netcdf file. """ files = glob.glob(filename) root, _ = nc.open(filename) lat, lon = nc.getvar(root, 'lat')[0,:], nc.getvar(r...
[ "def", "obtain_to", "(", "filename", ",", "compressed", "=", "True", ")", ":", "files", "=", "glob", ".", "glob", "(", "filename", ")", "root", ",", "_", "=", "nc", ".", "open", "(", "filename", ")", "lat", ",", "lon", "=", "nc", ".", "getvar", "...
Return the linke turbidity projected to the lat lon matrix coordenates. Keyword arguments: filename -- the name of a netcdf file.
[ "Return", "the", "linke", "turbidity", "projected", "to", "the", "lat", "lon", "matrix", "coordenates", "." ]
train
https://github.com/gersolar/linketurbidity/blob/0ba58fd623bf719d06d1a394d74f706f16d37295/linketurbidity/instrument.py#L58-L73
gersolar/linketurbidity
linketurbidity/instrument.py
persist
def persist(filename): """ Append the linke turbidity projected (using lat lon) as variables of the netcdf file. Keyword arguments: filename -- the name of a netcdf file. """ linkes_projected = obtain_to(filename, compressed=False) keys = sorted(linkes_projected.keys()) values = np....
python
def persist(filename): """ Append the linke turbidity projected (using lat lon) as variables of the netcdf file. Keyword arguments: filename -- the name of a netcdf file. """ linkes_projected = obtain_to(filename, compressed=False) keys = sorted(linkes_projected.keys()) values = np....
[ "def", "persist", "(", "filename", ")", ":", "linkes_projected", "=", "obtain_to", "(", "filename", ",", "compressed", "=", "False", ")", "keys", "=", "sorted", "(", "linkes_projected", ".", "keys", "(", ")", ")", "values", "=", "np", ".", "vstack", "(",...
Append the linke turbidity projected (using lat lon) as variables of the netcdf file. Keyword arguments: filename -- the name of a netcdf file.
[ "Append", "the", "linke", "turbidity", "projected", "(", "using", "lat", "lon", ")", "as", "variables", "of", "the", "netcdf", "file", "." ]
train
https://github.com/gersolar/linketurbidity/blob/0ba58fd623bf719d06d1a394d74f706f16d37295/linketurbidity/instrument.py#L76-L90
ramrod-project/database-brain
schema/brain/queries/reads.py
_jobs_cursor
def _jobs_cursor(plugin_name, location=None, port=None, custom=None): """ generates a reql cursor for plugin_name with status ready and prepares to sort by StartTime :param plugin_name: :param location: :param port: :return: """ cur = RBJ.get_all(READY, index=STATUS_FIELD) cu...
python
def _jobs_cursor(plugin_name, location=None, port=None, custom=None): """ generates a reql cursor for plugin_name with status ready and prepares to sort by StartTime :param plugin_name: :param location: :param port: :return: """ cur = RBJ.get_all(READY, index=STATUS_FIELD) cu...
[ "def", "_jobs_cursor", "(", "plugin_name", ",", "location", "=", "None", ",", "port", "=", "None", ",", "custom", "=", "None", ")", ":", "cur", "=", "RBJ", ".", "get_all", "(", "READY", ",", "index", "=", "STATUS_FIELD", ")", "cur_filter", "=", "(", ...
generates a reql cursor for plugin_name with status ready and prepares to sort by StartTime :param plugin_name: :param location: :param port: :return:
[ "generates", "a", "reql", "cursor", "for", "plugin_name", "with", "status", "ready", "and", "prepares", "to", "sort", "by", "StartTime", ":", "param", "plugin_name", ":", ":", "param", "location", ":", ":", "param", "port", ":", ":", "return", ":" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L21-L44
ramrod-project/database-brain
schema/brain/queries/reads.py
get_targets
def get_targets(conn=None): """ get_brain_targets function from Brain.Targets table. :return: <generator> yields dict objects """ targets = RBT results = targets.run(conn) for item in results: yield item
python
def get_targets(conn=None): """ get_brain_targets function from Brain.Targets table. :return: <generator> yields dict objects """ targets = RBT results = targets.run(conn) for item in results: yield item
[ "def", "get_targets", "(", "conn", "=", "None", ")", ":", "targets", "=", "RBT", "results", "=", "targets", ".", "run", "(", "conn", ")", "for", "item", "in", "results", ":", "yield", "item" ]
get_brain_targets function from Brain.Targets table. :return: <generator> yields dict objects
[ "get_brain_targets", "function", "from", "Brain", ".", "Targets", "table", "." ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L49-L58
ramrod-project/database-brain
schema/brain/queries/reads.py
get_targets_by_plugin
def get_targets_by_plugin(plugin_name, conn=None): """ get_targets_by_plugin function from Brain.Targets table :return: <generator> yields dict objects """ targets = RBT results = targets.filter({PLUGIN_NAME_KEY: plugin_name}).run(conn) for item in results: yield item
python
def get_targets_by_plugin(plugin_name, conn=None): """ get_targets_by_plugin function from Brain.Targets table :return: <generator> yields dict objects """ targets = RBT results = targets.filter({PLUGIN_NAME_KEY: plugin_name}).run(conn) for item in results: yield item
[ "def", "get_targets_by_plugin", "(", "plugin_name", ",", "conn", "=", "None", ")", ":", "targets", "=", "RBT", "results", "=", "targets", ".", "filter", "(", "{", "PLUGIN_NAME_KEY", ":", "plugin_name", "}", ")", ".", "run", "(", "conn", ")", "for", "item...
get_targets_by_plugin function from Brain.Targets table :return: <generator> yields dict objects
[ "get_targets_by_plugin", "function", "from", "Brain", ".", "Targets", "table" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L63-L72
ramrod-project/database-brain
schema/brain/queries/reads.py
get_plugin_commands
def get_plugin_commands(plugin_name, conn=None): """ get_specific_commands function queries Plugins.<PluginName> table the plugin name will be based off the user selection from the ui. It will return the query onto w2 as a dictionary nested in a list. :param plugin_name: <str> user's plugin selecti...
python
def get_plugin_commands(plugin_name, conn=None): """ get_specific_commands function queries Plugins.<PluginName> table the plugin name will be based off the user selection from the ui. It will return the query onto w2 as a dictionary nested in a list. :param plugin_name: <str> user's plugin selecti...
[ "def", "get_plugin_commands", "(", "plugin_name", ",", "conn", "=", "None", ")", ":", "results", "=", "RPX", ".", "table", "(", "plugin_name", ")", ".", "order_by", "(", "COMMAND_NAME_KEY", ")", ".", "run", "(", "conn", ")", "for", "item", "in", "results...
get_specific_commands function queries Plugins.<PluginName> table the plugin name will be based off the user selection from the ui. It will return the query onto w2 as a dictionary nested in a list. :param plugin_name: <str> user's plugin selection :return: <generator> yields dictionaries
[ "get_specific_commands", "function", "queries", "Plugins", ".", "<PluginName", ">", "table", "the", "plugin", "name", "will", "be", "based", "off", "the", "user", "selection", "from", "the", "ui", ".", "It", "will", "return", "the", "query", "onto", "w2", "a...
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L77-L88
ramrod-project/database-brain
schema/brain/queries/reads.py
get_plugin_command
def get_plugin_command(plugin_name, command_name, conn=None): """ get_specific_command function queries a specific CommandName :param plugin_name: <str> PluginName :param command_name: <str> CommandName :return: <dict> """ commands = RPX.table(plugin_name).filter( {COMMAND_NAME_KEY:...
python
def get_plugin_command(plugin_name, command_name, conn=None): """ get_specific_command function queries a specific CommandName :param plugin_name: <str> PluginName :param command_name: <str> CommandName :return: <dict> """ commands = RPX.table(plugin_name).filter( {COMMAND_NAME_KEY:...
[ "def", "get_plugin_command", "(", "plugin_name", ",", "command_name", ",", "conn", "=", "None", ")", ":", "commands", "=", "RPX", ".", "table", "(", "plugin_name", ")", ".", "filter", "(", "{", "COMMAND_NAME_KEY", ":", "command_name", "}", ")", ".", "run",...
get_specific_command function queries a specific CommandName :param plugin_name: <str> PluginName :param command_name: <str> CommandName :return: <dict>
[ "get_specific_command", "function", "queries", "a", "specific", "CommandName" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L93-L106
ramrod-project/database-brain
schema/brain/queries/reads.py
is_job_done
def is_job_done(job_id, conn=None): """ is_job_done function checks to if Brain.Jobs Status is 'Done' :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if """ result = False get_done = RBJ.get_all(DONE, index=STATUS_...
python
def is_job_done(job_id, conn=None): """ is_job_done function checks to if Brain.Jobs Status is 'Done' :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if """ result = False get_done = RBJ.get_all(DONE, index=STATUS_...
[ "def", "is_job_done", "(", "job_id", ",", "conn", "=", "None", ")", ":", "result", "=", "False", "get_done", "=", "RBJ", ".", "get_all", "(", "DONE", ",", "index", "=", "STATUS_FIELD", ")", "for", "item", "in", "get_done", ".", "filter", "(", "{", "I...
is_job_done function checks to if Brain.Jobs Status is 'Done' :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if
[ "is_job_done", "function", "checks", "to", "if", "Brain", ".", "Jobs", "Status", "is", "Done" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L125-L137
ramrod-project/database-brain
schema/brain/queries/reads.py
is_job_complete
def is_job_complete(job_id, conn=None): """ is_job_done function checks to if Brain.Jobs Status is Completed Completed is defined in statics as Done|Stopped|Error :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if """...
python
def is_job_complete(job_id, conn=None): """ is_job_done function checks to if Brain.Jobs Status is Completed Completed is defined in statics as Done|Stopped|Error :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if """...
[ "def", "is_job_complete", "(", "job_id", ",", "conn", "=", "None", ")", ":", "result", "=", "False", "job", "=", "RBJ", ".", "get", "(", "job_id", ")", ".", "run", "(", "conn", ")", "if", "job", "and", "job", ".", "get", "(", "STATUS_FIELD", ")", ...
is_job_done function checks to if Brain.Jobs Status is Completed Completed is defined in statics as Done|Stopped|Error :param job_id: <str> id for the job :param conn: (optional)<connection> to run on :return: <dict> if job is done <false> if
[ "is_job_done", "function", "checks", "to", "if", "Brain", ".", "Jobs", "Status", "is", "Completed" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L142-L156
ramrod-project/database-brain
schema/brain/queries/reads.py
get_output_content
def get_output_content(job_id, max_size=1024, conn=None): """ returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes> ...
python
def get_output_content(job_id, max_size=1024, conn=None): """ returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes> ...
[ "def", "get_output_content", "(", "job_id", ",", "max_size", "=", "1024", ",", "conn", "=", "None", ")", ":", "content", "=", "None", "if", "RBO", ".", "index_list", "(", ")", ".", "contains", "(", "IDX_OUTPUT_JOB_ID", ")", ".", "run", "(", "conn", ")"...
returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes>
[ "returns", "the", "content", "buffer", "for", "a", "job_id", "if", "that", "job", "output", "exists" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L161-L179
ramrod-project/database-brain
schema/brain/queries/reads.py
get_jobs
def get_jobs(plugin_name, verify_job=True, conn=None): """ :param plugin_name: <str> :param verify_job: <bool> :param conn: <connection> or <NoneType> :return: <generator> yields <dict> """ job_cur = _jobs_cursor(plugin_name).run(conn) for job in job_cur: if verify_j...
python
def get_jobs(plugin_name, verify_job=True, conn=None): """ :param plugin_name: <str> :param verify_job: <bool> :param conn: <connection> or <NoneType> :return: <generator> yields <dict> """ job_cur = _jobs_cursor(plugin_name).run(conn) for job in job_cur: if verify_j...
[ "def", "get_jobs", "(", "plugin_name", ",", "verify_job", "=", "True", ",", "conn", "=", "None", ")", ":", "job_cur", "=", "_jobs_cursor", "(", "plugin_name", ")", ".", "run", "(", "conn", ")", "for", "job", "in", "job_cur", ":", "if", "verify_job", "a...
:param plugin_name: <str> :param verify_job: <bool> :param conn: <connection> or <NoneType> :return: <generator> yields <dict>
[ ":", "param", "plugin_name", ":", "<str", ">", ":", "param", "verify_job", ":", "<bool", ">", ":", "param", "conn", ":", "<connection", ">", "or", "<NoneType", ">", ":", "return", ":", "<generator", ">", "yields", "<dict", ">" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L219-L231
ramrod-project/database-brain
schema/brain/queries/reads.py
get_next_job_by_location
def get_next_job_by_location(plugin_name, loc, verify_job=True, conn=None): """ Deprecated - Use get_next_job """ return get_next_job(plugin_name, loc, verify_job=verify_job, conn=conn)
python
def get_next_job_by_location(plugin_name, loc, verify_job=True, conn=None): """ Deprecated - Use get_next_job """ return get_next_job(plugin_name, loc, verify_job=verify_job, conn=conn)
[ "def", "get_next_job_by_location", "(", "plugin_name", ",", "loc", ",", "verify_job", "=", "True", ",", "conn", "=", "None", ")", ":", "return", "get_next_job", "(", "plugin_name", ",", "loc", ",", "verify_job", "=", "verify_job", ",", "conn", "=", "conn", ...
Deprecated - Use get_next_job
[ "Deprecated", "-", "Use", "get_next_job" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L258-L262
ramrod-project/database-brain
schema/brain/queries/reads.py
get_next_job_by_port
def get_next_job_by_port(plugin_name, port, verify_job=True, conn=None): """ Deprecated - Use get_next_job """ return get_next_job(plugin_name, None, port, verify_job, conn)
python
def get_next_job_by_port(plugin_name, port, verify_job=True, conn=None): """ Deprecated - Use get_next_job """ return get_next_job(plugin_name, None, port, verify_job, conn)
[ "def", "get_next_job_by_port", "(", "plugin_name", ",", "port", ",", "verify_job", "=", "True", ",", "conn", "=", "None", ")", ":", "return", "get_next_job", "(", "plugin_name", ",", "None", ",", "port", ",", "verify_job", ",", "conn", ")" ]
Deprecated - Use get_next_job
[ "Deprecated", "-", "Use", "get_next_job" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L267-L271
ramrod-project/database-brain
schema/brain/queries/reads.py
get_job_by_id
def get_job_by_id(job_id, conn=None): """returns the job with the given id :param job_id: <str> id of the job :param conn: <rethinkdb.DefaultConnection> :return: <dict> job with the given id """ job = RBJ.get(job_id).run(conn) return job
python
def get_job_by_id(job_id, conn=None): """returns the job with the given id :param job_id: <str> id of the job :param conn: <rethinkdb.DefaultConnection> :return: <dict> job with the given id """ job = RBJ.get(job_id).run(conn) return job
[ "def", "get_job_by_id", "(", "job_id", ",", "conn", "=", "None", ")", ":", "job", "=", "RBJ", ".", "get", "(", "job_id", ")", ".", "run", "(", "conn", ")", "return", "job" ]
returns the job with the given id :param job_id: <str> id of the job :param conn: <rethinkdb.DefaultConnection> :return: <dict> job with the given id
[ "returns", "the", "job", "with", "the", "given", "id" ]
train
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/queries/reads.py#L276-L284
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/downloader.py
DownloadManager._setup
def _setup(self): """ Run setup tasks after initialization """ self._populate_local() try: self._populate_latest() except Exception as e: self.log.exception('Unable to retrieve latest %s version information', self.meta_name) self._sort()
python
def _setup(self): """ Run setup tasks after initialization """ self._populate_local() try: self._populate_latest() except Exception as e: self.log.exception('Unable to retrieve latest %s version information', self.meta_name) self._sort()
[ "def", "_setup", "(", "self", ")", ":", "self", ".", "_populate_local", "(", ")", "try", ":", "self", ".", "_populate_latest", "(", ")", "except", "Exception", "as", "e", ":", "self", ".", "log", ".", "exception", "(", "'Unable to retrieve latest %s version ...
Run setup tasks after initialization
[ "Run", "setup", "tasks", "after", "initialization" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/downloader.py#L36-L45
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/downloader.py
DownloadManager._sort
def _sort(self): """ Sort versions by their version number """ self.versions = OrderedDict(sorted(self.versions.items(), key=lambda v: v[0]))
python
def _sort(self): """ Sort versions by their version number """ self.versions = OrderedDict(sorted(self.versions.items(), key=lambda v: v[0]))
[ "def", "_sort", "(", "self", ")", ":", "self", ".", "versions", "=", "OrderedDict", "(", "sorted", "(", "self", ".", "versions", ".", "items", "(", ")", ",", "key", "=", "lambda", "v", ":", "v", "[", "0", "]", ")", ")" ]
Sort versions by their version number
[ "Sort", "versions", "by", "their", "version", "number" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/downloader.py#L47-L51
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/downloader.py
DownloadManager._populate_local
def _populate_local(self): """ Populate version data for local archives """ archives = glob(os.path.join(self.path, '*.zip')) for archive in archives: try: version = self._read_zip(archive) self.versions[version.vtuple] = self.meta_clas...
python
def _populate_local(self): """ Populate version data for local archives """ archives = glob(os.path.join(self.path, '*.zip')) for archive in archives: try: version = self._read_zip(archive) self.versions[version.vtuple] = self.meta_clas...
[ "def", "_populate_local", "(", "self", ")", ":", "archives", "=", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'*.zip'", ")", ")", "for", "archive", "in", "archives", ":", "try", ":", "version", "=", "self", ".", "_r...
Populate version data for local archives
[ "Populate", "version", "data", "for", "local", "archives" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/downloader.py#L53-L79
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/downloader.py
DownloadManager.get
def get(self, version, use_cache=True): """ Get the filepath to the specified version (downloading it in the process if necessary) @type version: IpsMeta @param use_cache: Use cached version downloads if available @type use_cache: bool @rtype: str """ ...
python
def get(self, version, use_cache=True): """ Get the filepath to the specified version (downloading it in the process if necessary) @type version: IpsMeta @param use_cache: Use cached version downloads if available @type use_cache: bool @rtype: str """ ...
[ "def", "get", "(", "self", ",", "version", ",", "use_cache", "=", "True", ")", ":", "self", ".", "log", ".", "info", "(", "'Retrieving %s version %s'", ",", "self", ".", "meta_name", ",", "version", ".", "version", ")", "if", "version", ".", "filepath", ...
Get the filepath to the specified version (downloading it in the process if necessary) @type version: IpsMeta @param use_cache: Use cached version downloads if available @type use_cache: bool @rtype: str
[ "Get", "the", "filepath", "to", "the", "specified", "version", "(", "downloading", "it", "in", "the", "process", "if", "necessary", ")" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/downloader.py#L97-L116
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/downloader.py
DownloadMeta.download
def download(self): """ Download the latest IPS release @return: Download file path @rtype: str """ # Submit a download request and test the response self.log.debug('Submitting request: %s', self.request) response = self.session.request(*self.reques...
python
def download(self): """ Download the latest IPS release @return: Download file path @rtype: str """ # Submit a download request and test the response self.log.debug('Submitting request: %s', self.request) response = self.session.request(*self.reques...
[ "def", "download", "(", "self", ")", ":", "# Submit a download request and test the response", "self", ".", "log", ".", "debug", "(", "'Submitting request: %s'", ",", "self", ".", "request", ")", "response", "=", "self", ".", "session", ".", "request", "(", "*",...
Download the latest IPS release @return: Download file path @rtype: str
[ "Download", "the", "latest", "IPS", "release" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/downloader.py#L147-L179
mrallen1/pygett
pygett/request.py
BaseRequest.get
def get(self, endpoint, *args, **kwargs): """ **get** Make a GET call to a remote endpoint Input: * An endpoint relative to the ``base_url`` Output: * A :py:mod:`pygett.request.GettResponse` object """ endpoint = self.base_url + endpoint...
python
def get(self, endpoint, *args, **kwargs): """ **get** Make a GET call to a remote endpoint Input: * An endpoint relative to the ``base_url`` Output: * A :py:mod:`pygett.request.GettResponse` object """ endpoint = self.base_url + endpoint...
[ "def", "get", "(", "self", ",", "endpoint", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "endpoint", "=", "self", ".", "base_url", "+", "endpoint", "return", "self", ".", "_make_request", "(", "endpoint", ",", "type", "=", "'GET'", ")" ]
**get** Make a GET call to a remote endpoint Input: * An endpoint relative to the ``base_url`` Output: * A :py:mod:`pygett.request.GettResponse` object
[ "**", "get", "**" ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/request.py#L45-L58
mrallen1/pygett
pygett/request.py
BaseRequest.post
def post(self, endpoint, d, *args, **kwargs): """ **post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string if it's n...
python
def post(self, endpoint, d, *args, **kwargs): """ **post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string if it's n...
[ "def", "post", "(", "self", ",", "endpoint", ",", "d", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "endpoint", "=", "self", ".", "base_url", "+", "endpoint", "if", "not", "isinstance", "(", "d", ",", "str", ")", ":", "d", "=", "json", ...
**post** Make a POST call to a remote endpoint Input: * An endpoint relative to the ``base_url`` * POST data **NOTE**: Passed POST data will be automatically serialized to a JSON string if it's not already a string Output: * A :py:mod:`pyge...
[ "**", "post", "**" ]
train
https://github.com/mrallen1/pygett/blob/1e21f8674a3634a901af054226670174b5ce2d87/pygett/request.py#L60-L80