id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
243,100
jpablo128/simplystatic
bin/s2.py
do_rename
def do_rename(argdict): '''Rename a page.''' site = make_site_obj(argdict) slug = argdict['slug'] newtitle = argdict['newtitle'] try: site.rename_page(slug, newtitle) print "Renamed page." except ValueError: # pragma: no cover print "Cannot rename. A page with the given s...
python
def do_rename(argdict): '''Rename a page.''' site = make_site_obj(argdict) slug = argdict['slug'] newtitle = argdict['newtitle'] try: site.rename_page(slug, newtitle) print "Renamed page." except ValueError: # pragma: no cover print "Cannot rename. A page with the given s...
[ "def", "do_rename", "(", "argdict", ")", ":", "site", "=", "make_site_obj", "(", "argdict", ")", "slug", "=", "argdict", "[", "'slug'", "]", "newtitle", "=", "argdict", "[", "'newtitle'", "]", "try", ":", "site", ".", "rename_page", "(", "slug", ",", "...
Rename a page.
[ "Rename", "a", "page", "." ]
91ac579c8f34fa240bef9b87adb0116c6b40b24d
https://github.com/jpablo128/simplystatic/blob/91ac579c8f34fa240bef9b87adb0116c6b40b24d/bin/s2.py#L156-L166
243,101
jpablo128/simplystatic
bin/s2.py
do_gen
def do_gen(argdict): '''Generate the whole site.''' site = make_site_obj(argdict) try: st = time.time() site.generate() et = time.time() print "Generated Site in %f seconds."% (et-st) except ValueError as e: # pragma: no cover print "Cannot generate. You are not w...
python
def do_gen(argdict): '''Generate the whole site.''' site = make_site_obj(argdict) try: st = time.time() site.generate() et = time.time() print "Generated Site in %f seconds."% (et-st) except ValueError as e: # pragma: no cover print "Cannot generate. You are not w...
[ "def", "do_gen", "(", "argdict", ")", ":", "site", "=", "make_site_obj", "(", "argdict", ")", "try", ":", "st", "=", "time", ".", "time", "(", ")", "site", ".", "generate", "(", ")", "et", "=", "time", ".", "time", "(", ")", "print", "\"Generated S...
Generate the whole site.
[ "Generate", "the", "whole", "site", "." ]
91ac579c8f34fa240bef9b87adb0116c6b40b24d
https://github.com/jpablo128/simplystatic/blob/91ac579c8f34fa240bef9b87adb0116c6b40b24d/bin/s2.py#L168-L178
243,102
jpablo128/simplystatic
bin/s2.py
do_ls
def do_ls(argdict): '''List pages.''' site = make_site_obj(argdict) if not site.tree_ready: print "Cannot list pages. You are not within a simplystatic \ tree and you didn't specify a directory." sys.exit() drafts = argdict['drafts'] recent = argdict['recent'] dir = site.dirs['so...
python
def do_ls(argdict): '''List pages.''' site = make_site_obj(argdict) if not site.tree_ready: print "Cannot list pages. You are not within a simplystatic \ tree and you didn't specify a directory." sys.exit() drafts = argdict['drafts'] recent = argdict['recent'] dir = site.dirs['so...
[ "def", "do_ls", "(", "argdict", ")", ":", "site", "=", "make_site_obj", "(", "argdict", ")", "if", "not", "site", ".", "tree_ready", ":", "print", "\"Cannot list pages. You are not within a simplystatic \\\ntree and you didn't specify a directory.\"", "sys", ".", "exit", ...
List pages.
[ "List", "pages", "." ]
91ac579c8f34fa240bef9b87adb0116c6b40b24d
https://github.com/jpablo128/simplystatic/blob/91ac579c8f34fa240bef9b87adb0116c6b40b24d/bin/s2.py#L180-L217
243,103
b3j0f/schema
b3j0f/schema/registry.py
SchemaRegistry.register
def register(self, schema): """Register input schema class. When registering a schema, all inner schemas are registered as well. :param Schema schema: schema to register. :return: old registered schema. :rtype: type """ result = None uuid = schema.uuid ...
python
def register(self, schema): """Register input schema class. When registering a schema, all inner schemas are registered as well. :param Schema schema: schema to register. :return: old registered schema. :rtype: type """ result = None uuid = schema.uuid ...
[ "def", "register", "(", "self", ",", "schema", ")", ":", "result", "=", "None", "uuid", "=", "schema", ".", "uuid", "if", "uuid", "in", "self", ".", "_schbyuuid", ":", "result", "=", "self", ".", "_schbyuuid", "[", "uuid", "]", "if", "result", "!=", ...
Register input schema class. When registering a schema, all inner schemas are registered as well. :param Schema schema: schema to register. :return: old registered schema. :rtype: type
[ "Register", "input", "schema", "class", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/registry.py#L69-L100
243,104
b3j0f/schema
b3j0f/schema/registry.py
SchemaRegistry.registercls
def registercls(self, data_types, schemacls=None): """Register schema class with associated data_types. Can be used such as a decorator. :param list data_types: data types to associate with schema class. :param type schemacls: schema class to register. :return: schemacls. ...
python
def registercls(self, data_types, schemacls=None): """Register schema class with associated data_types. Can be used such as a decorator. :param list data_types: data types to associate with schema class. :param type schemacls: schema class to register. :return: schemacls. ...
[ "def", "registercls", "(", "self", ",", "data_types", ",", "schemacls", "=", "None", ")", ":", "if", "schemacls", "is", "None", ":", "return", "lambda", "schemacls", ":", "self", ".", "registercls", "(", "data_types", "=", "data_types", ",", "schemacls", "...
Register schema class with associated data_types. Can be used such as a decorator. :param list data_types: data types to associate with schema class. :param type schemacls: schema class to register. :return: schemacls. :rtype: type
[ "Register", "schema", "class", "with", "associated", "data_types", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/registry.py#L102-L120
243,105
b3j0f/schema
b3j0f/schema/registry.py
SchemaRegistry.unregister
def unregister(self, uuid): """Unregister a schema registered with input uuid. :raises: KeyError if uuid is not already registered. """ schema = self._schbyuuid.pop(uuid) # clean schemas by name self._schbyname[schema.name].remove(schema) if not self._schbyname[...
python
def unregister(self, uuid): """Unregister a schema registered with input uuid. :raises: KeyError if uuid is not already registered. """ schema = self._schbyuuid.pop(uuid) # clean schemas by name self._schbyname[schema.name].remove(schema) if not self._schbyname[...
[ "def", "unregister", "(", "self", ",", "uuid", ")", ":", "schema", "=", "self", ".", "_schbyuuid", ".", "pop", "(", "uuid", ")", "# clean schemas by name", "self", ".", "_schbyname", "[", "schema", ".", "name", "]", ".", "remove", "(", "schema", ")", "...
Unregister a schema registered with input uuid. :raises: KeyError if uuid is not already registered.
[ "Unregister", "a", "schema", "registered", "with", "input", "uuid", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/registry.py#L122-L132
243,106
b3j0f/schema
b3j0f/schema/registry.py
SchemaRegistry.getbyuuid
def getbyuuid(self, uuid): """Get a schema by given uuid. :param str uuid: schema uuid to retrieve. :rtype: Schema :raises: KeyError if uuid is not registered already. """ if uuid not in self._schbyuuid: raise KeyError('uuid {0} not registered'.format(uuid)) ...
python
def getbyuuid(self, uuid): """Get a schema by given uuid. :param str uuid: schema uuid to retrieve. :rtype: Schema :raises: KeyError if uuid is not registered already. """ if uuid not in self._schbyuuid: raise KeyError('uuid {0} not registered'.format(uuid)) ...
[ "def", "getbyuuid", "(", "self", ",", "uuid", ")", ":", "if", "uuid", "not", "in", "self", ".", "_schbyuuid", ":", "raise", "KeyError", "(", "'uuid {0} not registered'", ".", "format", "(", "uuid", ")", ")", "return", "self", ".", "_schbyuuid", "[", "uui...
Get a schema by given uuid. :param str uuid: schema uuid to retrieve. :rtype: Schema :raises: KeyError if uuid is not registered already.
[ "Get", "a", "schema", "by", "given", "uuid", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/registry.py#L154-L164
243,107
b3j0f/schema
b3j0f/schema/registry.py
SchemaRegistry.getbyname
def getbyname(self, name): """Get schemas by given name. :param str name: schema names to retrieve. :rtype: list :raises: KeyError if name is not registered already. """ if name not in self._schbyname: raise KeyError('name {0} not registered'.format(name)) ...
python
def getbyname(self, name): """Get schemas by given name. :param str name: schema names to retrieve. :rtype: list :raises: KeyError if name is not registered already. """ if name not in self._schbyname: raise KeyError('name {0} not registered'.format(name)) ...
[ "def", "getbyname", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "_schbyname", ":", "raise", "KeyError", "(", "'name {0} not registered'", ".", "format", "(", "name", ")", ")", "return", "self", ".", "_schbyname", "[", "nam...
Get schemas by given name. :param str name: schema names to retrieve. :rtype: list :raises: KeyError if name is not registered already.
[ "Get", "schemas", "by", "given", "name", "." ]
1c88c23337f5fef50254e65bd407112c43396dd9
https://github.com/b3j0f/schema/blob/1c88c23337f5fef50254e65bd407112c43396dd9/b3j0f/schema/registry.py#L166-L176
243,108
firstprayer/monsql
monsql/wrapper_sqlite3.py
SQLite3Database.truncate_table
def truncate_table(self, tablename): """ SQLite3 doesn't support direct truncate, so we just use delete here """ self.get(tablename).remove() self.db.commit()
python
def truncate_table(self, tablename): """ SQLite3 doesn't support direct truncate, so we just use delete here """ self.get(tablename).remove() self.db.commit()
[ "def", "truncate_table", "(", "self", ",", "tablename", ")", ":", "self", ".", "get", "(", "tablename", ")", ".", "remove", "(", ")", "self", ".", "db", ".", "commit", "(", ")" ]
SQLite3 doesn't support direct truncate, so we just use delete here
[ "SQLite3", "doesn", "t", "support", "direct", "truncate", "so", "we", "just", "use", "delete", "here" ]
6285c15b574c8664046eae2edfeb548c7b173efd
https://github.com/firstprayer/monsql/blob/6285c15b574c8664046eae2edfeb548c7b173efd/monsql/wrapper_sqlite3.py#L41-L46
243,109
vinu76jsr/pipsort
lib/pipsort/core/_logger.py
_Logger.start
def start(self, level="WARN"): """ Start logging with this logger. Until the logger is started, no messages will be emitted. This applies to all loggers with the same name and any child loggers. Messages less than the given priority level will be ignored. The default level is '...
python
def start(self, level="WARN"): """ Start logging with this logger. Until the logger is started, no messages will be emitted. This applies to all loggers with the same name and any child loggers. Messages less than the given priority level will be ignored. The default level is '...
[ "def", "start", "(", "self", ",", "level", "=", "\"WARN\"", ")", ":", "if", "self", ".", "active", ":", "return", "handler", "=", "StreamHandler", "(", ")", "# stderr", "handler", ".", "setFormatter", "(", "Formatter", "(", "self", ".", "LOGFMT", ")", ...
Start logging with this logger. Until the logger is started, no messages will be emitted. This applies to all loggers with the same name and any child loggers. Messages less than the given priority level will be ignored. The default level is 'WARN', which conforms to the *nix conventio...
[ "Start", "logging", "with", "this", "logger", "." ]
71ead1269de85ee0255741390bf1da85d81b7d16
https://github.com/vinu76jsr/pipsort/blob/71ead1269de85ee0255741390bf1da85d81b7d16/lib/pipsort/core/_logger.py#L38-L63
243,110
vinu76jsr/pipsort
lib/pipsort/core/_logger.py
_Logger.stop
def stop(self): """ Stop logging with this logger. """ if not self.active: return self.removeHandler(self.handlers[-1]) self.active = False return
python
def stop(self): """ Stop logging with this logger. """ if not self.active: return self.removeHandler(self.handlers[-1]) self.active = False return
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "active", ":", "return", "self", ".", "removeHandler", "(", "self", ".", "handlers", "[", "-", "1", "]", ")", "self", ".", "active", "=", "False", "return" ]
Stop logging with this logger.
[ "Stop", "logging", "with", "this", "logger", "." ]
71ead1269de85ee0255741390bf1da85d81b7d16
https://github.com/vinu76jsr/pipsort/blob/71ead1269de85ee0255741390bf1da85d81b7d16/lib/pipsort/core/_logger.py#L65-L73
243,111
jalanb/pysyte
pysyte/tracebacks.py
parse_line
def parse_line(string): """Parse a single string as traceback line""" match = line_regexp().match(string) if match: matches = match.groupdict() line_number = matches['line_number'] path_to_python = matches['path_to_python'] spaceless_path_to_python = matches['spaceless_path_t...
python
def parse_line(string): """Parse a single string as traceback line""" match = line_regexp().match(string) if match: matches = match.groupdict() line_number = matches['line_number'] path_to_python = matches['path_to_python'] spaceless_path_to_python = matches['spaceless_path_t...
[ "def", "parse_line", "(", "string", ")", ":", "match", "=", "line_regexp", "(", ")", ".", "match", "(", "string", ")", "if", "match", ":", "matches", "=", "match", ".", "groupdict", "(", ")", "line_number", "=", "matches", "[", "'line_number'", "]", "p...
Parse a single string as traceback line
[ "Parse", "a", "single", "string", "as", "traceback", "line" ]
4e278101943d1ceb1a6bcaf6ddc72052ecf13114
https://github.com/jalanb/pysyte/blob/4e278101943d1ceb1a6bcaf6ddc72052ecf13114/pysyte/tracebacks.py#L25-L36
243,112
timeyyy/apptools
peasoup/util.py
sftp_upload_window_size_set
def sftp_upload_window_size_set(srv,file, method_to_call='put'): ''' sets config for uploading files with pysftp ''' channel = srv.sftp_client.get_channel() channel.lock.acquire() channel.out_window_size += os.stat(file).st_size * 1.1 # bit more bytes incase packet loss channel.out_buffer_...
python
def sftp_upload_window_size_set(srv,file, method_to_call='put'): ''' sets config for uploading files with pysftp ''' channel = srv.sftp_client.get_channel() channel.lock.acquire() channel.out_window_size += os.stat(file).st_size * 1.1 # bit more bytes incase packet loss channel.out_buffer_...
[ "def", "sftp_upload_window_size_set", "(", "srv", ",", "file", ",", "method_to_call", "=", "'put'", ")", ":", "channel", "=", "srv", ".", "sftp_client", ".", "get_channel", "(", ")", "channel", ".", "lock", ".", "acquire", "(", ")", "channel", ".", "out_wi...
sets config for uploading files with pysftp
[ "sets", "config", "for", "uploading", "files", "with", "pysftp" ]
d3c0f324b0c2689c35f5601348276f4efd6cb240
https://github.com/timeyyy/apptools/blob/d3c0f324b0c2689c35f5601348276f4efd6cb240/peasoup/util.py#L76-L84
243,113
se-esss-litterbox/Pynac
Pynac/Plotting.py
PynPlt.plotit
def plotit(self): ''' Produce the plots requested in the Dynac input file. This makes the same plots as produced by the Dynac ``plotit`` command. ''' [self._plot(i) for i in range(len(self.plots))]
python
def plotit(self): ''' Produce the plots requested in the Dynac input file. This makes the same plots as produced by the Dynac ``plotit`` command. ''' [self._plot(i) for i in range(len(self.plots))]
[ "def", "plotit", "(", "self", ")", ":", "[", "self", ".", "_plot", "(", "i", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "plots", ")", ")", "]" ]
Produce the plots requested in the Dynac input file. This makes the same plots as produced by the Dynac ``plotit`` command.
[ "Produce", "the", "plots", "requested", "in", "the", "Dynac", "input", "file", ".", "This", "makes", "the", "same", "plots", "as", "produced", "by", "the", "Dynac", "plotit", "command", "." ]
97e20aa85d20112cd114faa54a8197c5d0f61209
https://github.com/se-esss-litterbox/Pynac/blob/97e20aa85d20112cd114faa54a8197c5d0f61209/Pynac/Plotting.py#L109-L114
243,114
maxweisspoker/simplebitcoinfuncs
simplebitcoinfuncs/bitcoin.py
multiplypub
def multiplypub(pub,priv,outcompressed=True): ''' Input pubkey must be hex string and valid pubkey. Input privkey must be 64-char hex string. Pubkey input can be compressed or uncompressed, as long as it's a valid key and a hex string. Use the validatepubkey() function to validate the public ke...
python
def multiplypub(pub,priv,outcompressed=True): ''' Input pubkey must be hex string and valid pubkey. Input privkey must be 64-char hex string. Pubkey input can be compressed or uncompressed, as long as it's a valid key and a hex string. Use the validatepubkey() function to validate the public ke...
[ "def", "multiplypub", "(", "pub", ",", "priv", ",", "outcompressed", "=", "True", ")", ":", "if", "len", "(", "pub", ")", "==", "66", ":", "pub", "=", "uncompress", "(", "pub", ")", "x", ",", "y", "=", "ecmultiply", "(", "int", "(", "pub", "[", ...
Input pubkey must be hex string and valid pubkey. Input privkey must be 64-char hex string. Pubkey input can be compressed or uncompressed, as long as it's a valid key and a hex string. Use the validatepubkey() function to validate the public key first. The compression of the input public key does...
[ "Input", "pubkey", "must", "be", "hex", "string", "and", "valid", "pubkey", ".", "Input", "privkey", "must", "be", "64", "-", "char", "hex", "string", "." ]
ad332433dfcc067e86d2e77fa0c8f1a27daffb63
https://github.com/maxweisspoker/simplebitcoinfuncs/blob/ad332433dfcc067e86d2e77fa0c8f1a27daffb63/simplebitcoinfuncs/bitcoin.py#L105-L125
243,115
maxweisspoker/simplebitcoinfuncs
simplebitcoinfuncs/bitcoin.py
validatepubkey
def validatepubkey(pub): ''' Returns input key if it's a valid hex public key, or False otherwise. Input must be hex string, not bytes or integer/long or anything else. ''' try: pub = hexstrlify(unhexlify(pub)) except: return False if len(pub) == 130: if pub...
python
def validatepubkey(pub): ''' Returns input key if it's a valid hex public key, or False otherwise. Input must be hex string, not bytes or integer/long or anything else. ''' try: pub = hexstrlify(unhexlify(pub)) except: return False if len(pub) == 130: if pub...
[ "def", "validatepubkey", "(", "pub", ")", ":", "try", ":", "pub", "=", "hexstrlify", "(", "unhexlify", "(", "pub", ")", ")", "except", ":", "return", "False", "if", "len", "(", "pub", ")", "==", "130", ":", "if", "pub", "[", ":", "2", "]", "!=", ...
Returns input key if it's a valid hex public key, or False otherwise. Input must be hex string, not bytes or integer/long or anything else.
[ "Returns", "input", "key", "if", "it", "s", "a", "valid", "hex", "public", "key", "or", "False", "otherwise", "." ]
ad332433dfcc067e86d2e77fa0c8f1a27daffb63
https://github.com/maxweisspoker/simplebitcoinfuncs/blob/ad332433dfcc067e86d2e77fa0c8f1a27daffb63/simplebitcoinfuncs/bitcoin.py#L197-L220
243,116
maxweisspoker/simplebitcoinfuncs
simplebitcoinfuncs/bitcoin.py
privtohex
def privtohex(key): ''' Used for getting unknown input type into a private key. For example, if you ask a user to input a private key, and they may input hex, WIF, integer, etc. Run it through this function to get a standardized format. Function either outputs private key hex string or raises ...
python
def privtohex(key): ''' Used for getting unknown input type into a private key. For example, if you ask a user to input a private key, and they may input hex, WIF, integer, etc. Run it through this function to get a standardized format. Function either outputs private key hex string or raises ...
[ "def", "privtohex", "(", "key", ")", ":", "if", "isitint", "(", "key", ")", ":", "key", "=", "dechex", "(", "key", ",", "32", ")", "else", ":", "try", ":", "key", ",", "z", ",", "zz", "=", "wiftohex", "(", "key", ")", "assert", "len", "(", "k...
Used for getting unknown input type into a private key. For example, if you ask a user to input a private key, and they may input hex, WIF, integer, etc. Run it through this function to get a standardized format. Function either outputs private key hex string or raises an exception. It's really go...
[ "Used", "for", "getting", "unknown", "input", "type", "into", "a", "private", "key", "." ]
ad332433dfcc067e86d2e77fa0c8f1a27daffb63
https://github.com/maxweisspoker/simplebitcoinfuncs/blob/ad332433dfcc067e86d2e77fa0c8f1a27daffb63/simplebitcoinfuncs/bitcoin.py#L245-L287
243,117
olsoneric/pedemath
pedemath/quat.py
conjugate_quat
def conjugate_quat(quat): """Negate the vector part of the quaternion.""" return Quat(-quat.x, -quat.y, -quat.z, quat.w)
python
def conjugate_quat(quat): """Negate the vector part of the quaternion.""" return Quat(-quat.x, -quat.y, -quat.z, quat.w)
[ "def", "conjugate_quat", "(", "quat", ")", ":", "return", "Quat", "(", "-", "quat", ".", "x", ",", "-", "quat", ".", "y", ",", "-", "quat", ".", "z", ",", "quat", ".", "w", ")" ]
Negate the vector part of the quaternion.
[ "Negate", "the", "vector", "part", "of", "the", "quaternion", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/quat.py#L17-L19
243,118
olsoneric/pedemath
pedemath/quat.py
lerp_quat
def lerp_quat(from_quat, to_quat, percent): """Return linear interpolation of two quaternions.""" # Check if signs need to be reversed. if dot_quat(from_quat, to_quat) < 0.0: to_sign = -1 else: to_sign = 1 # Simple linear interpolation percent_from = 1.0 - percent percent_t...
python
def lerp_quat(from_quat, to_quat, percent): """Return linear interpolation of two quaternions.""" # Check if signs need to be reversed. if dot_quat(from_quat, to_quat) < 0.0: to_sign = -1 else: to_sign = 1 # Simple linear interpolation percent_from = 1.0 - percent percent_t...
[ "def", "lerp_quat", "(", "from_quat", ",", "to_quat", ",", "percent", ")", ":", "# Check if signs need to be reversed.", "if", "dot_quat", "(", "from_quat", ",", "to_quat", ")", "<", "0.0", ":", "to_sign", "=", "-", "1", "else", ":", "to_sign", "=", "1", "...
Return linear interpolation of two quaternions.
[ "Return", "linear", "interpolation", "of", "two", "quaternions", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/quat.py#L27-L46
243,119
olsoneric/pedemath
pedemath/quat.py
nlerp_quat
def nlerp_quat(from_quat, to_quat, percent): """Return normalized linear interpolation of two quaternions. Less computationally expensive than slerp (which not implemented in this lib yet), but does not maintain a constant velocity like slerp. """ result = lerp_quat(from_quat, to_quat, percent) ...
python
def nlerp_quat(from_quat, to_quat, percent): """Return normalized linear interpolation of two quaternions. Less computationally expensive than slerp (which not implemented in this lib yet), but does not maintain a constant velocity like slerp. """ result = lerp_quat(from_quat, to_quat, percent) ...
[ "def", "nlerp_quat", "(", "from_quat", ",", "to_quat", ",", "percent", ")", ":", "result", "=", "lerp_quat", "(", "from_quat", ",", "to_quat", ",", "percent", ")", "result", ".", "normalize", "(", ")", "return", "result" ]
Return normalized linear interpolation of two quaternions. Less computationally expensive than slerp (which not implemented in this lib yet), but does not maintain a constant velocity like slerp.
[ "Return", "normalized", "linear", "interpolation", "of", "two", "quaternions", "." ]
4bffcfe7089e421d603eb0a9708b84789c2d16be
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/quat.py#L49-L58
243,120
PRIArobotics/HedgehogUtils
hedgehog/utils/asyncio.py
repeat_func
def repeat_func(func: Callable[[], Union[T, Awaitable[T]]], times: int=None, *, interval: float=0) -> AsyncIterator[T]: """ Repeats the result of a 0-ary function either indefinitely, or for a defined number of times. `times` and `interval` behave exactly like with `aiostream.create.repeat`. A useful i...
python
def repeat_func(func: Callable[[], Union[T, Awaitable[T]]], times: int=None, *, interval: float=0) -> AsyncIterator[T]: """ Repeats the result of a 0-ary function either indefinitely, or for a defined number of times. `times` and `interval` behave exactly like with `aiostream.create.repeat`. A useful i...
[ "def", "repeat_func", "(", "func", ":", "Callable", "[", "[", "]", ",", "Union", "[", "T", ",", "Awaitable", "[", "T", "]", "]", "]", ",", "times", ":", "int", "=", "None", ",", "*", ",", "interval", ":", "float", "=", "0", ")", "->", "AsyncIte...
Repeats the result of a 0-ary function either indefinitely, or for a defined number of times. `times` and `interval` behave exactly like with `aiostream.create.repeat`. A useful idiom is to combine an indefinite `repeat_func` stream with `aiostream.select.takewhile` to terminate the stream at some point.
[ "Repeats", "the", "result", "of", "a", "0", "-", "ary", "function", "either", "indefinitely", "or", "for", "a", "defined", "number", "of", "times", ".", "times", "and", "interval", "behave", "exactly", "like", "with", "aiostream", ".", "create", ".", "repe...
cc368df270288c870cc66d707696ccb62823ca9c
https://github.com/PRIArobotics/HedgehogUtils/blob/cc368df270288c870cc66d707696ccb62823ca9c/hedgehog/utils/asyncio.py#L15-L24
243,121
PRIArobotics/HedgehogUtils
hedgehog/utils/asyncio.py
repeat_func_eof
def repeat_func_eof(func: Callable[[], Union[T, Awaitable[T]]], eof: Any, *, interval: float=0, use_is: bool=False) -> AsyncIterator[T]: """ Repeats the result of a 0-ary function until an `eof` item is reached. The `eof` item itself is not part of the resulting stream; by setting `use_is` to true, eof ...
python
def repeat_func_eof(func: Callable[[], Union[T, Awaitable[T]]], eof: Any, *, interval: float=0, use_is: bool=False) -> AsyncIterator[T]: """ Repeats the result of a 0-ary function until an `eof` item is reached. The `eof` item itself is not part of the resulting stream; by setting `use_is` to true, eof ...
[ "def", "repeat_func_eof", "(", "func", ":", "Callable", "[", "[", "]", ",", "Union", "[", "T", ",", "Awaitable", "[", "T", "]", "]", "]", ",", "eof", ":", "Any", ",", "*", ",", "interval", ":", "float", "=", "0", ",", "use_is", ":", "bool", "="...
Repeats the result of a 0-ary function until an `eof` item is reached. The `eof` item itself is not part of the resulting stream; by setting `use_is` to true, eof is checked by identity rather than equality. `times` and `interval` behave exactly like with `aiostream.create.repeat`.
[ "Repeats", "the", "result", "of", "a", "0", "-", "ary", "function", "until", "an", "eof", "item", "is", "reached", ".", "The", "eof", "item", "itself", "is", "not", "part", "of", "the", "resulting", "stream", ";", "by", "setting", "use_is", "to", "true...
cc368df270288c870cc66d707696ccb62823ca9c
https://github.com/PRIArobotics/HedgehogUtils/blob/cc368df270288c870cc66d707696ccb62823ca9c/hedgehog/utils/asyncio.py#L28-L37
243,122
davidmiller/letter
letter/__init__.py
_stringlist
def _stringlist(*args): """ Take a lists of strings or strings and flatten these into a list of strings. Arguments: - `*args`: "" or [""...] Return: [""...] Exceptions: None """ return list(itertools.chain.from_iterable(itertools.repeat(x,1) if stringy(x) else x for x in args if x)...
python
def _stringlist(*args): """ Take a lists of strings or strings and flatten these into a list of strings. Arguments: - `*args`: "" or [""...] Return: [""...] Exceptions: None """ return list(itertools.chain.from_iterable(itertools.repeat(x,1) if stringy(x) else x for x in args if x)...
[ "def", "_stringlist", "(", "*", "args", ")", ":", "return", "list", "(", "itertools", ".", "chain", ".", "from_iterable", "(", "itertools", ".", "repeat", "(", "x", ",", "1", ")", "if", "stringy", "(", "x", ")", "else", "x", "for", "x", "in", "args...
Take a lists of strings or strings and flatten these into a list of strings. Arguments: - `*args`: "" or [""...] Return: [""...] Exceptions: None
[ "Take", "a", "lists", "of", "strings", "or", "strings", "and", "flatten", "these", "into", "a", "list", "of", "strings", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L51-L62
243,123
davidmiller/letter
letter/__init__.py
_parse_outgoing_mail
def _parse_outgoing_mail(sender, to, msgstring): """ Parse an outgoing mail and put it into the OUTBOX. Arguments: - `sender`: str - `to`: str - `msgstring`: str Return: None Exceptions: None """ global OUTBOX OUTBOX.append(email.message_from_string(msgstring)) return
python
def _parse_outgoing_mail(sender, to, msgstring): """ Parse an outgoing mail and put it into the OUTBOX. Arguments: - `sender`: str - `to`: str - `msgstring`: str Return: None Exceptions: None """ global OUTBOX OUTBOX.append(email.message_from_string(msgstring)) return
[ "def", "_parse_outgoing_mail", "(", "sender", ",", "to", ",", "msgstring", ")", ":", "global", "OUTBOX", "OUTBOX", ".", "append", "(", "email", ".", "message_from_string", "(", "msgstring", ")", ")", "return" ]
Parse an outgoing mail and put it into the OUTBOX. Arguments: - `sender`: str - `to`: str - `msgstring`: str Return: None Exceptions: None
[ "Parse", "an", "outgoing", "mail", "and", "put", "it", "into", "the", "OUTBOX", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L581-L596
243,124
davidmiller/letter
letter/__init__.py
Attachment.as_msg
def as_msg(self): """ Convert ourself to be a message part of the appropriate MIME type. Return: MIMEBase Exceptions: None """ # Based upon http://docs.python.org/2/library/email-examples.html # with minimal tweaking # Guess the content type base...
python
def as_msg(self): """ Convert ourself to be a message part of the appropriate MIME type. Return: MIMEBase Exceptions: None """ # Based upon http://docs.python.org/2/library/email-examples.html # with minimal tweaking # Guess the content type base...
[ "def", "as_msg", "(", "self", ")", ":", "# Based upon http://docs.python.org/2/library/email-examples.html", "# with minimal tweaking", "# Guess the content type based on the file's extension. Encoding", "# will be ignored, although we should check for simple things like", "# gzip'd or compress...
Convert ourself to be a message part of the appropriate MIME type. Return: MIMEBase Exceptions: None
[ "Convert", "ourself", "to", "be", "a", "message", "part", "of", "the", "appropriate", "MIME", "type", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L72-L113
243,125
davidmiller/letter
letter/__init__.py
BaseMailer.tolist
def tolist(self, to): """ Make sure that our addressees are a unicoded list Arguments: - `to`: str or list Return: [u, ...] Exceptions: None """ return ', '.join(isinstance(to, list) and [u(x) for x in to] or [u(to)])
python
def tolist(self, to): """ Make sure that our addressees are a unicoded list Arguments: - `to`: str or list Return: [u, ...] Exceptions: None """ return ', '.join(isinstance(to, list) and [u(x) for x in to] or [u(to)])
[ "def", "tolist", "(", "self", ",", "to", ")", ":", "return", "', '", ".", "join", "(", "isinstance", "(", "to", ",", "list", ")", "and", "[", "u", "(", "x", ")", "for", "x", "in", "to", "]", "or", "[", "u", "(", "to", ")", "]", ")" ]
Make sure that our addressees are a unicoded list Arguments: - `to`: str or list Return: [u, ...] Exceptions: None
[ "Make", "sure", "that", "our", "addressees", "are", "a", "unicoded", "list" ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L122-L132
243,126
davidmiller/letter
letter/__init__.py
BaseMailer.sanity_check
def sanity_check(self, sender, to, subject, plain=None, html=None, cc=None, bcc=None): """ Sanity check the message. If we have PLAIN and HTML versions, send a multipart alternative MIME message, else send whichever we do have. If we have neither, raise NoContentError ...
python
def sanity_check(self, sender, to, subject, plain=None, html=None, cc=None, bcc=None): """ Sanity check the message. If we have PLAIN and HTML versions, send a multipart alternative MIME message, else send whichever we do have. If we have neither, raise NoContentError ...
[ "def", "sanity_check", "(", "self", ",", "sender", ",", "to", ",", "subject", ",", "plain", "=", "None", ",", "html", "=", "None", ",", "cc", "=", "None", ",", "bcc", "=", "None", ")", ":", "if", "not", "plain", "and", "not", "html", ":", "raise"...
Sanity check the message. If we have PLAIN and HTML versions, send a multipart alternative MIME message, else send whichever we do have. If we have neither, raise NoContentError Arguments: - `sender`: str - `to`: list - `subject`: str - `plain`: str ...
[ "Sanity", "check", "the", "message", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L134-L154
243,127
davidmiller/letter
letter/__init__.py
BasePostman._find_tpl
def _find_tpl(self, name, extension='.jinja2'): """ Return a Path object representing the Template we're after, searching SELF.tpls or None Arguments: - `name`: str Return: Path or None Exceptions: None """ found = None for loc in self.tp...
python
def _find_tpl(self, name, extension='.jinja2'): """ Return a Path object representing the Template we're after, searching SELF.tpls or None Arguments: - `name`: str Return: Path or None Exceptions: None """ found = None for loc in self.tp...
[ "def", "_find_tpl", "(", "self", ",", "name", ",", "extension", "=", "'.jinja2'", ")", ":", "found", "=", "None", "for", "loc", "in", "self", ".", "tpls", ":", "if", "not", "loc", ":", "continue", "contents", "=", "[", "f", "for", "f", "in", "loc",...
Return a Path object representing the Template we're after, searching SELF.tpls or None Arguments: - `name`: str Return: Path or None Exceptions: None
[ "Return", "a", "Path", "object", "representing", "the", "Template", "we", "re", "after", "searching", "SELF", ".", "tpls", "or", "None" ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L354-L376
243,128
davidmiller/letter
letter/__init__.py
BasePostman._find_tpls
def _find_tpls(self, name): """ Return plain, html templates for NAME Arguments: - `name`: str Return: tuple Exceptions: None """ return self._find_tpl(name, extension='.txt'), self._find_tpl(name, extension='.html')
python
def _find_tpls(self, name): """ Return plain, html templates for NAME Arguments: - `name`: str Return: tuple Exceptions: None """ return self._find_tpl(name, extension='.txt'), self._find_tpl(name, extension='.html')
[ "def", "_find_tpls", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_find_tpl", "(", "name", ",", "extension", "=", "'.txt'", ")", ",", "self", ".", "_find_tpl", "(", "name", ",", "extension", "=", "'.html'", ")" ]
Return plain, html templates for NAME Arguments: - `name`: str Return: tuple Exceptions: None
[ "Return", "plain", "html", "templates", "for", "NAME" ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L378-L388
243,129
davidmiller/letter
letter/__init__.py
BasePostman._sendtpl
def _sendtpl(self, sender, to, subject, cc=None, bcc=None, attach=None, replyto=None, **kwargs): """ Send a Letter from SENDER to TO, with the subject SUBJECT. Use the current template, with KWARGS as the context. Arguments: - `sender`: unicode - `to`: unicode - ...
python
def _sendtpl(self, sender, to, subject, cc=None, bcc=None, attach=None, replyto=None, **kwargs): """ Send a Letter from SENDER to TO, with the subject SUBJECT. Use the current template, with KWARGS as the context. Arguments: - `sender`: unicode - `to`: unicode - ...
[ "def", "_sendtpl", "(", "self", ",", "sender", ",", "to", ",", "subject", ",", "cc", "=", "None", ",", "bcc", "=", "None", ",", "attach", "=", "None", ",", "replyto", "=", "None", ",", "*", "*", "kwargs", ")", ":", "plain", ",", "html", "=", "s...
Send a Letter from SENDER to TO, with the subject SUBJECT. Use the current template, with KWARGS as the context. Arguments: - `sender`: unicode - `to`: unicode - `subject`: unicode - `cc`: str or [str] - `bcc`: str or [str] - `replyto`: str - `**k...
[ "Send", "a", "Letter", "from", "SENDER", "to", "TO", "with", "the", "subject", "SUBJECT", ".", "Use", "the", "current", "template", "with", "KWARGS", "as", "the", "context", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L411-L431
243,130
davidmiller/letter
letter/__init__.py
BasePostman.body
def body(self, **kwargs): """ Return the plain and html versions of our contents. Return: tuple Exceptions: None """ text_content, html_content = None, None if self.plain: text_content = mold.cast(self.plain, **kwargs) if self.html: ...
python
def body(self, **kwargs): """ Return the plain and html versions of our contents. Return: tuple Exceptions: None """ text_content, html_content = None, None if self.plain: text_content = mold.cast(self.plain, **kwargs) if self.html: ...
[ "def", "body", "(", "self", ",", "*", "*", "kwargs", ")", ":", "text_content", ",", "html_content", "=", "None", ",", "None", "if", "self", ".", "plain", ":", "text_content", "=", "mold", ".", "cast", "(", "self", ".", "plain", ",", "*", "*", "kwar...
Return the plain and html versions of our contents. Return: tuple Exceptions: None
[ "Return", "the", "plain", "and", "html", "versions", "of", "our", "contents", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L433-L445
243,131
davidmiller/letter
letter/__init__.py
BasePostman.template
def template(self, name): """ Set an active template to use with our Postman. This changes the call signature of send. Arguments: - `name`: str Return: None Exceptions: None """ self.plain, self.html = self._find_tpls(name) if not self.p...
python
def template(self, name): """ Set an active template to use with our Postman. This changes the call signature of send. Arguments: - `name`: str Return: None Exceptions: None """ self.plain, self.html = self._find_tpls(name) if not self.p...
[ "def", "template", "(", "self", ",", "name", ")", ":", "self", ".", "plain", ",", "self", ".", "html", "=", "self", ".", "_find_tpls", "(", "name", ")", "if", "not", "self", ".", "plain", ":", "self", ".", "plain", "=", "self", ".", "_find_tpl", ...
Set an active template to use with our Postman. This changes the call signature of send. Arguments: - `name`: str Return: None Exceptions: None
[ "Set", "an", "active", "template", "to", "use", "with", "our", "Postman", "." ]
c0c66ae2c6a792106e9a8374a01421817c8a8ae0
https://github.com/davidmiller/letter/blob/c0c66ae2c6a792106e9a8374a01421817c8a8ae0/letter/__init__.py#L448-L468
243,132
diffeo/rejester
rejester/_task_master.py
Worker.environment
def environment(self): '''Get raw data about this worker. This is recorded in the :meth:`heartbeat` info, and can be retrieved by :meth:`TaskMaster.get_heartbeat`. The dictionary includes keys ``worker_id``, ``host``, ``fqdn``, ``version``, ``working_set``, and ``memory``. ...
python
def environment(self): '''Get raw data about this worker. This is recorded in the :meth:`heartbeat` info, and can be retrieved by :meth:`TaskMaster.get_heartbeat`. The dictionary includes keys ``worker_id``, ``host``, ``fqdn``, ``version``, ``working_set``, and ``memory``. ...
[ "def", "environment", "(", "self", ")", ":", "hostname", "=", "socket", ".", "gethostname", "(", ")", "aliases", "=", "(", ")", "ipaddrs", "=", "(", ")", "# This sequence isn't 100% reliable. We might try a socket()", "# sequence like RedisBase._ipaddress(), or just deci...
Get raw data about this worker. This is recorded in the :meth:`heartbeat` info, and can be retrieved by :meth:`TaskMaster.get_heartbeat`. The dictionary includes keys ``worker_id``, ``host``, ``fqdn``, ``version``, ``working_set``, and ``memory``.
[ "Get", "raw", "data", "about", "this", "worker", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L107-L152
243,133
diffeo/rejester
rejester/_task_master.py
Worker.register
def register(self, parent=None): '''Record the availability of this worker and get a unique identifer. This sets :attr:`worker_id` and calls :meth:`heartbeat`. This cannot be called multiple times without calling :meth:`unregister` in between. ''' if self.worker_id: ...
python
def register(self, parent=None): '''Record the availability of this worker and get a unique identifer. This sets :attr:`worker_id` and calls :meth:`heartbeat`. This cannot be called multiple times without calling :meth:`unregister` in between. ''' if self.worker_id: ...
[ "def", "register", "(", "self", ",", "parent", "=", "None", ")", ":", "if", "self", ".", "worker_id", ":", "raise", "ProgrammerError", "(", "'Worker.register cannot be called again without first calling unregister; it is not idempotent'", ")", "self", ".", "parent", "="...
Record the availability of this worker and get a unique identifer. This sets :attr:`worker_id` and calls :meth:`heartbeat`. This cannot be called multiple times without calling :meth:`unregister` in between.
[ "Record", "the", "availability", "of", "this", "worker", "and", "get", "a", "unique", "identifer", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L154-L168
243,134
diffeo/rejester
rejester/_task_master.py
Worker.unregister
def unregister(self): '''Remove this worker from the list of available workers. This requires the worker to already have been :meth:`register()`. ''' self.task_master.worker_unregister(self.worker_id) self.task_master.worker_id = None self.worker_id = None
python
def unregister(self): '''Remove this worker from the list of available workers. This requires the worker to already have been :meth:`register()`. ''' self.task_master.worker_unregister(self.worker_id) self.task_master.worker_id = None self.worker_id = None
[ "def", "unregister", "(", "self", ")", ":", "self", ".", "task_master", ".", "worker_unregister", "(", "self", ".", "worker_id", ")", "self", ".", "task_master", ".", "worker_id", "=", "None", "self", ".", "worker_id", "=", "None" ]
Remove this worker from the list of available workers. This requires the worker to already have been :meth:`register()`.
[ "Remove", "this", "worker", "from", "the", "list", "of", "available", "workers", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L170-L178
243,135
diffeo/rejester
rejester/_task_master.py
Worker.heartbeat
def heartbeat(self): '''Record the current worker state in the registry. This records the worker's current mode, plus the contents of :meth:`environment`, in the data store for inspection by others. :returns mode: Current mode, as :meth:`TaskMaster.get_mode` ''' mode =...
python
def heartbeat(self): '''Record the current worker state in the registry. This records the worker's current mode, plus the contents of :meth:`environment`, in the data store for inspection by others. :returns mode: Current mode, as :meth:`TaskMaster.get_mode` ''' mode =...
[ "def", "heartbeat", "(", "self", ")", ":", "mode", "=", "self", ".", "task_master", ".", "get_mode", "(", ")", "self", ".", "task_master", ".", "worker_heartbeat", "(", "self", ".", "worker_id", ",", "mode", ",", "self", ".", "lifetime", ",", "self", "...
Record the current worker state in the registry. This records the worker's current mode, plus the contents of :meth:`environment`, in the data store for inspection by others. :returns mode: Current mode, as :meth:`TaskMaster.get_mode`
[ "Record", "the", "current", "worker", "state", "in", "the", "registry", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L180-L193
243,136
diffeo/rejester
rejester/_task_master.py
WorkUnit.spec
def spec(self): '''Actual work spec. This is retrieved from the database on first use, and in some cases a worker can be mildly more efficient if it avoids using this. ''' if self._spec_cache is None: self._spec_cache = self.registry.get( WOR...
python
def spec(self): '''Actual work spec. This is retrieved from the database on first use, and in some cases a worker can be mildly more efficient if it avoids using this. ''' if self._spec_cache is None: self._spec_cache = self.registry.get( WOR...
[ "def", "spec", "(", "self", ")", ":", "if", "self", ".", "_spec_cache", "is", "None", ":", "self", ".", "_spec_cache", "=", "self", ".", "registry", ".", "get", "(", "WORK_SPECS", ",", "self", ".", "work_spec_name", ")", "return", "self", ".", "_spec_c...
Actual work spec. This is retrieved from the database on first use, and in some cases a worker can be mildly more efficient if it avoids using this.
[ "Actual", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L284-L295
243,137
diffeo/rejester
rejester/_task_master.py
WorkUnit.module
def module(self): '''Python module to run the job. This is used by :func:`run` and the standard worker system. If the work spec contains keys ``module``, ``run_function``, and ``terminate_function``, then this contains the Python module object named as ``module``; otherwise this...
python
def module(self): '''Python module to run the job. This is used by :func:`run` and the standard worker system. If the work spec contains keys ``module``, ``run_function``, and ``terminate_function``, then this contains the Python module object named as ``module``; otherwise this...
[ "def", "module", "(", "self", ")", ":", "if", "self", ".", "_module_cache", "is", "None", ":", "funclist", "=", "filter", "(", "None", ",", "(", "self", ".", "spec", ".", "get", "(", "'run_function'", ")", ",", "self", ".", "spec", ".", "get", "(",...
Python module to run the job. This is used by :func:`run` and the standard worker system. If the work spec contains keys ``module``, ``run_function``, and ``terminate_function``, then this contains the Python module object named as ``module``; otherwise this contains :const:`Non...
[ "Python", "module", "to", "run", "the", "job", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L298-L319
243,138
diffeo/rejester
rejester/_task_master.py
WorkUnit.run
def run(self): '''Actually runs the work unit. This is called by the standard worker system, generally once per work unit. It requires the work spec to contain keys ``module``, ``run_function``, and ``terminate_function``. It looks up ``run_function`` in :attr:`module` and call...
python
def run(self): '''Actually runs the work unit. This is called by the standard worker system, generally once per work unit. It requires the work spec to contain keys ``module``, ``run_function``, and ``terminate_function``. It looks up ``run_function`` in :attr:`module` and call...
[ "def", "run", "(", "self", ")", ":", "try", ":", "logger", ".", "info", "(", "'running work unit {0}'", ".", "format", "(", "self", ".", "key", ")", ")", "run_function", "=", "getattr", "(", "self", ".", "module", ",", "self", ".", "spec", "[", "'run...
Actually runs the work unit. This is called by the standard worker system, generally once per work unit. It requires the work spec to contain keys ``module``, ``run_function``, and ``terminate_function``. It looks up ``run_function`` in :attr:`module` and calls that function wi...
[ "Actually", "runs", "the", "work", "unit", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L321-L344
243,139
diffeo/rejester
rejester/_task_master.py
WorkUnit.terminate
def terminate(self): '''Kills the work unit. This is called by the standard worker system, but only in response to an operating system signal. If the job does setup such as creating a child process, its terminate function should kill that child process. More specifically, this...
python
def terminate(self): '''Kills the work unit. This is called by the standard worker system, but only in response to an operating system signal. If the job does setup such as creating a child process, its terminate function should kill that child process. More specifically, this...
[ "def", "terminate", "(", "self", ")", ":", "terminate_function_name", "=", "self", ".", "spec", ".", "get", "(", "'terminate_function'", ")", "if", "not", "terminate_function_name", ":", "logger", ".", "error", "(", "'tried to terminate WorkUnit(%r) but no '", "'fun...
Kills the work unit. This is called by the standard worker system, but only in response to an operating system signal. If the job does setup such as creating a child process, its terminate function should kill that child process. More specifically, this function requires the w...
[ "Kills", "the", "work", "unit", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L346-L376
243,140
diffeo/rejester
rejester/_task_master.py
WorkUnit._refresh
def _refresh(self, session, stopping=False): '''Get this task's current state. This must be called under the registry's lock. It updates the :attr:`finished` and :attr:`failed` flags and the :attr:`data` dictionary based on the current state in the registry. In the nor...
python
def _refresh(self, session, stopping=False): '''Get this task's current state. This must be called under the registry's lock. It updates the :attr:`finished` and :attr:`failed` flags and the :attr:`data` dictionary based on the current state in the registry. In the nor...
[ "def", "_refresh", "(", "self", ",", "session", ",", "stopping", "=", "False", ")", ":", "data", "=", "session", ".", "get", "(", "WORK_UNITS_", "+", "self", ".", "work_spec_name", "+", "_FINISHED", ",", "self", ".", "key", ")", "if", "data", "is", "...
Get this task's current state. This must be called under the registry's lock. It updates the :attr:`finished` and :attr:`failed` flags and the :attr:`data` dictionary based on the current state in the registry. In the normal case, nothing will change and this function ...
[ "Get", "this", "task", "s", "current", "state", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L378-L441
243,141
diffeo/rejester
rejester/_task_master.py
WorkUnit.update
def update(self, lease_time=None): '''Refresh this task's expiration time. This tries to set the task's expiration time to the current time, plus `lease_time` seconds. It requires the job to not already be complete. If `lease_time` is negative, makes the job immediately be ava...
python
def update(self, lease_time=None): '''Refresh this task's expiration time. This tries to set the task's expiration time to the current time, plus `lease_time` seconds. It requires the job to not already be complete. If `lease_time` is negative, makes the job immediately be ava...
[ "def", "update", "(", "self", ",", "lease_time", "=", "None", ")", ":", "if", "lease_time", "is", "None", ":", "lease_time", "=", "self", ".", "default_lifetime", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_...
Refresh this task's expiration time. This tries to set the task's expiration time to the current time, plus `lease_time` seconds. It requires the job to not already be complete. If `lease_time` is negative, makes the job immediately be available for other workers to run. :par...
[ "Refresh", "this", "task", "s", "expiration", "time", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L443-L469
243,142
diffeo/rejester
rejester/_task_master.py
WorkUnit.finish
def finish(self): '''Move this work unit to a finished state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` returns successfully. :raises rejester.exceptions.LostLease: if the lease has already expired ''' ...
python
def finish(self): '''Move this work unit to a finished state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` returns successfully. :raises rejester.exceptions.LostLease: if the lease has already expired ''' ...
[ "def", "finish", "(", "self", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "self", ".", "_refresh", "(", "session", ",", "stopping", "=", "True", ")", "if", "self...
Move this work unit to a finished state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` returns successfully. :raises rejester.exceptions.LostLease: if the lease has already expired
[ "Move", "this", "work", "unit", "to", "a", "finished", "state", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L471-L515
243,143
diffeo/rejester
rejester/_task_master.py
WorkUnit.fail
def fail(self, exc=None): '''Move this work unit to a failed state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` ends with any exception: .. code-block:: python try: work_unit.run() work_...
python
def fail(self, exc=None): '''Move this work unit to a failed state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` ends with any exception: .. code-block:: python try: work_unit.run() work_...
[ "def", "fail", "(", "self", ",", "exc", "=", "None", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "self", ".", "_refresh", "(", "session", ",", "stopping", "=", ...
Move this work unit to a failed state. In the standard worker system, the worker calls this on the job's behalf when :meth:`run_function` ends with any exception: .. code-block:: python try: work_unit.run() work_unit.finish() except Exce...
[ "Move", "this", "work", "unit", "to", "a", "failed", "state", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L517-L586
243,144
diffeo/rejester
rejester/_task_master.py
TaskMaster.set_mode
def set_mode(self, mode): '''Set the global mode of the rejester system. This must be one of the constants :attr:`TERMINATE`, :attr:`RUN`, or :attr:`IDLE`. :attr:`TERMINATE` instructs any running workers to do an orderly shutdown, completing current jobs then exiting. :attr:`I...
python
def set_mode(self, mode): '''Set the global mode of the rejester system. This must be one of the constants :attr:`TERMINATE`, :attr:`RUN`, or :attr:`IDLE`. :attr:`TERMINATE` instructs any running workers to do an orderly shutdown, completing current jobs then exiting. :attr:`I...
[ "def", "set_mode", "(", "self", ",", "mode", ")", ":", "if", "mode", "not", "in", "[", "self", ".", "TERMINATE", ",", "self", ".", "RUN", ",", "self", ".", "IDLE", "]", ":", "raise", "ProgrammerError", "(", "'mode=%r is not recognized'", "%", "mode", "...
Set the global mode of the rejester system. This must be one of the constants :attr:`TERMINATE`, :attr:`RUN`, or :attr:`IDLE`. :attr:`TERMINATE` instructs any running workers to do an orderly shutdown, completing current jobs then exiting. :attr:`IDLE` instructs workers to stay ...
[ "Set", "the", "global", "mode", "of", "the", "rejester", "system", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L717-L735
243,145
diffeo/rejester
rejester/_task_master.py
TaskMaster.mode_counts
def mode_counts(self): '''Get the number of workers in each mode. This returns a dictionary where the keys are mode constants and the values are a simple integer count of the number of workers in that mode. ''' modes = {self.RUN: 0, self.IDLE: 0, self.TERMINATE: 0} ...
python
def mode_counts(self): '''Get the number of workers in each mode. This returns a dictionary where the keys are mode constants and the values are a simple integer count of the number of workers in that mode. ''' modes = {self.RUN: 0, self.IDLE: 0, self.TERMINATE: 0} ...
[ "def", "mode_counts", "(", "self", ")", ":", "modes", "=", "{", "self", ".", "RUN", ":", "0", ",", "self", ".", "IDLE", ":", "0", ",", "self", ".", "TERMINATE", ":", "0", "}", "for", "worker_id", ",", "mode", "in", "self", ".", "workers", "(", ...
Get the number of workers in each mode. This returns a dictionary where the keys are mode constants and the values are a simple integer count of the number of workers in that mode.
[ "Get", "the", "number", "of", "workers", "in", "each", "mode", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L773-L784
243,146
diffeo/rejester
rejester/_task_master.py
TaskMaster.workers
def workers(self, alive=True): '''Get a listing of all workers. This returns a dictionary mapping worker ID to the mode constant for their last observed mode. :param bool alive: if true (default), only include workers that have called :meth:`Worker.heartbeat` sufficiently rec...
python
def workers(self, alive=True): '''Get a listing of all workers. This returns a dictionary mapping worker ID to the mode constant for their last observed mode. :param bool alive: if true (default), only include workers that have called :meth:`Worker.heartbeat` sufficiently rec...
[ "def", "workers", "(", "self", ",", "alive", "=", "True", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORKER_OBSERVED_MODE", ",", "priority_min", "=", "alive", "and", "time", ".", "time", "(", ")", "or", "'-inf'", ")" ]
Get a listing of all workers. This returns a dictionary mapping worker ID to the mode constant for their last observed mode. :param bool alive: if true (default), only include workers that have called :meth:`Worker.heartbeat` sufficiently recently
[ "Get", "a", "listing", "of", "all", "workers", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L786-L798
243,147
diffeo/rejester
rejester/_task_master.py
TaskMaster.dump
def dump(self): '''Print the entire contents of this to debug log messages. This is really only intended for debugging. It could produce a lot of data. ''' with self.registry.lock(identifier=self.worker_id) as session: for work_spec_name in self.registry.pull(NICE_...
python
def dump(self): '''Print the entire contents of this to debug log messages. This is really only intended for debugging. It could produce a lot of data. ''' with self.registry.lock(identifier=self.worker_id) as session: for work_spec_name in self.registry.pull(NICE_...
[ "def", "dump", "(", "self", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "for", "work_spec_name", "in", "self", ".", "registry", ".", "pull", "(", "NICE_LEVELS", ")...
Print the entire contents of this to debug log messages. This is really only intended for debugging. It could produce a lot of data.
[ "Print", "the", "entire", "contents", "of", "this", "to", "debug", "log", "messages", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L814-L841
243,148
diffeo/rejester
rejester/_task_master.py
TaskMaster.validate_work_spec
def validate_work_spec(cls, work_spec): '''Check that `work_spec` is valid. It must at the very minimum contain a ``name`` and ``min_gb``. :raise rejester.exceptions.ProgrammerError: if it isn't valid ''' if 'name' not in work_spec: raise ProgrammerError('work_spec...
python
def validate_work_spec(cls, work_spec): '''Check that `work_spec` is valid. It must at the very minimum contain a ``name`` and ``min_gb``. :raise rejester.exceptions.ProgrammerError: if it isn't valid ''' if 'name' not in work_spec: raise ProgrammerError('work_spec...
[ "def", "validate_work_spec", "(", "cls", ",", "work_spec", ")", ":", "if", "'name'", "not", "in", "work_spec", ":", "raise", "ProgrammerError", "(", "'work_spec lacks \"name\"'", ")", "if", "'min_gb'", "not", "in", "work_spec", "or", "not", "isinstance", "(", ...
Check that `work_spec` is valid. It must at the very minimum contain a ``name`` and ``min_gb``. :raise rejester.exceptions.ProgrammerError: if it isn't valid
[ "Check", "that", "work_spec", "is", "valid", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L844-L856
243,149
diffeo/rejester
rejester/_task_master.py
TaskMaster.num_available
def num_available(self, work_spec_name): '''Get the number of available work units for some work spec. These are work units that could be returned by :meth:`get_work`: they are not complete, not currently executing, and not blocked on some other work unit. ''' return se...
python
def num_available(self, work_spec_name): '''Get the number of available work units for some work spec. These are work units that could be returned by :meth:`get_work`: they are not complete, not currently executing, and not blocked on some other work unit. ''' return se...
[ "def", "num_available", "(", "self", ",", "work_spec_name", ")", ":", "return", "self", ".", "registry", ".", "len", "(", "WORK_UNITS_", "+", "work_spec_name", ",", "priority_max", "=", "time", ".", "time", "(", ")", ")" ]
Get the number of available work units for some work spec. These are work units that could be returned by :meth:`get_work`: they are not complete, not currently executing, and not blocked on some other work unit.
[ "Get", "the", "number", "of", "available", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L858-L867
243,150
diffeo/rejester
rejester/_task_master.py
TaskMaster.num_pending
def num_pending(self, work_spec_name): '''Get the number of pending work units for some work spec. These are work units that some worker is currently working on (hopefully; it could include work units assigned to workers that died and that have not yet expired). ''' ret...
python
def num_pending(self, work_spec_name): '''Get the number of pending work units for some work spec. These are work units that some worker is currently working on (hopefully; it could include work units assigned to workers that died and that have not yet expired). ''' ret...
[ "def", "num_pending", "(", "self", ",", "work_spec_name", ")", ":", "return", "self", ".", "registry", ".", "len", "(", "WORK_UNITS_", "+", "work_spec_name", ",", "priority_min", "=", "time", ".", "time", "(", ")", ")" ]
Get the number of pending work units for some work spec. These are work units that some worker is currently working on (hopefully; it could include work units assigned to workers that died and that have not yet expired).
[ "Get", "the", "number", "of", "pending", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L869-L878
243,151
diffeo/rejester
rejester/_task_master.py
TaskMaster.num_tasks
def num_tasks(self, work_spec_name): '''Get the total number of work units for some work spec.''' return self.num_finished(work_spec_name) + \ self.num_failed(work_spec_name) + \ self.registry.len(WORK_UNITS_ + work_spec_name)
python
def num_tasks(self, work_spec_name): '''Get the total number of work units for some work spec.''' return self.num_finished(work_spec_name) + \ self.num_failed(work_spec_name) + \ self.registry.len(WORK_UNITS_ + work_spec_name)
[ "def", "num_tasks", "(", "self", ",", "work_spec_name", ")", ":", "return", "self", ".", "num_finished", "(", "work_spec_name", ")", "+", "self", ".", "num_failed", "(", "work_spec_name", ")", "+", "self", ".", "registry", ".", "len", "(", "WORK_UNITS_", "...
Get the total number of work units for some work spec.
[ "Get", "the", "total", "number", "of", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L906-L910
243,152
diffeo/rejester
rejester/_task_master.py
TaskMaster.status
def status(self, work_spec_name): '''Get a summary dictionary for some work spec. The keys are the strings :meth:`num_available`, :meth:`num_pending`, :meth:`num_blocked`, :meth:`num_finished`, :meth:`num_failed`, and :meth:`num_tasks`, and the values are the values returned fro...
python
def status(self, work_spec_name): '''Get a summary dictionary for some work spec. The keys are the strings :meth:`num_available`, :meth:`num_pending`, :meth:`num_blocked`, :meth:`num_finished`, :meth:`num_failed`, and :meth:`num_tasks`, and the values are the values returned fro...
[ "def", "status", "(", "self", ",", "work_spec_name", ")", ":", "return", "dict", "(", "num_available", "=", "self", ".", "num_available", "(", "work_spec_name", ")", ",", "num_pending", "=", "self", ".", "num_pending", "(", "work_spec_name", ")", ",", "num_b...
Get a summary dictionary for some work spec. The keys are the strings :meth:`num_available`, :meth:`num_pending`, :meth:`num_blocked`, :meth:`num_finished`, :meth:`num_failed`, and :meth:`num_tasks`, and the values are the values returned from those functions.
[ "Get", "a", "summary", "dictionary", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L912-L928
243,153
diffeo/rejester
rejester/_task_master.py
TaskMaster.iter_work_specs
def iter_work_specs(self, limit=None, start=None): ''' yield work spec dicts ''' count = 0 ws_list, start = self.list_work_specs(limit, start) while True: for name_spec in ws_list: yield name_spec[1] count += 1 i...
python
def iter_work_specs(self, limit=None, start=None): ''' yield work spec dicts ''' count = 0 ws_list, start = self.list_work_specs(limit, start) while True: for name_spec in ws_list: yield name_spec[1] count += 1 i...
[ "def", "iter_work_specs", "(", "self", ",", "limit", "=", "None", ",", "start", "=", "None", ")", ":", "count", "=", "0", "ws_list", ",", "start", "=", "self", ".", "list_work_specs", "(", "limit", ",", "start", ")", "while", "True", ":", "for", "nam...
yield work spec dicts
[ "yield", "work", "spec", "dicts" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L941-L957
243,154
diffeo/rejester
rejester/_task_master.py
TaskMaster.get_work_spec
def get_work_spec(self, work_spec_name): '''Get the dictionary defining some work spec.''' with self.registry.lock(identifier=self.worker_id) as session: return session.get(WORK_SPECS, work_spec_name)
python
def get_work_spec(self, work_spec_name): '''Get the dictionary defining some work spec.''' with self.registry.lock(identifier=self.worker_id) as session: return session.get(WORK_SPECS, work_spec_name)
[ "def", "get_work_spec", "(", "self", ",", "work_spec_name", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "return", "session", ".", "get", "(", "WORK_SPECS", ",", "wor...
Get the dictionary defining some work spec.
[ "Get", "the", "dictionary", "defining", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L959-L962
243,155
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_work_units
def list_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been completed ("available" or "pending" work units) are included. "...
python
def list_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been completed ("available" or "pending" work units) are included. "...
[ "def", "list_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", ",", "start", "=", "start", ",", "limi...
Get a dictionary of work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been completed ("available" or "pending" work units) are included.
[ "Get", "a", "dictionary", "of", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1017-L1026
243,156
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_available_work_units
def list_available_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of available work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been started, or units that were started but did not comp...
python
def list_available_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of available work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been started, or units that were started but did not comp...
[ "def", "list_available_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", ",", "priority_max", "=", "time"...
Get a dictionary of available work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have not been started, or units that were started but did not complete in a timely fashion, are included.
[ "Get", "a", "dictionary", "of", "available", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1028-L1039
243,157
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_pending_work_units
def list_pending_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of in-progress work units for some work spec. The dictionary is from work unit name to work unit definiton. Units listed here should be worked on by some worker. """ return self.registry...
python
def list_pending_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of in-progress work units for some work spec. The dictionary is from work unit name to work unit definiton. Units listed here should be worked on by some worker. """ return self.registry...
[ "def", "list_pending_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", ",", "priority_min", "=", "time", ...
Get a dictionary of in-progress work units for some work spec. The dictionary is from work unit name to work unit definiton. Units listed here should be worked on by some worker.
[ "Get", "a", "dictionary", "of", "in", "-", "progress", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1041-L1050
243,158
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_blocked_work_units
def list_blocked_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of blocked work units for some work spec. The dictionary is from work unit name to work unit definiton. Work units included in this list are blocked because they were listed as the first work uni...
python
def list_blocked_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of blocked work units for some work spec. The dictionary is from work unit name to work unit definiton. Work units included in this list are blocked because they were listed as the first work uni...
[ "def", "list_blocked_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", "+", "_BLOCKED", ",", "start", "...
Get a dictionary of blocked work units for some work spec. The dictionary is from work unit name to work unit definiton. Work units included in this list are blocked because they were listed as the first work unit in :func:`add_dependent_work_units`, and the work unit(s) they de...
[ "Get", "a", "dictionary", "of", "blocked", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1052-L1065
243,159
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_finished_work_units
def list_finished_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of finished work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have been successfully completed are included. """ ...
python
def list_finished_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of finished work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have been successfully completed are included. """ ...
[ "def", "list_finished_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", "+", "_FINISHED", ",", "start", ...
Get a dictionary of finished work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have been successfully completed are included.
[ "Get", "a", "dictionary", "of", "finished", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1067-L1076
243,160
diffeo/rejester
rejester/_task_master.py
TaskMaster.list_failed_work_units
def list_failed_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of failed work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have completed unsuccessfully are included. """ return self.reg...
python
def list_failed_work_units(self, work_spec_name, start=0, limit=None): """Get a dictionary of failed work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have completed unsuccessfully are included. """ return self.reg...
[ "def", "list_failed_work_units", "(", "self", ",", "work_spec_name", ",", "start", "=", "0", ",", "limit", "=", "None", ")", ":", "return", "self", ".", "registry", ".", "filter", "(", "WORK_UNITS_", "+", "work_spec_name", "+", "_FAILED", ",", "start", "="...
Get a dictionary of failed work units for some work spec. The dictionary is from work unit name to work unit definiton. Only work units that have completed unsuccessfully are included.
[ "Get", "a", "dictionary", "of", "failed", "work", "units", "for", "some", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1078-L1086
243,161
diffeo/rejester
rejester/_task_master.py
TaskMaster._remove_some_work_units
def _remove_some_work_units(self, work_spec_name, work_unit_names, suffix='', priority_min='-inf', priority_max='+inf'): '''Remove some units from somewhere.''' now = time.time() if work_unit_names is None: count = 0 ...
python
def _remove_some_work_units(self, work_spec_name, work_unit_names, suffix='', priority_min='-inf', priority_max='+inf'): '''Remove some units from somewhere.''' now = time.time() if work_unit_names is None: count = 0 ...
[ "def", "_remove_some_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ",", "suffix", "=", "''", ",", "priority_min", "=", "'-inf'", ",", "priority_max", "=", "'+inf'", ")", ":", "now", "=", "time", ".", "time", "(", ")", "if", "work...
Remove some units from somewhere.
[ "Remove", "some", "units", "from", "somewhere", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1088-L1111
243,162
diffeo/rejester
rejester/_task_master.py
TaskMaster.del_work_units
def del_work_units(self, work_spec_name, work_unit_keys=None, state=None, all=False): '''Delete work units from a work spec. The parameters are considered in order as follows: * If `all` is :const:`True`, then all work units in `work_spec_name` are deleted; oth...
python
def del_work_units(self, work_spec_name, work_unit_keys=None, state=None, all=False): '''Delete work units from a work spec. The parameters are considered in order as follows: * If `all` is :const:`True`, then all work units in `work_spec_name` are deleted; oth...
[ "def", "del_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_keys", "=", "None", ",", "state", "=", "None", ",", "all", "=", "False", ")", ":", "count", "=", "0", "if", "(", "state", "is", "None", ")", "or", "(", "state", "==", "AVAIL...
Delete work units from a work spec. The parameters are considered in order as follows: * If `all` is :const:`True`, then all work units in `work_spec_name` are deleted; otherwise * If `state` is not :const:`None`, then all work units in the named state are deleted; otherwis...
[ "Delete", "work", "units", "from", "a", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1113-L1146
243,163
diffeo/rejester
rejester/_task_master.py
TaskMaster.remove_available_work_units
def remove_available_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the available queue. If `work_unit_names` is :const:`None` (which must be passed explicitly), all available work units in `work_spec_name` are removed; otherwise only the specific named ...
python
def remove_available_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the available queue. If `work_unit_names` is :const:`None` (which must be passed explicitly), all available work units in `work_spec_name` are removed; otherwise only the specific named ...
[ "def", "remove_available_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ")", ":", "return", "self", ".", "_remove_some_work_units", "(", "work_spec_name", ",", "work_unit_names", ",", "priority_max", "=", "time", ".", "time", "(", ")", ")...
Remove some work units in the available queue. If `work_unit_names` is :const:`None` (which must be passed explicitly), all available work units in `work_spec_name` are removed; otherwise only the specific named work units will be. :param str work_spec_name: name of the work spec ...
[ "Remove", "some", "work", "units", "in", "the", "available", "queue", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1154-L1168
243,164
diffeo/rejester
rejester/_task_master.py
TaskMaster.remove_pending_work_units
def remove_pending_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the pending list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work un...
python
def remove_pending_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the pending list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work un...
[ "def", "remove_pending_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ")", ":", "return", "self", ".", "_remove_some_work_units", "(", "work_spec_name", ",", "work_unit_names", ",", "priority_min", "=", "time", ".", "time", "(", ")", ")" ...
Remove some work units in the pending list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work units will be. Note that this function has the potential to confuse worker...
[ "Remove", "some", "work", "units", "in", "the", "pending", "list", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1170-L1191
243,165
diffeo/rejester
rejester/_task_master.py
TaskMaster.remove_blocked_work_units
def remove_blocked_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the blocked list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work un...
python
def remove_blocked_work_units(self, work_spec_name, work_unit_names): '''Remove some work units in the blocked list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work un...
[ "def", "remove_blocked_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ")", ":", "return", "self", ".", "_remove_some_work_units", "(", "work_spec_name", ",", "work_unit_names", ",", "suffix", "=", "_BLOCKED", ")" ]
Remove some work units in the blocked list. If `work_unit_names` is :const:`None` (which must be passed explicitly), all pending work units in `work_spec_name` are removed; otherwise only the specific named work units will be. Note that none of the "remove" functions will restart block...
[ "Remove", "some", "work", "units", "in", "the", "blocked", "list", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1193-L1212
243,166
diffeo/rejester
rejester/_task_master.py
TaskMaster.remove_failed_work_units
def remove_failed_work_units(self, work_spec_name, work_unit_names): '''Remove some failed work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all failed work units in `work_spec_name` are removed; otherwise only the specific named work units will be. ...
python
def remove_failed_work_units(self, work_spec_name, work_unit_names): '''Remove some failed work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all failed work units in `work_spec_name` are removed; otherwise only the specific named work units will be. ...
[ "def", "remove_failed_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ")", ":", "return", "self", ".", "_remove_some_work_units", "(", "work_spec_name", ",", "work_unit_names", ",", "suffix", "=", "_FAILED", ")" ]
Remove some failed work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all failed work units in `work_spec_name` are removed; otherwise only the specific named work units will be. Also consider :meth:`retry` to move failed work units back into t...
[ "Remove", "some", "failed", "work", "units", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1214-L1231
243,167
diffeo/rejester
rejester/_task_master.py
TaskMaster.remove_finished_work_units
def remove_finished_work_units(self, work_spec_name, work_unit_names): '''Remove some finished work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all finished work units in `work_spec_name` are removed; otherwise only the specific named work units will ...
python
def remove_finished_work_units(self, work_spec_name, work_unit_names): '''Remove some finished work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all finished work units in `work_spec_name` are removed; otherwise only the specific named work units will ...
[ "def", "remove_finished_work_units", "(", "self", ",", "work_spec_name", ",", "work_unit_names", ")", ":", "return", "self", ".", "_remove_some_work_units", "(", "work_spec_name", ",", "work_unit_names", ",", "suffix", "=", "_FINISHED", ")" ]
Remove some finished work units. If `work_unit_names` is :const:`None` (which must be passed explicitly), all finished work units in `work_spec_name` are removed; otherwise only the specific named work units will be. :param str work_spec_name: name of the work spec :param list ...
[ "Remove", "some", "finished", "work", "units", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1233-L1247
243,168
diffeo/rejester
rejester/_task_master.py
TaskMaster.get_work_unit_status
def get_work_unit_status(self, work_spec_name, work_unit_key): '''Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available``...
python
def get_work_unit_status(self, work_spec_name, work_unit_key): '''Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available``...
[ "def", "get_work_unit_status", "(", "self", ",", "work_spec_name", ",", "work_unit_key", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "# In the available list?", "(", "unit...
Get a high-level status for some work unit. The return value is a dictionary. The only required key is ``status``, which could be any of: ``missing`` The work unit does not exist anywhere ``available`` The work unit is available for new workers; additional ...
[ "Get", "a", "high", "-", "level", "status", "for", "some", "work", "unit", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1249-L1319
243,169
diffeo/rejester
rejester/_task_master.py
TaskMaster.inspect_work_unit
def inspect_work_unit(self, work_spec_name, work_unit_key): '''Get the data for some work unit. Returns the data for that work unit, or `None` if it really can't be found. :param str work_spec_name: name of the work spec :param str work_unit_key: name of the work unit :...
python
def inspect_work_unit(self, work_spec_name, work_unit_key): '''Get the data for some work unit. Returns the data for that work unit, or `None` if it really can't be found. :param str work_spec_name: name of the work spec :param str work_unit_key: name of the work unit :...
[ "def", "inspect_work_unit", "(", "self", ",", "work_spec_name", ",", "work_unit_key", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "work_unit_data", "=", "session", ".", ...
Get the data for some work unit. Returns the data for that work unit, or `None` if it really can't be found. :param str work_spec_name: name of the work spec :param str work_unit_key: name of the work unit :return: definition of the work unit, or `None`
[ "Get", "the", "data", "for", "some", "work", "unit", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1321-L1343
243,170
diffeo/rejester
rejester/_task_master.py
TaskMaster.reset_all
def reset_all(self, work_spec_name): '''Restart a work spec. This calls :meth:`idle_all_workers`, then moves all finished jobs back into the available queue. .. deprecated:: 0.4.5 See :meth:`idle_all_workers` for problems with that method. This also ignores fail...
python
def reset_all(self, work_spec_name): '''Restart a work spec. This calls :meth:`idle_all_workers`, then moves all finished jobs back into the available queue. .. deprecated:: 0.4.5 See :meth:`idle_all_workers` for problems with that method. This also ignores fail...
[ "def", "reset_all", "(", "self", ",", "work_spec_name", ")", ":", "self", ".", "idle_all_workers", "(", ")", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "session", ".", "move_...
Restart a work spec. This calls :meth:`idle_all_workers`, then moves all finished jobs back into the available queue. .. deprecated:: 0.4.5 See :meth:`idle_all_workers` for problems with that method. This also ignores failed jobs and work unit dependencies. ...
[ "Restart", "a", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1349-L1366
243,171
diffeo/rejester
rejester/_task_master.py
TaskMaster.add_dependent_work_units
def add_dependent_work_units(self, work_unit, depends_on, hard=True): """Add work units, where one prevents execution of the other. The two work units may be attached to different work specs, but both must be in this task master's namespace. `work_unit` and `depends_on` are both tuples...
python
def add_dependent_work_units(self, work_unit, depends_on, hard=True): """Add work units, where one prevents execution of the other. The two work units may be attached to different work specs, but both must be in this task master's namespace. `work_unit` and `depends_on` are both tuples...
[ "def", "add_dependent_work_units", "(", "self", ",", "work_unit", ",", "depends_on", ",", "hard", "=", "True", ")", ":", "# There's no good, not-confusing terminology here.", "# I'll call work_unit \"later\" and depends_on \"earlier\"", "# consistently, because that at least makes th...
Add work units, where one prevents execution of the other. The two work units may be attached to different work specs, but both must be in this task master's namespace. `work_unit` and `depends_on` are both tuples of (work spec name, work unit name, work unit dictionary). The work spe...
[ "Add", "work", "units", "where", "one", "prevents", "execution", "of", "the", "other", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1423-L1557
243,172
diffeo/rejester
rejester/_task_master.py
TaskMaster.nice
def nice(self, work_spec_name, nice): '''Change the priority of an existing work spec.''' with self.registry.lock(identifier=self.worker_id) as session: session.update(NICE_LEVELS, dict(work_spec_name=nice))
python
def nice(self, work_spec_name, nice): '''Change the priority of an existing work spec.''' with self.registry.lock(identifier=self.worker_id) as session: session.update(NICE_LEVELS, dict(work_spec_name=nice))
[ "def", "nice", "(", "self", ",", "work_spec_name", ",", "nice", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "session", ".", "update", "(", "NICE_LEVELS", ",", "dic...
Change the priority of an existing work spec.
[ "Change", "the", "priority", "of", "an", "existing", "work", "spec", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1596-L1599
243,173
diffeo/rejester
rejester/_task_master.py
TaskMaster.get_assigned_work_unit
def get_assigned_work_unit(self, worker_id, work_spec_name, work_unit_key): '''get a specific WorkUnit that has already been assigned to a particular worker_id ''' with self.registry.lock(identifier=self.worker_id) as session: assigned_work_unit...
python
def get_assigned_work_unit(self, worker_id, work_spec_name, work_unit_key): '''get a specific WorkUnit that has already been assigned to a particular worker_id ''' with self.registry.lock(identifier=self.worker_id) as session: assigned_work_unit...
[ "def", "get_assigned_work_unit", "(", "self", ",", "worker_id", ",", "work_spec_name", ",", "work_unit_key", ")", ":", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "self", ".", "worker_id", ")", "as", "session", ":", "assigned_work_uni...
get a specific WorkUnit that has already been assigned to a particular worker_id
[ "get", "a", "specific", "WorkUnit", "that", "has", "already", "been", "assigned", "to", "a", "particular", "worker_id" ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1695-L1718
243,174
diffeo/rejester
rejester/_task_master.py
TaskMaster.get_child_work_units
def get_child_work_units(self, worker_id): '''Get work units assigned to a worker's children. Returns a dictionary mapping worker ID to :class:`WorkUnit`. If a child exists but is idle, that worker ID will map to :const:`None`. The work unit may already be expired or assigned t...
python
def get_child_work_units(self, worker_id): '''Get work units assigned to a worker's children. Returns a dictionary mapping worker ID to :class:`WorkUnit`. If a child exists but is idle, that worker ID will map to :const:`None`. The work unit may already be expired or assigned t...
[ "def", "get_child_work_units", "(", "self", ",", "worker_id", ")", ":", "result", "=", "{", "}", "with", "self", ".", "registry", ".", "lock", "(", "identifier", "=", "worker_id", ")", "as", "session", ":", "all_children", "=", "session", ".", "pull", "(...
Get work units assigned to a worker's children. Returns a dictionary mapping worker ID to :class:`WorkUnit`. If a child exists but is idle, that worker ID will map to :const:`None`. The work unit may already be expired or assigned to a different worker; this will be reflected in ...
[ "Get", "work", "units", "assigned", "to", "a", "worker", "s", "children", "." ]
5438a4a18be2801d7826c46e2079ba9639d2ecb4
https://github.com/diffeo/rejester/blob/5438a4a18be2801d7826c46e2079ba9639d2ecb4/rejester/_task_master.py#L1720-L1773
243,175
scivision/histutils
histutils/plotsimul.py
plotPlainImg
def plotPlainImg(sim, cam, rawdata, t, odir): """ No subplots, just a plan http://stackoverflow.com/questions/22408237/named-colors-in-matplotlib """ for R, C in zip(rawdata, cam): fg = figure() ax = fg.gca() ax.set_axis_off() # no ticks ax.imshow(R[t, :, :], ...
python
def plotPlainImg(sim, cam, rawdata, t, odir): """ No subplots, just a plan http://stackoverflow.com/questions/22408237/named-colors-in-matplotlib """ for R, C in zip(rawdata, cam): fg = figure() ax = fg.gca() ax.set_axis_off() # no ticks ax.imshow(R[t, :, :], ...
[ "def", "plotPlainImg", "(", "sim", ",", "cam", ",", "rawdata", ",", "t", ",", "odir", ")", ":", "for", "R", ",", "C", "in", "zip", "(", "rawdata", ",", "cam", ")", ":", "fg", "=", "figure", "(", ")", "ax", "=", "fg", ".", "gca", "(", ")", "...
No subplots, just a plan http://stackoverflow.com/questions/22408237/named-colors-in-matplotlib
[ "No", "subplots", "just", "a", "plan" ]
859a91d3894cb57faed34881c6ea16130b90571e
https://github.com/scivision/histutils/blob/859a91d3894cb57faed34881c6ea16130b90571e/histutils/plotsimul.py#L23-L46
243,176
arcus-io/puppetdb-python
puppetdb/v2/nodes.py
get_nodes
def get_nodes(api_url=None, verify=False, cert=list()): """ Returns info for all Nodes :param api_url: Base PuppetDB API url """ return utils._make_api_request(api_url, '/nodes', verify, cert)
python
def get_nodes(api_url=None, verify=False, cert=list()): """ Returns info for all Nodes :param api_url: Base PuppetDB API url """ return utils._make_api_request(api_url, '/nodes', verify, cert)
[ "def", "get_nodes", "(", "api_url", "=", "None", ",", "verify", "=", "False", ",", "cert", "=", "list", "(", ")", ")", ":", "return", "utils", ".", "_make_api_request", "(", "api_url", ",", "'/nodes'", ",", "verify", ",", "cert", ")" ]
Returns info for all Nodes :param api_url: Base PuppetDB API url
[ "Returns", "info", "for", "all", "Nodes" ]
d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2
https://github.com/arcus-io/puppetdb-python/blob/d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2/puppetdb/v2/nodes.py#L25-L32
243,177
arcus-io/puppetdb-python
puppetdb/v2/nodes.py
get_node
def get_node(api_url=None, node_name=None, verify=False, cert=list()): """ Returns info for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node """ return utils._make_api_request(api_url, '/nodes/{0}'.format(node_name), verify, cert)
python
def get_node(api_url=None, node_name=None, verify=False, cert=list()): """ Returns info for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node """ return utils._make_api_request(api_url, '/nodes/{0}'.format(node_name), verify, cert)
[ "def", "get_node", "(", "api_url", "=", "None", ",", "node_name", "=", "None", ",", "verify", "=", "False", ",", "cert", "=", "list", "(", ")", ")", ":", "return", "utils", ".", "_make_api_request", "(", "api_url", ",", "'/nodes/{0}'", ".", "format", "...
Returns info for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node
[ "Returns", "info", "for", "a", "Node" ]
d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2
https://github.com/arcus-io/puppetdb-python/blob/d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2/puppetdb/v2/nodes.py#L34-L42
243,178
arcus-io/puppetdb-python
puppetdb/v2/nodes.py
get_node_fact_by_name
def get_node_fact_by_name(api_url=None, node_name=None, fact_name=None, verify=False, cert=list()): """ Returns specified fact for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param fact_name: Name of fact """ return utils._make_api_request(api_url, '/nodes/...
python
def get_node_fact_by_name(api_url=None, node_name=None, fact_name=None, verify=False, cert=list()): """ Returns specified fact for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param fact_name: Name of fact """ return utils._make_api_request(api_url, '/nodes/...
[ "def", "get_node_fact_by_name", "(", "api_url", "=", "None", ",", "node_name", "=", "None", ",", "fact_name", "=", "None", ",", "verify", "=", "False", ",", "cert", "=", "list", "(", ")", ")", ":", "return", "utils", ".", "_make_api_request", "(", "api_u...
Returns specified fact for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param fact_name: Name of fact
[ "Returns", "specified", "fact", "for", "a", "Node" ]
d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2
https://github.com/arcus-io/puppetdb-python/blob/d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2/puppetdb/v2/nodes.py#L54-L64
243,179
arcus-io/puppetdb-python
puppetdb/v2/nodes.py
get_node_resource_by_type
def get_node_resource_by_type(api_url=None, node_name=None, type_name=None, verify=False, cert=list()): """ Returns specified resource for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param type_name: Type of resource """ return utils._make_api_request(a...
python
def get_node_resource_by_type(api_url=None, node_name=None, type_name=None, verify=False, cert=list()): """ Returns specified resource for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param type_name: Type of resource """ return utils._make_api_request(a...
[ "def", "get_node_resource_by_type", "(", "api_url", "=", "None", ",", "node_name", "=", "None", ",", "type_name", "=", "None", ",", "verify", "=", "False", ",", "cert", "=", "list", "(", ")", ")", ":", "return", "utils", ".", "_make_api_request", "(", "a...
Returns specified resource for a Node :param api_url: Base PuppetDB API url :param node_name: Name of node :param type_name: Type of resource
[ "Returns", "specified", "resource", "for", "a", "Node" ]
d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2
https://github.com/arcus-io/puppetdb-python/blob/d772eb80a1dfb1154a1f421c7ecdc1ac951b5ea2/puppetdb/v2/nodes.py#L76-L87
243,180
EnigmaBridge/client.py
ebclient/eb_request.py
RequestCall.call
def call(self, request=None, *args, **kwargs): """ Calls multiple time - with retry. :param request: :return: response """ if request is not None: self.request = request retry = self.request.configuration.retry if not isinstance(retry, Simple...
python
def call(self, request=None, *args, **kwargs): """ Calls multiple time - with retry. :param request: :return: response """ if request is not None: self.request = request retry = self.request.configuration.retry if not isinstance(retry, Simple...
[ "def", "call", "(", "self", ",", "request", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "request", "is", "not", "None", ":", "self", ".", "request", "=", "request", "retry", "=", "self", ".", "request", ".", "configurati...
Calls multiple time - with retry. :param request: :return: response
[ "Calls", "multiple", "time", "-", "with", "retry", "." ]
0fafe3902da394da88e9f960751d695ca65bbabd
https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/eb_request.py#L68-L99
243,181
EnigmaBridge/client.py
ebclient/eb_request.py
RequestCall.field_to_long
def field_to_long(value): """ Converts given value to long if possible, otherwise None is returned. :param value: :return: """ if isinstance(value, (int, long)): return long(value) elif isinstance(value, basestring): return bytes_to_long(f...
python
def field_to_long(value): """ Converts given value to long if possible, otherwise None is returned. :param value: :return: """ if isinstance(value, (int, long)): return long(value) elif isinstance(value, basestring): return bytes_to_long(f...
[ "def", "field_to_long", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "long", ")", ")", ":", "return", "long", "(", "value", ")", "elif", "isinstance", "(", "value", ",", "basestring", ")", ":", "return", "bytes_to_lon...
Converts given value to long if possible, otherwise None is returned. :param value: :return:
[ "Converts", "given", "value", "to", "long", "if", "possible", "otherwise", "None", "is", "returned", "." ]
0fafe3902da394da88e9f960751d695ca65bbabd
https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/eb_request.py#L102-L114
243,182
EnigmaBridge/client.py
ebclient/eb_request.py
RequestCall.call_once
def call_once(self, request=None, *args, **kwargs): """ Performs one API request. Raises exception on failure. :param request: :param args: :param kwargs: :return: response """ if request is not None: self.request = request co...
python
def call_once(self, request=None, *args, **kwargs): """ Performs one API request. Raises exception on failure. :param request: :param args: :param kwargs: :return: response """ if request is not None: self.request = request co...
[ "def", "call_once", "(", "self", ",", "request", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "request", "is", "not", "None", ":", "self", ".", "request", "=", "request", "config", "=", "self", ".", "request", ".", "confi...
Performs one API request. Raises exception on failure. :param request: :param args: :param kwargs: :return: response
[ "Performs", "one", "API", "request", ".", "Raises", "exception", "on", "failure", "." ]
0fafe3902da394da88e9f960751d695ca65bbabd
https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/eb_request.py#L149-L172
243,183
EnigmaBridge/client.py
ebclient/eb_request.py
RequestCall.check_response
def check_response(self, resp): """ Checks response after request was made. Checks status of the response, mainly :param resp: :return: """ # For successful API call, response code will be 200 (OK) if resp.ok: json = resp.json() s...
python
def check_response(self, resp): """ Checks response after request was made. Checks status of the response, mainly :param resp: :return: """ # For successful API call, response code will be 200 (OK) if resp.ok: json = resp.json() s...
[ "def", "check_response", "(", "self", ",", "resp", ")", ":", "# For successful API call, response code will be 200 (OK)", "if", "resp", ".", "ok", ":", "json", "=", "resp", ".", "json", "(", ")", "self", ".", "response", "=", "ResponseHolder", "(", ")", "self"...
Checks response after request was made. Checks status of the response, mainly :param resp: :return:
[ "Checks", "response", "after", "request", "was", "made", ".", "Checks", "status", "of", "the", "response", "mainly" ]
0fafe3902da394da88e9f960751d695ca65bbabd
https://github.com/EnigmaBridge/client.py/blob/0fafe3902da394da88e9f960751d695ca65bbabd/ebclient/eb_request.py#L174-L207
243,184
rjw57/throw
throw/minus_renderer.py
create_email
def create_email(filepaths, collection_name): """Create an email message object which implements the email.message.Message interface and which has the files to be shared uploaded to min.us and links placed in the message body. """ gallery = minus.CreateGallery() if collection_name is not None:...
python
def create_email(filepaths, collection_name): """Create an email message object which implements the email.message.Message interface and which has the files to be shared uploaded to min.us and links placed in the message body. """ gallery = minus.CreateGallery() if collection_name is not None:...
[ "def", "create_email", "(", "filepaths", ",", "collection_name", ")", ":", "gallery", "=", "minus", ".", "CreateGallery", "(", ")", "if", "collection_name", "is", "not", "None", ":", "gallery", ".", "SaveGallery", "(", "collection_name", ")", "interface", "=",...
Create an email message object which implements the email.message.Message interface and which has the files to be shared uploaded to min.us and links placed in the message body.
[ "Create", "an", "email", "message", "object", "which", "implements", "the", "email", ".", "message", ".", "Message", "interface", "and", "which", "has", "the", "files", "to", "be", "shared", "uploaded", "to", "min", ".", "us", "and", "links", "placed", "in...
74a7116362ba5b45635ab247472b25cfbdece4ee
https://github.com/rjw57/throw/blob/74a7116362ba5b45635ab247472b25cfbdece4ee/throw/minus_renderer.py#L7-L46
243,185
krukas/Trionyx
trionyx/trionyx/layouts.py
account_overview
def account_overview(object): """Create layout for user profile""" return Layout( Container( Row( Column2( Panel( 'Avatar', Img(src="{}{}".format(settings.MEDIA_URL, object.avatar)), c...
python
def account_overview(object): """Create layout for user profile""" return Layout( Container( Row( Column2( Panel( 'Avatar', Img(src="{}{}".format(settings.MEDIA_URL, object.avatar)), c...
[ "def", "account_overview", "(", "object", ")", ":", "return", "Layout", "(", "Container", "(", "Row", "(", "Column2", "(", "Panel", "(", "'Avatar'", ",", "Img", "(", "src", "=", "\"{}{}\"", ".", "format", "(", "settings", ".", "MEDIA_URL", ",", "object",...
Create layout for user profile
[ "Create", "layout", "for", "user", "profile" ]
edac132cc0797190153f2e60bc7e88cb50e80da6
https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/layouts.py#L15-L39
243,186
zagfai/webtul
webtul/cache.py
Cache.add_exp_key
def add_exp_key(self, key, value, ex): "Expired in seconds" return self.c.set(key, value, ex)
python
def add_exp_key(self, key, value, ex): "Expired in seconds" return self.c.set(key, value, ex)
[ "def", "add_exp_key", "(", "self", ",", "key", ",", "value", ",", "ex", ")", ":", "return", "self", ".", "c", ".", "set", "(", "key", ",", "value", ",", "ex", ")" ]
Expired in seconds
[ "Expired", "in", "seconds" ]
58c49928070b56ef54a45b4af20d800b269ad8ce
https://github.com/zagfai/webtul/blob/58c49928070b56ef54a45b4af20d800b269ad8ce/webtul/cache.py#L50-L52
243,187
Vito2015/pyextend
pyextend/core/itertools.py
unpack
def unpack(iterable, count, fill=None): """ The iter data unpack function. Example 1: In[1]: source = 'abc' In[2]: a, b = safe_unpack(source, 2) In[3]: print(a, b) a b Example 2: In[1]: source = 'abc' In[2]: a, b, c, d = safe_unpack(source, 4) In...
python
def unpack(iterable, count, fill=None): """ The iter data unpack function. Example 1: In[1]: source = 'abc' In[2]: a, b = safe_unpack(source, 2) In[3]: print(a, b) a b Example 2: In[1]: source = 'abc' In[2]: a, b, c, d = safe_unpack(source, 4) In...
[ "def", "unpack", "(", "iterable", ",", "count", ",", "fill", "=", "None", ")", ":", "iterable", "=", "list", "(", "enumerate", "(", "iterable", ")", ")", "cnt", "=", "count", "if", "count", "<=", "len", "(", "iterable", ")", "else", "len", "(", "it...
The iter data unpack function. Example 1: In[1]: source = 'abc' In[2]: a, b = safe_unpack(source, 2) In[3]: print(a, b) a b Example 2: In[1]: source = 'abc' In[2]: a, b, c, d = safe_unpack(source, 4) In[3]: print(a, b, c, d) a b None None
[ "The", "iter", "data", "unpack", "function", "." ]
36861dfe1087e437ffe9b5a1da9345c85b4fa4a1
https://github.com/Vito2015/pyextend/blob/36861dfe1087e437ffe9b5a1da9345c85b4fa4a1/pyextend/core/itertools.py#L19-L41
243,188
CitrineInformatics/dftparse
dftparse/util.py
transpose_list
def transpose_list(list_of_dicts): """Transpose a list of dicts to a dict of lists :param list_of_dicts: to transpose, as in the output from a parse call :return: Dict of lists """ res = {} for d in list_of_dicts: for k, v in d.items(): if k in res: res[k].ap...
python
def transpose_list(list_of_dicts): """Transpose a list of dicts to a dict of lists :param list_of_dicts: to transpose, as in the output from a parse call :return: Dict of lists """ res = {} for d in list_of_dicts: for k, v in d.items(): if k in res: res[k].ap...
[ "def", "transpose_list", "(", "list_of_dicts", ")", ":", "res", "=", "{", "}", "for", "d", "in", "list_of_dicts", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "k", "in", "res", ":", "res", "[", "k", "]", ".", "append...
Transpose a list of dicts to a dict of lists :param list_of_dicts: to transpose, as in the output from a parse call :return: Dict of lists
[ "Transpose", "a", "list", "of", "dicts", "to", "a", "dict", "of", "lists" ]
53a1bf19945cf1c195d6af9beccb3d1b7f4a4c1d
https://github.com/CitrineInformatics/dftparse/blob/53a1bf19945cf1c195d6af9beccb3d1b7f4a4c1d/dftparse/util.py#L10-L23
243,189
JNRowe/jnrbase
jnrbase/debug.py
noisy_wrap
def noisy_wrap(__func: Callable) -> Callable: """Decorator to enable DebugPrint for a given function. Args: __func: Function to wrap Returns: Wrapped function """ # pylint: disable=missing-docstring def wrapper(*args, **kwargs): DebugPrint.enable() try: ...
python
def noisy_wrap(__func: Callable) -> Callable: """Decorator to enable DebugPrint for a given function. Args: __func: Function to wrap Returns: Wrapped function """ # pylint: disable=missing-docstring def wrapper(*args, **kwargs): DebugPrint.enable() try: ...
[ "def", "noisy_wrap", "(", "__func", ":", "Callable", ")", "->", "Callable", ":", "# pylint: disable=missing-docstring", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "DebugPrint", ".", "enable", "(", ")", "try", ":", "__func", "(",...
Decorator to enable DebugPrint for a given function. Args: __func: Function to wrap Returns: Wrapped function
[ "Decorator", "to", "enable", "DebugPrint", "for", "a", "given", "function", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/debug.py#L74-L90
243,190
JNRowe/jnrbase
jnrbase/debug.py
on_enter
def on_enter(__msg: Optional[Union[Callable, str]] = None) -> Callable: """Decorator to display a message when entering a function. Args: __msg: Message to display Returns: Wrapped function """ # pylint: disable=missing-docstring def decorator(__func): @wraps(__func) ...
python
def on_enter(__msg: Optional[Union[Callable, str]] = None) -> Callable: """Decorator to display a message when entering a function. Args: __msg: Message to display Returns: Wrapped function """ # pylint: disable=missing-docstring def decorator(__func): @wraps(__func) ...
[ "def", "on_enter", "(", "__msg", ":", "Optional", "[", "Union", "[", "Callable", ",", "str", "]", "]", "=", "None", ")", "->", "Callable", ":", "# pylint: disable=missing-docstring", "def", "decorator", "(", "__func", ")", ":", "@", "wraps", "(", "__func",...
Decorator to display a message when entering a function. Args: __msg: Message to display Returns: Wrapped function
[ "Decorator", "to", "display", "a", "message", "when", "entering", "a", "function", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/debug.py#L93-L114
243,191
JNRowe/jnrbase
jnrbase/debug.py
DebugPrint.write
def write(self, __text: str) -> None: """Write text to the debug stream. Args: __text: Text to write """ if __text == os.linesep: self.handle.write(__text) else: frame = inspect.currentframe() if frame is None: file...
python
def write(self, __text: str) -> None: """Write text to the debug stream. Args: __text: Text to write """ if __text == os.linesep: self.handle.write(__text) else: frame = inspect.currentframe() if frame is None: file...
[ "def", "write", "(", "self", ",", "__text", ":", "str", ")", "->", "None", ":", "if", "__text", "==", "os", ".", "linesep", ":", "self", ".", "handle", ".", "write", "(", "__text", ")", "else", ":", "frame", "=", "inspect", ".", "currentframe", "("...
Write text to the debug stream. Args: __text: Text to write
[ "Write", "text", "to", "the", "debug", "stream", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/debug.py#L42-L60
243,192
JNRowe/jnrbase
jnrbase/debug.py
DebugPrint.enable
def enable() -> None: """Patch ``sys.stdout`` to use ``DebugPrint``.""" if not isinstance(sys.stdout, DebugPrint): sys.stdout = DebugPrint(sys.stdout)
python
def enable() -> None: """Patch ``sys.stdout`` to use ``DebugPrint``.""" if not isinstance(sys.stdout, DebugPrint): sys.stdout = DebugPrint(sys.stdout)
[ "def", "enable", "(", ")", "->", "None", ":", "if", "not", "isinstance", "(", "sys", ".", "stdout", ",", "DebugPrint", ")", ":", "sys", ".", "stdout", "=", "DebugPrint", "(", "sys", ".", "stdout", ")" ]
Patch ``sys.stdout`` to use ``DebugPrint``.
[ "Patch", "sys", ".", "stdout", "to", "use", "DebugPrint", "." ]
ae505ef69a9feb739b5f4e62c5a8e6533104d3ea
https://github.com/JNRowe/jnrbase/blob/ae505ef69a9feb739b5f4e62c5a8e6533104d3ea/jnrbase/debug.py#L63-L66
243,193
toastdriven/alligator
alligator/workers.py
Worker.starting
def starting(self): """ Prints a startup message to stdout. """ ident = self.ident() print('{} starting & consuming "{}".'.format(ident, self.to_consume)) if self.max_tasks: print('{} will die after {} tasks.'.format(ident, self.max_tasks)) else: ...
python
def starting(self): """ Prints a startup message to stdout. """ ident = self.ident() print('{} starting & consuming "{}".'.format(ident, self.to_consume)) if self.max_tasks: print('{} will die after {} tasks.'.format(ident, self.max_tasks)) else: ...
[ "def", "starting", "(", "self", ")", ":", "ident", "=", "self", ".", "ident", "(", ")", "print", "(", "'{} starting & consuming \"{}\".'", ".", "format", "(", "ident", ",", "self", ".", "to_consume", ")", ")", "if", "self", ".", "max_tasks", ":", "print"...
Prints a startup message to stdout.
[ "Prints", "a", "startup", "message", "to", "stdout", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/workers.py#L55-L65
243,194
toastdriven/alligator
alligator/workers.py
Worker.interrupt
def interrupt(self): """ Prints an interrupt message to stdout. """ ident = self.ident() print('{} for "{}" saw interrupt. Finishing in-progress task.'.format( ident, self.to_consume ))
python
def interrupt(self): """ Prints an interrupt message to stdout. """ ident = self.ident() print('{} for "{}" saw interrupt. Finishing in-progress task.'.format( ident, self.to_consume ))
[ "def", "interrupt", "(", "self", ")", ":", "ident", "=", "self", ".", "ident", "(", ")", "print", "(", "'{} for \"{}\" saw interrupt. Finishing in-progress task.'", ".", "format", "(", "ident", ",", "self", ".", "to_consume", ")", ")" ]
Prints an interrupt message to stdout.
[ "Prints", "an", "interrupt", "message", "to", "stdout", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/workers.py#L67-L75
243,195
toastdriven/alligator
alligator/workers.py
Worker.stopping
def stopping(self): """ Prints a shutdown message to stdout. """ ident = self.ident() print('{} for "{}" shutting down. Consumed {} tasks.'.format( ident, self.to_consume, self.tasks_complete ))
python
def stopping(self): """ Prints a shutdown message to stdout. """ ident = self.ident() print('{} for "{}" shutting down. Consumed {} tasks.'.format( ident, self.to_consume, self.tasks_complete ))
[ "def", "stopping", "(", "self", ")", ":", "ident", "=", "self", ".", "ident", "(", ")", "print", "(", "'{} for \"{}\" shutting down. Consumed {} tasks.'", ".", "format", "(", "ident", ",", "self", ".", "to_consume", ",", "self", ".", "tasks_complete", ")", "...
Prints a shutdown message to stdout.
[ "Prints", "a", "shutdown", "message", "to", "stdout", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/workers.py#L77-L86
243,196
toastdriven/alligator
alligator/workers.py
Worker.run_forever
def run_forever(self): """ Causes the worker to run either forever or until the ``Worker.max_tasks`` are reached. """ self.starting() self.keep_running = True def handle(signum, frame): self.interrupt() self.keep_running = False s...
python
def run_forever(self): """ Causes the worker to run either forever or until the ``Worker.max_tasks`` are reached. """ self.starting() self.keep_running = True def handle(signum, frame): self.interrupt() self.keep_running = False s...
[ "def", "run_forever", "(", "self", ")", ":", "self", ".", "starting", "(", ")", "self", ".", "keep_running", "=", "True", "def", "handle", "(", "signum", ",", "frame", ")", ":", "self", ".", "interrupt", "(", ")", "self", ".", "keep_running", "=", "F...
Causes the worker to run either forever or until the ``Worker.max_tasks`` are reached.
[ "Causes", "the", "worker", "to", "run", "either", "forever", "or", "until", "the", "Worker", ".", "max_tasks", "are", "reached", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/workers.py#L96-L122
243,197
naphatkrit/temp-utils
temp_utils/contextmanagers.py
chdir
def chdir(path): """Change the working directory to `path` for the duration of this context manager. :param str path: The path to change to """ cur_cwd = os.getcwd() os.chdir(path) try: yield finally: os.chdir(cur_cwd)
python
def chdir(path): """Change the working directory to `path` for the duration of this context manager. :param str path: The path to change to """ cur_cwd = os.getcwd() os.chdir(path) try: yield finally: os.chdir(cur_cwd)
[ "def", "chdir", "(", "path", ")", ":", "cur_cwd", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "path", ")", "try", ":", "yield", "finally", ":", "os", ".", "chdir", "(", "cur_cwd", ")" ]
Change the working directory to `path` for the duration of this context manager. :param str path: The path to change to
[ "Change", "the", "working", "directory", "to", "path", "for", "the", "duration", "of", "this", "context", "manager", "." ]
4b0cb5a76fcaa9f3b5db05ed1f5f7a1979a86d2c
https://github.com/naphatkrit/temp-utils/blob/4b0cb5a76fcaa9f3b5db05ed1f5f7a1979a86d2c/temp_utils/contextmanagers.py#L9-L20
243,198
naphatkrit/temp-utils
temp_utils/contextmanagers.py
temp_file
def temp_file(): """Create a temporary file for the duration of this context manager, deleting it afterwards. Yields: str - path to the file """ fd, path = tempfile.mkstemp() os.close(fd) try: yield path finally: os.remove(path)
python
def temp_file(): """Create a temporary file for the duration of this context manager, deleting it afterwards. Yields: str - path to the file """ fd, path = tempfile.mkstemp() os.close(fd) try: yield path finally: os.remove(path)
[ "def", "temp_file", "(", ")", ":", "fd", ",", "path", "=", "tempfile", ".", "mkstemp", "(", ")", "os", ".", "close", "(", "fd", ")", "try", ":", "yield", "path", "finally", ":", "os", ".", "remove", "(", "path", ")" ]
Create a temporary file for the duration of this context manager, deleting it afterwards. Yields: str - path to the file
[ "Create", "a", "temporary", "file", "for", "the", "duration", "of", "this", "context", "manager", "deleting", "it", "afterwards", "." ]
4b0cb5a76fcaa9f3b5db05ed1f5f7a1979a86d2c
https://github.com/naphatkrit/temp-utils/blob/4b0cb5a76fcaa9f3b5db05ed1f5f7a1979a86d2c/temp_utils/contextmanagers.py#L39-L51
243,199
maxfischer2781/chainlet
docs/conf.py
skip_pickle_inject
def skip_pickle_inject(app, what, name, obj, skip, options): """skip global wrapper._raw_slave names used only for pickle support""" if name.endswith('._raw_slave'): return True return None
python
def skip_pickle_inject(app, what, name, obj, skip, options): """skip global wrapper._raw_slave names used only for pickle support""" if name.endswith('._raw_slave'): return True return None
[ "def", "skip_pickle_inject", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "skip", ",", "options", ")", ":", "if", "name", ".", "endswith", "(", "'._raw_slave'", ")", ":", "return", "True", "return", "None" ]
skip global wrapper._raw_slave names used only for pickle support
[ "skip", "global", "wrapper", ".", "_raw_slave", "names", "used", "only", "for", "pickle", "support" ]
4e17f9992b4780bd0d9309202e2847df640bffe8
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/docs/conf.py#L170-L174