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
250,700
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_from_table
def _parse_from_table(html_chunk, what): """ Go thru table data in `html_chunk` and try to locate content of the neighbor cell of the cell containing `what`. Returns: str: Table data or None. """ ean_tag = html_chunk.find("tr", fn=must_contain("th", what, "td")) if not ean_tag: ...
python
def _parse_from_table(html_chunk, what): """ Go thru table data in `html_chunk` and try to locate content of the neighbor cell of the cell containing `what`. Returns: str: Table data or None. """ ean_tag = html_chunk.find("tr", fn=must_contain("th", what, "td")) if not ean_tag: ...
[ "def", "_parse_from_table", "(", "html_chunk", ",", "what", ")", ":", "ean_tag", "=", "html_chunk", ".", "find", "(", "\"tr\"", ",", "fn", "=", "must_contain", "(", "\"th\"", ",", "what", ",", "\"td\"", ")", ")", "if", "not", "ean_tag", ":", "return", ...
Go thru table data in `html_chunk` and try to locate content of the neighbor cell of the cell containing `what`. Returns: str: Table data or None.
[ "Go", "thru", "table", "data", "in", "html_chunk", "and", "try", "to", "locate", "content", "of", "the", "neighbor", "cell", "of", "the", "cell", "containing", "what", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L150-L163
250,701
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
get_publications
def get_publications(): """ Get list of publication offered by cpress.cz. Returns: list: List of :class:`.Publication` objects. """ data = DOWNER.download(URL) dom = dhtmlparser.parseString( handle_encodnig(data) ) book_list = dom.find("div", {"class": "polozka"}) ...
python
def get_publications(): """ Get list of publication offered by cpress.cz. Returns: list: List of :class:`.Publication` objects. """ data = DOWNER.download(URL) dom = dhtmlparser.parseString( handle_encodnig(data) ) book_list = dom.find("div", {"class": "polozka"}) ...
[ "def", "get_publications", "(", ")", ":", "data", "=", "DOWNER", ".", "download", "(", "URL", ")", "dom", "=", "dhtmlparser", ".", "parseString", "(", "handle_encodnig", "(", "data", ")", ")", "book_list", "=", "dom", ".", "find", "(", "\"div\"", ",", ...
Get list of publication offered by cpress.cz. Returns: list: List of :class:`.Publication` objects.
[ "Get", "list", "of", "publication", "offered", "by", "cpress", ".", "cz", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L267-L287
250,702
b3j0f/conf
b3j0f/conf/model/conf.py
Configuration.resolve
def resolve( self, configurable=None, scope=None, safe=None, besteffort=None ): """Resolve all parameters. :param Configurable configurable: configurable to use for foreign parameter resolution. :param dict scope: variables to use for parameter expression evaluation....
python
def resolve( self, configurable=None, scope=None, safe=None, besteffort=None ): """Resolve all parameters. :param Configurable configurable: configurable to use for foreign parameter resolution. :param dict scope: variables to use for parameter expression evaluation....
[ "def", "resolve", "(", "self", ",", "configurable", "=", "None", ",", "scope", "=", "None", ",", "safe", "=", "None", ",", "besteffort", "=", "None", ")", ":", "if", "scope", "is", "None", ":", "scope", "=", "self", ".", "scope", "if", "safe", "is"...
Resolve all parameters. :param Configurable configurable: configurable to use for foreign parameter resolution. :param dict scope: variables to use for parameter expression evaluation. :param bool safe: safe execution (remove builtins functions). :raises: Parameter.Error for...
[ "Resolve", "all", "parameters", "." ]
18dd6d5d6560f9b202793739e2330a2181163511
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/conf.py#L62-L90
250,703
b3j0f/conf
b3j0f/conf/model/conf.py
Configuration.param
def param(self, pname, cname=None, history=0): """Get parameter from a category and history. :param str pname: parameter name. :param str cname: category name. Default is the last registered. :param int history: historical param value from specific category or final paramete...
python
def param(self, pname, cname=None, history=0): """Get parameter from a category and history. :param str pname: parameter name. :param str cname: category name. Default is the last registered. :param int history: historical param value from specific category or final paramete...
[ "def", "param", "(", "self", ",", "pname", ",", "cname", "=", "None", ",", "history", "=", "0", ")", ":", "result", "=", "None", "category", "=", "None", "categories", "=", "[", "]", "# list of categories containing input parameter name", "for", "cat", "in",...
Get parameter from a category and history. :param str pname: parameter name. :param str cname: category name. Default is the last registered. :param int history: historical param value from specific category or final parameter value if cname is not given. For example, if history ...
[ "Get", "parameter", "from", "a", "category", "and", "history", "." ]
18dd6d5d6560f9b202793739e2330a2181163511
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/conf.py#L92-L135
250,704
tomekwojcik/flask-htauth
flask_htauth/htpasswd.py
apache_md5crypt
def apache_md5crypt(password, salt, magic='$apr1$'): """ Calculates the Apache-style MD5 hash of a password """ password = password.encode('utf-8') salt = salt.encode('utf-8') magic = magic.encode('utf-8') m = md5() m.update(password + magic + salt) mixin = md5(password + salt + pa...
python
def apache_md5crypt(password, salt, magic='$apr1$'): """ Calculates the Apache-style MD5 hash of a password """ password = password.encode('utf-8') salt = salt.encode('utf-8') magic = magic.encode('utf-8') m = md5() m.update(password + magic + salt) mixin = md5(password + salt + pa...
[ "def", "apache_md5crypt", "(", "password", ",", "salt", ",", "magic", "=", "'$apr1$'", ")", ":", "password", "=", "password", ".", "encode", "(", "'utf-8'", ")", "salt", "=", "salt", ".", "encode", "(", "'utf-8'", ")", "magic", "=", "magic", ".", "enco...
Calculates the Apache-style MD5 hash of a password
[ "Calculates", "the", "Apache", "-", "style", "MD5", "hash", "of", "a", "password" ]
bb89bee3fa7d88de3147ae338048624e01de710b
https://github.com/tomekwojcik/flask-htauth/blob/bb89bee3fa7d88de3147ae338048624e01de710b/flask_htauth/htpasswd.py#L10-L70
250,705
jut-io/jut-python-tools
jut/api/data_engine.py
get_juttle_data_url
def get_juttle_data_url(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return the juttle data url """ return get_data_url(deployment_name, endpoint_type='juttle', app_url=app_url, ...
python
def get_juttle_data_url(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return the juttle data url """ return get_data_url(deployment_name, endpoint_type='juttle', app_url=app_url, ...
[ "def", "get_juttle_data_url", "(", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "return", "get_data_url", "(", "deployment_name", ",", "endpoint_type", "=", "'juttle'", ",", "app_url", "=", "app...
return the juttle data url
[ "return", "the", "juttle", "data", "url" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L79-L89
250,706
jut-io/jut-python-tools
jut/api/data_engine.py
get_import_data_url
def get_import_data_url(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return the import data url """ return get_data_url(deployment_name, endpoint_type='http-import', app_url=app_url, ...
python
def get_import_data_url(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return the import data url """ return get_data_url(deployment_name, endpoint_type='http-import', app_url=app_url, ...
[ "def", "get_import_data_url", "(", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "return", "get_data_url", "(", "deployment_name", ",", "endpoint_type", "=", "'http-import'", ",", "app_url", "=", ...
return the import data url
[ "return", "the", "import", "data", "url" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L92-L102
250,707
jut-io/jut-python-tools
jut/api/data_engine.py
__wss_connect
def __wss_connect(data_url, token_manager, job_id=None): """ Establish the websocket connection to the data engine. When job_id is provided we're basically establishing a websocket to an existing program that was already started using the jobs API job_id: job id ...
python
def __wss_connect(data_url, token_manager, job_id=None): """ Establish the websocket connection to the data engine. When job_id is provided we're basically establishing a websocket to an existing program that was already started using the jobs API job_id: job id ...
[ "def", "__wss_connect", "(", "data_url", ",", "token_manager", ",", "job_id", "=", "None", ")", ":", "url", "=", "'%s/api/v1/juttle/channel'", "%", "data_url", ".", "replace", "(", "'https://'", ",", "'wss://'", ")", "token_obj", "=", "{", "\"accessToken\"", "...
Establish the websocket connection to the data engine. When job_id is provided we're basically establishing a websocket to an existing program that was already started using the jobs API job_id: job id of a running program
[ "Establish", "the", "websocket", "connection", "to", "the", "data", "engine", ".", "When", "job_id", "is", "provided", "we", "re", "basically", "establishing", "a", "websocket", "to", "an", "existing", "program", "that", "was", "already", "started", "using", "...
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L124-L153
250,708
jut-io/jut-python-tools
jut/api/data_engine.py
connect_job
def connect_job(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL, persist=False, websocket=None, data_url=None): """ connect to a running Juttle program by job_id """ if data_url == Non...
python
def connect_job(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL, persist=False, websocket=None, data_url=None): """ connect to a running Juttle program by job_id """ if data_url == Non...
[ "def", "connect_job", "(", "job_id", ",", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ",", "persist", "=", "False", ",", "websocket", "=", "None", ",", "data_url", "=", "None", ")", ":", "if", "d...
connect to a running Juttle program by job_id
[ "connect", "to", "a", "running", "Juttle", "program", "by", "job_id" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L156-L260
250,709
jut-io/jut-python-tools
jut/api/data_engine.py
get_jobs
def get_jobs(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return list of currently running jobs """ headers = token_manager.get_access_token_headers() data_urls = get_data_urls(deployment_name, app_url=app_url, ...
python
def get_jobs(deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return list of currently running jobs """ headers = token_manager.get_access_token_headers() data_urls = get_data_urls(deployment_name, app_url=app_url, ...
[ "def", "get_jobs", "(", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "headers", "=", "token_manager", ".", "get_access_token_headers", "(", ")", "data_urls", "=", "get_data_urls", "(", "deployme...
return list of currently running jobs
[ "return", "list", "of", "currently", "running", "jobs" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L395-L425
250,710
jut-io/jut-python-tools
jut/api/data_engine.py
get_job_details
def get_job_details(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return job details for a specific job id """ jobs = get_jobs(deployment_name, token_manager=token_manager, ...
python
def get_job_details(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL): """ return job details for a specific job id """ jobs = get_jobs(deployment_name, token_manager=token_manager, ...
[ "def", "get_job_details", "(", "job_id", ",", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "jobs", "=", "get_jobs", "(", "deployment_name", ",", "token_manager", "=", "token_manager", ",", "ap...
return job details for a specific job id
[ "return", "job", "details", "for", "a", "specific", "job", "id" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L428-L445
250,711
jut-io/jut-python-tools
jut/api/data_engine.py
delete_job
def delete_job(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL): """ delete a job with a specific job id """ headers = token_manager.get_access_token_headers() data_url = get_data_url_for_job(job_id, ...
python
def delete_job(job_id, deployment_name, token_manager=None, app_url=defaults.APP_URL): """ delete a job with a specific job id """ headers = token_manager.get_access_token_headers() data_url = get_data_url_for_job(job_id, ...
[ "def", "delete_job", "(", "job_id", ",", "deployment_name", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "headers", "=", "token_manager", ".", "get_access_token_headers", "(", ")", "data_url", "=", "get_data_url_f...
delete a job with a specific job id
[ "delete", "a", "job", "with", "a", "specific", "job", "id" ]
65574d23f51a7bbced9bb25010d02da5ca5d906f
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L448-L466
250,712
abalkin/tz
tzdata-pkg/zic/zic.py
lines
def lines(input): """Remove comments and empty lines""" for raw_line in input: line = raw_line.strip() if line and not line.startswith('#'): yield strip_comments(line)
python
def lines(input): """Remove comments and empty lines""" for raw_line in input: line = raw_line.strip() if line and not line.startswith('#'): yield strip_comments(line)
[ "def", "lines", "(", "input", ")", ":", "for", "raw_line", "in", "input", ":", "line", "=", "raw_line", ".", "strip", "(", ")", "if", "line", "and", "not", "line", ".", "startswith", "(", "'#'", ")", ":", "yield", "strip_comments", "(", "line", ")" ]
Remove comments and empty lines
[ "Remove", "comments", "and", "empty", "lines" ]
f25fca6afbf1abd46fd7aeb978282823c7dab5ab
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tzdata-pkg/zic/zic.py#L20-L25
250,713
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/local.py
Connection.exec_command
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the local host ''' if not self.runner.sudo or not sudoable: if executable: local_cmd = [executable, '-c', cmd] else: local_cmd = cmd ...
python
def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): ''' run a command on the local host ''' if not self.runner.sudo or not sudoable: if executable: local_cmd = [executable, '-c', cmd] else: local_cmd = cmd ...
[ "def", "exec_command", "(", "self", ",", "cmd", ",", "tmp_path", ",", "sudo_user", ",", "sudoable", "=", "False", ",", "executable", "=", "'/bin/sh'", ")", ":", "if", "not", "self", ".", "runner", ".", "sudo", "or", "not", "sudoable", ":", "if", "execu...
run a command on the local host
[ "run", "a", "command", "on", "the", "local", "host" ]
977409929dd81322d886425cdced10608117d5d7
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/local.py#L43-L85
250,714
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/local.py
Connection.put_file
def put_file(self, in_path, out_path): ''' transfer a file from local to local ''' vvv("PUT %s TO %s" % (in_path, out_path), host=self.host) if not os.path.exists(in_path): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) try: shuti...
python
def put_file(self, in_path, out_path): ''' transfer a file from local to local ''' vvv("PUT %s TO %s" % (in_path, out_path), host=self.host) if not os.path.exists(in_path): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) try: shuti...
[ "def", "put_file", "(", "self", ",", "in_path", ",", "out_path", ")", ":", "vvv", "(", "\"PUT %s TO %s\"", "%", "(", "in_path", ",", "out_path", ")", ",", "host", "=", "self", ".", "host", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "i...
transfer a file from local to local
[ "transfer", "a", "file", "from", "local", "to", "local" ]
977409929dd81322d886425cdced10608117d5d7
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/local.py#L87-L100
250,715
lipixun/pymime
src/mime/tools/specxmlparser.py
getPythonVarName
def getPythonVarName(name): """Get the python variable name """ return SUB_REGEX.sub('', name.replace('+', '_').replace('-', '_').replace('.', '_').replace(' ', '').replace('/', '_')).upper()
python
def getPythonVarName(name): """Get the python variable name """ return SUB_REGEX.sub('', name.replace('+', '_').replace('-', '_').replace('.', '_').replace(' ', '').replace('/', '_')).upper()
[ "def", "getPythonVarName", "(", "name", ")", ":", "return", "SUB_REGEX", ".", "sub", "(", "''", ",", "name", ".", "replace", "(", "'+'", ",", "'_'", ")", ".", "replace", "(", "'-'", ",", "'_'", ")", ".", "replace", "(", "'.'", ",", "'_'", ")", "....
Get the python variable name
[ "Get", "the", "python", "variable", "name" ]
4762cf2e51ba80c21d872f26b8e408b6a6863d26
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L56-L59
250,716
lipixun/pymime
src/mime/tools/specxmlparser.py
Parser.parse
def parse(self, text): """Parse the text content """ root = ET.fromstring(text) for elm in root.findall('{http://www.iana.org/assignments}registry'): for record in elm.findall('{http://www.iana.org/assignments}record'): for fileElm in record.findall('{http://w...
python
def parse(self, text): """Parse the text content """ root = ET.fromstring(text) for elm in root.findall('{http://www.iana.org/assignments}registry'): for record in elm.findall('{http://www.iana.org/assignments}record'): for fileElm in record.findall('{http://w...
[ "def", "parse", "(", "self", ",", "text", ")", ":", "root", "=", "ET", ".", "fromstring", "(", "text", ")", "for", "elm", "in", "root", ".", "findall", "(", "'{http://www.iana.org/assignments}registry'", ")", ":", "for", "record", "in", "elm", ".", "find...
Parse the text content
[ "Parse", "the", "text", "content" ]
4762cf2e51ba80c21d872f26b8e408b6a6863d26
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L32-L42
250,717
lipixun/pymime
src/mime/tools/specxmlparser.py
Parser.parsefile
def parsefile(self, filename): """Parse from the file """ with open(filename, 'rb') as fd: return self.parse(fd.read())
python
def parsefile(self, filename): """Parse from the file """ with open(filename, 'rb') as fd: return self.parse(fd.read())
[ "def", "parsefile", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fd", ":", "return", "self", ".", "parse", "(", "fd", ".", "read", "(", ")", ")" ]
Parse from the file
[ "Parse", "from", "the", "file" ]
4762cf2e51ba80c21d872f26b8e408b6a6863d26
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L44-L48
250,718
FujiMakoto/IPS-Vagrant
ips_vagrant/scrapers/login.py
Login.check
def check(self): """ Check if we have an active login session set @rtype: bool """ self.log.debug('Testing for a valid login session') # If our cookie jar is empty, we obviously don't have a valid login session if not len(self.cookiejar): return False ...
python
def check(self): """ Check if we have an active login session set @rtype: bool """ self.log.debug('Testing for a valid login session') # If our cookie jar is empty, we obviously don't have a valid login session if not len(self.cookiejar): return False ...
[ "def", "check", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'Testing for a valid login session'", ")", "# If our cookie jar is empty, we obviously don't have a valid login session", "if", "not", "len", "(", "self", ".", "cookiejar", ")", ":", "retur...
Check if we have an active login session set @rtype: bool
[ "Check", "if", "we", "have", "an", "active", "login", "session", "set" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/scrapers/login.py#L35-L46
250,719
FujiMakoto/IPS-Vagrant
ips_vagrant/scrapers/login.py
Login.process
def process(self, username, password, remember=True): """ Process a login request @type username: str @type password: str @param remember: Save the login session to disk @type remember: bool @raise BadLoginException: Login request failed @...
python
def process(self, username, password, remember=True): """ Process a login request @type username: str @type password: str @param remember: Save the login session to disk @type remember: bool @raise BadLoginException: Login request failed @...
[ "def", "process", "(", "self", ",", "username", ",", "password", ",", "remember", "=", "True", ")", ":", "self", ".", "log", ".", "debug", "(", "'Processing login request'", ")", "self", ".", "browser", ".", "open", "(", "self", ".", "LOGIN_URL", ")", ...
Process a login request @type username: str @type password: str @param remember: Save the login session to disk @type remember: bool @raise BadLoginException: Login request failed @return: Session cookies @rtype: cookielib.LWPCookieJar
[ "Process", "a", "login", "request" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/scrapers/login.py#L48-L94
250,720
WhereSoftwareGoesToDie/pymarquise
marquise/marquise_cffi.py
get_libmarquise_header
def get_libmarquise_header(): """Read the libmarquise header to extract definitions.""" # Header file is packaged in the same place as the rest of the # module. header_path = os.path.join(os.path.dirname(__file__), "marquise.h") with open(header_path) as header: libmarquise_header_lines = he...
python
def get_libmarquise_header(): """Read the libmarquise header to extract definitions.""" # Header file is packaged in the same place as the rest of the # module. header_path = os.path.join(os.path.dirname(__file__), "marquise.h") with open(header_path) as header: libmarquise_header_lines = he...
[ "def", "get_libmarquise_header", "(", ")", ":", "# Header file is packaged in the same place as the rest of the", "# module.", "header_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "\"marquise.h\"", ")...
Read the libmarquise header to extract definitions.
[ "Read", "the", "libmarquise", "header", "to", "extract", "definitions", "." ]
67e52df70c50ed53ad315a64fea430a9567e2b1b
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise_cffi.py#L35-L48
250,721
fred49/linshare-api
linshareapi/user/threads.py
Threads2.head
def head(self, uuid): """ Get one thread.""" url = "%(base)s/%(uuid)s" % { 'base': self.local_base_url, 'uuid': uuid } return self.core.head(url)
python
def head(self, uuid): """ Get one thread.""" url = "%(base)s/%(uuid)s" % { 'base': self.local_base_url, 'uuid': uuid } return self.core.head(url)
[ "def", "head", "(", "self", ",", "uuid", ")", ":", "url", "=", "\"%(base)s/%(uuid)s\"", "%", "{", "'base'", ":", "self", ".", "local_base_url", ",", "'uuid'", ":", "uuid", "}", "return", "self", ".", "core", ".", "head", "(", "url", ")" ]
Get one thread.
[ "Get", "one", "thread", "." ]
be646c25aa8ba3718abb6869c620b157d53d6e41
https://github.com/fred49/linshare-api/blob/be646c25aa8ba3718abb6869c620b157d53d6e41/linshareapi/user/threads.py#L106-L112
250,722
refinery29/chassis
chassis/util/encoders.py
ModelJSONEncoder.default
def default(self, obj): # pylint: disable=method-hidden """Use the default behavior unless the object to be encoded has a `strftime` attribute.""" if hasattr(obj, 'strftime'): return obj.strftime("%Y-%m-%dT%H:%M:%SZ") elif hasattr(obj, 'get_public_dict'): return...
python
def default(self, obj): # pylint: disable=method-hidden """Use the default behavior unless the object to be encoded has a `strftime` attribute.""" if hasattr(obj, 'strftime'): return obj.strftime("%Y-%m-%dT%H:%M:%SZ") elif hasattr(obj, 'get_public_dict'): return...
[ "def", "default", "(", "self", ",", "obj", ")", ":", "# pylint: disable=method-hidden", "if", "hasattr", "(", "obj", ",", "'strftime'", ")", ":", "return", "obj", ".", "strftime", "(", "\"%Y-%m-%dT%H:%M:%SZ\"", ")", "elif", "hasattr", "(", "obj", ",", "'get_...
Use the default behavior unless the object to be encoded has a `strftime` attribute.
[ "Use", "the", "default", "behavior", "unless", "the", "object", "to", "be", "encoded", "has", "a", "strftime", "attribute", "." ]
1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/encoders.py#L9-L18
250,723
fedora-infra/fmn.rules
fmn/rules/taskotron.py
taskotron_task
def taskotron_task(config, message, task=None): """ Particular taskotron task With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task. You can specify several tasks by separating them with a comma ',', i.e.: ``dist.depcheck,dist.r...
python
def taskotron_task(config, message, task=None): """ Particular taskotron task With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task. You can specify several tasks by separating them with a comma ',', i.e.: ``dist.depcheck,dist.r...
[ "def", "taskotron_task", "(", "config", ",", "message", ",", "task", "=", "None", ")", ":", "# We only operate on taskotron messages, first off.", "if", "not", "taskotron_result_new", "(", "config", ",", "message", ")", ":", "return", "False", "if", "not", "task",...
Particular taskotron task With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task. You can specify several tasks by separating them with a comma ',', i.e.: ``dist.depcheck,dist.rpmlint``.
[ "Particular", "taskotron", "task" ]
f9ec790619fcc8b41803077c4dec094e5127fc24
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L15-L33
250,724
fedora-infra/fmn.rules
fmn/rules/taskotron.py
taskotron_changed_outcome
def taskotron_changed_outcome(config, message): """ Taskotron task outcome changed With this rule, you can limit messages to only those task results with changed outcomes. This is useful when an object (a build, an update, etc) gets retested and either the object itself or the environment changes a...
python
def taskotron_changed_outcome(config, message): """ Taskotron task outcome changed With this rule, you can limit messages to only those task results with changed outcomes. This is useful when an object (a build, an update, etc) gets retested and either the object itself or the environment changes a...
[ "def", "taskotron_changed_outcome", "(", "config", ",", "message", ")", ":", "# We only operate on taskotron messages, first off.", "if", "not", "taskotron_result_new", "(", "config", ",", "message", ")", ":", "return", "False", "outcome", "=", "message", "[", "'msg'"...
Taskotron task outcome changed With this rule, you can limit messages to only those task results with changed outcomes. This is useful when an object (a build, an update, etc) gets retested and either the object itself or the environment changes and the task outcome is now different (e.g. FAILED ->...
[ "Taskotron", "task", "outcome", "changed" ]
f9ec790619fcc8b41803077c4dec094e5127fc24
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L37-L54
250,725
fedora-infra/fmn.rules
fmn/rules/taskotron.py
taskotron_task_outcome
def taskotron_task_outcome(config, message, outcome=None): """ Particular taskotron task outcome With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task outcome. You can specify several outcomes by separating them with a comma ',', ...
python
def taskotron_task_outcome(config, message, outcome=None): """ Particular taskotron task outcome With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task outcome. You can specify several outcomes by separating them with a comma ',', ...
[ "def", "taskotron_task_outcome", "(", "config", ",", "message", ",", "outcome", "=", "None", ")", ":", "# We only operate on taskotron messages, first off.", "if", "not", "taskotron_result_new", "(", "config", ",", "message", ")", ":", "return", "False", "if", "not"...
Particular taskotron task outcome With this rule, you can limit messages to only those of particular `taskotron <https://taskotron.fedoraproject.org/>`_ task outcome. You can specify several outcomes by separating them with a comma ',', i.e.: ``PASSED,FAILED``. The full list of supported outcomes...
[ "Particular", "taskotron", "task", "outcome" ]
f9ec790619fcc8b41803077c4dec094e5127fc24
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L58-L80
250,726
fedora-infra/fmn.rules
fmn/rules/taskotron.py
taskotron_release_critical_task
def taskotron_release_critical_task(config, message): """ Release-critical taskotron tasks With this rule, you can limit messages to only those of release-critical `taskotron <https://taskotron.fedoraproject.org/>`_ task. These are the tasks which are deemed extremely important by the distribu...
python
def taskotron_release_critical_task(config, message): """ Release-critical taskotron tasks With this rule, you can limit messages to only those of release-critical `taskotron <https://taskotron.fedoraproject.org/>`_ task. These are the tasks which are deemed extremely important by the distribu...
[ "def", "taskotron_release_critical_task", "(", "config", ",", "message", ")", ":", "# We only operate on taskotron messages, first off.", "if", "not", "taskotron_result_new", "(", "config", ",", "message", ")", ":", "return", "False", "task", "=", "message", "[", "'ms...
Release-critical taskotron tasks With this rule, you can limit messages to only those of release-critical `taskotron <https://taskotron.fedoraproject.org/>`_ task. These are the tasks which are deemed extremely important by the distribution, and their failure should be carefully inspected. Cur...
[ "Release", "-", "critical", "taskotron", "tasks" ]
f9ec790619fcc8b41803077c4dec094e5127fc24
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L108-L127
250,727
abhinav/reversible
reversible/tornado/core.py
execute
def execute(action, io_loop=None): """Execute the given action and return a Future with the result. The ``forwards`` and/or ``backwards`` methods for the action may be synchronous or asynchronous. If asynchronous, that method must return a Future that will resolve to its result. See :py:func:`reve...
python
def execute(action, io_loop=None): """Execute the given action and return a Future with the result. The ``forwards`` and/or ``backwards`` methods for the action may be synchronous or asynchronous. If asynchronous, that method must return a Future that will resolve to its result. See :py:func:`reve...
[ "def", "execute", "(", "action", ",", "io_loop", "=", "None", ")", ":", "if", "not", "io_loop", ":", "io_loop", "=", "IOLoop", ".", "current", "(", ")", "output", "=", "Future", "(", ")", "def", "call", "(", ")", ":", "try", ":", "result", "=", "...
Execute the given action and return a Future with the result. The ``forwards`` and/or ``backwards`` methods for the action may be synchronous or asynchronous. If asynchronous, that method must return a Future that will resolve to its result. See :py:func:`reversible.execute` for more details on the be...
[ "Execute", "the", "given", "action", "and", "return", "a", "Future", "with", "the", "result", "." ]
7e28aaf0390f7d4b889c6ac14d7b340f8f314e89
https://github.com/abhinav/reversible/blob/7e28aaf0390f7d4b889c6ac14d7b340f8f314e89/reversible/tornado/core.py#L79-L112
250,728
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset.add_triple
def add_triple(self, sub, pred=None, obj=None, **kwargs): """ Adds a triple to the dataset args: sub: The subject of the triple or dictionary contaning a triple pred: Optional if supplied in sub, predicate of the triple obj: Opt...
python
def add_triple(self, sub, pred=None, obj=None, **kwargs): """ Adds a triple to the dataset args: sub: The subject of the triple or dictionary contaning a triple pred: Optional if supplied in sub, predicate of the triple obj: Opt...
[ "def", "add_triple", "(", "self", ",", "sub", ",", "pred", "=", "None", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "__set_map__", "(", "*", "*", "kwargs", ")", "strip_orphans", "=", "kwargs", ".", "get", "(", "\"strip_...
Adds a triple to the dataset args: sub: The subject of the triple or dictionary contaning a triple pred: Optional if supplied in sub, predicate of the triple obj: Optional if supplied in sub, object of the triple kwargs: ...
[ "Adds", "a", "triple", "to", "the", "dataset" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L108-L144
250,729
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset.load_data
def load_data(self, data, **kwargs): """ Bulk adds rdf data to the class args: data: the data to be loaded kwargs: strip_orphans: True or False - remove triples that have an orphan blanknode as the object obj_method: "list"...
python
def load_data(self, data, **kwargs): """ Bulk adds rdf data to the class args: data: the data to be loaded kwargs: strip_orphans: True or False - remove triples that have an orphan blanknode as the object obj_method: "list"...
[ "def", "load_data", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "self", ".", "__set_map__", "(", "*", "*", "kwargs", ")", "start", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "log", ".", "debug", "(", "\"Dataload stated\"...
Bulk adds rdf data to the class args: data: the data to be loaded kwargs: strip_orphans: True or False - remove triples that have an orphan blanknode as the object obj_method: "list", or None: if "list" the object of a method ...
[ "Bulk", "adds", "rdf", "data", "to", "the", "class" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L211-L237
250,730
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset.add_rmap_item
def add_rmap_item(self, subj, pred, obj): """ adds a triple to the inverted dataset index """ def add_item(self, subj, pred, obj): try: self.rmap[obj][pred].append(subj) except KeyError: try: self.rmap[obj][pred...
python
def add_rmap_item(self, subj, pred, obj): """ adds a triple to the inverted dataset index """ def add_item(self, subj, pred, obj): try: self.rmap[obj][pred].append(subj) except KeyError: try: self.rmap[obj][pred...
[ "def", "add_rmap_item", "(", "self", ",", "subj", ",", "pred", ",", "obj", ")", ":", "def", "add_item", "(", "self", ",", "subj", ",", "pred", ",", "obj", ")", ":", "try", ":", "self", ".", "rmap", "[", "obj", "]", "[", "pred", "]", ".", "appen...
adds a triple to the inverted dataset index
[ "adds", "a", "triple", "to", "the", "inverted", "dataset", "index" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L327-L344
250,731
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset._generate_classes
def _generate_classes(self, class_types, non_defined, **kwargs): """ creates the class for each class in the data set args: class_types: list of class_types in the dataset non_defined: list of subjects that have no defined class """ # kwargs['dataset'...
python
def _generate_classes(self, class_types, non_defined, **kwargs): """ creates the class for each class in the data set args: class_types: list of class_types in the dataset non_defined: list of subjects that have no defined class """ # kwargs['dataset'...
[ "def", "_generate_classes", "(", "self", ",", "class_types", ",", "non_defined", ",", "*", "*", "kwargs", ")", ":", "# kwargs['dataset'] = self", "for", "class_type", "in", "class_types", ":", "self", "[", "class_type", "[", "self", ".", "smap", "]", "]", "=...
creates the class for each class in the data set args: class_types: list of class_types in the dataset non_defined: list of subjects that have no defined class
[ "creates", "the", "class", "for", "each", "class", "in", "the", "data", "set" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L346-L372
250,732
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset._get_rdfclass
def _get_rdfclass(self, class_type, **kwargs): """ returns the instanticated class from the class list args: class_type: dictionary with rdf_types """ def select_class(class_name): """ finds the class in the rdfclass Module""" try: ...
python
def _get_rdfclass(self, class_type, **kwargs): """ returns the instanticated class from the class list args: class_type: dictionary with rdf_types """ def select_class(class_name): """ finds the class in the rdfclass Module""" try: ...
[ "def", "_get_rdfclass", "(", "self", ",", "class_type", ",", "*", "*", "kwargs", ")", ":", "def", "select_class", "(", "class_name", ")", ":", "\"\"\" finds the class in the rdfclass Module\"\"\"", "try", ":", "return", "getattr", "(", "MODULE", ".", "rdfclass", ...
returns the instanticated class from the class list args: class_type: dictionary with rdf_types
[ "returns", "the", "instanticated", "class", "from", "the", "class", "list" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L374-L418
250,733
shaypal5/utilitime
utilitime/time_interval.py
TimeInterval.from_timedelta
def from_timedelta(cls, datetime_obj, duration): """Create a new TimeInterval object from a start point and a duration. If duration is positive, datetime_obj is the start of the interval; if duration is negative, datetime_obj is the end of the interval. Parameters ---------- ...
python
def from_timedelta(cls, datetime_obj, duration): """Create a new TimeInterval object from a start point and a duration. If duration is positive, datetime_obj is the start of the interval; if duration is negative, datetime_obj is the end of the interval. Parameters ---------- ...
[ "def", "from_timedelta", "(", "cls", ",", "datetime_obj", ",", "duration", ")", ":", "if", "duration", ".", "total_seconds", "(", ")", ">", "0", ":", "return", "TimeInterval", "(", "datetime_obj", ",", "datetime_obj", "+", "duration", ")", "else", ":", "re...
Create a new TimeInterval object from a start point and a duration. If duration is positive, datetime_obj is the start of the interval; if duration is negative, datetime_obj is the end of the interval. Parameters ---------- datetime_obj : datetime.datetime duration : da...
[ "Create", "a", "new", "TimeInterval", "object", "from", "a", "start", "point", "and", "a", "duration", "." ]
554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/time_interval.py#L19-L37
250,734
tomnor/channelpack
channelpack/pullxl.py
_get_startstop
def _get_startstop(sheet, startcell=None, stopcell=None): """ Return two StartStop objects, based on the sheet and startcell and stopcell. sheet: xlrd.sheet.Sheet instance Ready for use. startcell: str or None If given, a spread sheet style notation of the cell where data s...
python
def _get_startstop(sheet, startcell=None, stopcell=None): """ Return two StartStop objects, based on the sheet and startcell and stopcell. sheet: xlrd.sheet.Sheet instance Ready for use. startcell: str or None If given, a spread sheet style notation of the cell where data s...
[ "def", "_get_startstop", "(", "sheet", ",", "startcell", "=", "None", ",", "stopcell", "=", "None", ")", ":", "start", "=", "StartStop", "(", "0", ",", "0", ")", "# row, col", "stop", "=", "StartStop", "(", "sheet", ".", "nrows", ",", "sheet", ".", "...
Return two StartStop objects, based on the sheet and startcell and stopcell. sheet: xlrd.sheet.Sheet instance Ready for use. startcell: str or None If given, a spread sheet style notation of the cell where data start, ("F9"). stopcell: str or None A spread sheet style ...
[ "Return", "two", "StartStop", "objects", "based", "on", "the", "sheet", "and", "startcell", "and", "stopcell", "." ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L88-L120
250,735
tomnor/channelpack
channelpack/pullxl.py
prepread
def prepread(sheet, header=True, startcell=None, stopcell=None): """Return four StartStop objects, defining the outer bounds of header row and data range, respectively. If header is False, the first two items will be None. --> [headstart, headstop, datstart, datstop] sheet: xlrd.sheet.Sheet instan...
python
def prepread(sheet, header=True, startcell=None, stopcell=None): """Return four StartStop objects, defining the outer bounds of header row and data range, respectively. If header is False, the first two items will be None. --> [headstart, headstop, datstart, datstop] sheet: xlrd.sheet.Sheet instan...
[ "def", "prepread", "(", "sheet", ",", "header", "=", "True", ",", "startcell", "=", "None", ",", "stopcell", "=", "None", ")", ":", "datstart", ",", "datstop", "=", "_get_startstop", "(", "sheet", ",", "startcell", ",", "stopcell", ")", "headstart", ",",...
Return four StartStop objects, defining the outer bounds of header row and data range, respectively. If header is False, the first two items will be None. --> [headstart, headstop, datstart, datstop] sheet: xlrd.sheet.Sheet instance Ready for use. header: bool or str True if the d...
[ "Return", "four", "StartStop", "objects", "defining", "the", "outer", "bounds", "of", "header", "row", "and", "data", "range", "respectively", ".", "If", "header", "is", "False", "the", "first", "two", "items", "will", "be", "None", "." ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L123-L185
250,736
tomnor/channelpack
channelpack/pullxl.py
sheetheader
def sheetheader(sheet, startstops, usecols=None): """Return the channel names in a list suitable as an argument to ChannelPack's `set_channel_names` method. Return None if first two StartStops are None. This function is slightly confusing, because it shall be called with the same parameters as shee...
python
def sheetheader(sheet, startstops, usecols=None): """Return the channel names in a list suitable as an argument to ChannelPack's `set_channel_names` method. Return None if first two StartStops are None. This function is slightly confusing, because it shall be called with the same parameters as shee...
[ "def", "sheetheader", "(", "sheet", ",", "startstops", ",", "usecols", "=", "None", ")", ":", "headstart", ",", "headstop", ",", "dstart", ",", "dstop", "=", "startstops", "if", "headstart", "is", "None", ":", "return", "None", "assert", "headstop", ".", ...
Return the channel names in a list suitable as an argument to ChannelPack's `set_channel_names` method. Return None if first two StartStops are None. This function is slightly confusing, because it shall be called with the same parameters as sheet_asdict. But knowing that, it should be convenient. ...
[ "Return", "the", "channel", "names", "in", "a", "list", "suitable", "as", "an", "argument", "to", "ChannelPack", "s", "set_channel_names", "method", ".", "Return", "None", "if", "first", "two", "StartStops", "are", "None", "." ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L188-L226
250,737
tomnor/channelpack
channelpack/pullxl.py
_sanitize_usecols
def _sanitize_usecols(usecols): """Make a tuple of sorted integers and return it. Return None if usecols is None""" if usecols is None: return None try: pats = usecols.split(',') pats = [p.strip() for p in pats if p] except AttributeError: usecols = [int(c) for c in...
python
def _sanitize_usecols(usecols): """Make a tuple of sorted integers and return it. Return None if usecols is None""" if usecols is None: return None try: pats = usecols.split(',') pats = [p.strip() for p in pats if p] except AttributeError: usecols = [int(c) for c in...
[ "def", "_sanitize_usecols", "(", "usecols", ")", ":", "if", "usecols", "is", "None", ":", "return", "None", "try", ":", "pats", "=", "usecols", ".", "split", "(", "','", ")", "pats", "=", "[", "p", ".", "strip", "(", ")", "for", "p", "in", "pats", ...
Make a tuple of sorted integers and return it. Return None if usecols is None
[ "Make", "a", "tuple", "of", "sorted", "integers", "and", "return", "it", ".", "Return", "None", "if", "usecols", "is", "None" ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L353-L381
250,738
tomnor/channelpack
channelpack/pullxl.py
letter2num
def letter2num(letters, zbase=False): """A = 1, C = 3 and so on. Convert spreadsheet style column enumeration to a number. Answers: A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024 >>> from channelpack.pullxl import letter2num >>> letter2num('A') == 1 True >>> letter2num('Z') == ...
python
def letter2num(letters, zbase=False): """A = 1, C = 3 and so on. Convert spreadsheet style column enumeration to a number. Answers: A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024 >>> from channelpack.pullxl import letter2num >>> letter2num('A') == 1 True >>> letter2num('Z') == ...
[ "def", "letter2num", "(", "letters", ",", "zbase", "=", "False", ")", ":", "letters", "=", "letters", ".", "upper", "(", ")", "res", "=", "0", "weight", "=", "len", "(", "letters", ")", "-", "1", "assert", "weight", ">=", "0", ",", "letters", "for"...
A = 1, C = 3 and so on. Convert spreadsheet style column enumeration to a number. Answers: A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024 >>> from channelpack.pullxl import letter2num >>> letter2num('A') == 1 True >>> letter2num('Z') == 26 True >>> letter2num('AZ') == 52 ...
[ "A", "=", "1", "C", "=", "3", "and", "so", "on", ".", "Convert", "spreadsheet", "style", "column", "enumeration", "to", "a", "number", "." ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L384-L419
250,739
tomnor/channelpack
channelpack/pullxl.py
fromxldate
def fromxldate(xldate, datemode=1): """Return a python datetime object xldate: float The xl number. datemode: int 0: 1900-based, 1: 1904-based. See xlrd documentation. """ t = xlrd.xldate_as_tuple(xldate, datemode) return datetime.datetime(*t)
python
def fromxldate(xldate, datemode=1): """Return a python datetime object xldate: float The xl number. datemode: int 0: 1900-based, 1: 1904-based. See xlrd documentation. """ t = xlrd.xldate_as_tuple(xldate, datemode) return datetime.datetime(*t)
[ "def", "fromxldate", "(", "xldate", ",", "datemode", "=", "1", ")", ":", "t", "=", "xlrd", ".", "xldate_as_tuple", "(", "xldate", ",", "datemode", ")", "return", "datetime", ".", "datetime", "(", "*", "t", ")" ]
Return a python datetime object xldate: float The xl number. datemode: int 0: 1900-based, 1: 1904-based. See xlrd documentation.
[ "Return", "a", "python", "datetime", "object" ]
9ad3cd11c698aed4c0fc178385b2ba38a7d0efae
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L435-L446
250,740
kcolford/txt2boil
txt2boil/__init__.py
language
def language(fname, is_ext=False): """Return an instance of the language class that fname is suited for. Searches through the module langs for the class that matches up with fname. If is_ext is True then fname will be taken to be the extension for a language. """ global _langmapping # N...
python
def language(fname, is_ext=False): """Return an instance of the language class that fname is suited for. Searches through the module langs for the class that matches up with fname. If is_ext is True then fname will be taken to be the extension for a language. """ global _langmapping # N...
[ "def", "language", "(", "fname", ",", "is_ext", "=", "False", ")", ":", "global", "_langmapping", "# Normalize the fname so that it looks like an extension.", "if", "is_ext", ":", "fname", "=", "'.'", "+", "fname", "_", ",", "ext", "=", "os", ".", "path", ".",...
Return an instance of the language class that fname is suited for. Searches through the module langs for the class that matches up with fname. If is_ext is True then fname will be taken to be the extension for a language.
[ "Return", "an", "instance", "of", "the", "language", "class", "that", "fname", "is", "suited", "for", "." ]
853a47bb8db27c0224531f24dfd02839c983d027
https://github.com/kcolford/txt2boil/blob/853a47bb8db27c0224531f24dfd02839c983d027/txt2boil/__init__.py#L42-L58
250,741
sys-git/certifiable
certifiable/core.py
certify_text
def certify_text( value, min_length=None, max_length=None, nonprintable=True, required=True, ): """ Certifier for human readable string values. :param unicode value: The string to be certified. :param int min_length: The minimum length of the string. :param int max_length: ...
python
def certify_text( value, min_length=None, max_length=None, nonprintable=True, required=True, ): """ Certifier for human readable string values. :param unicode value: The string to be certified. :param int min_length: The minimum length of the string. :param int max_length: ...
[ "def", "certify_text", "(", "value", ",", "min_length", "=", "None", ",", "max_length", "=", "None", ",", "nonprintable", "=", "True", ",", "required", "=", "True", ",", ")", ":", "certify_params", "(", "(", "_certify_int_param", ",", "'max_length'", ",", ...
Certifier for human readable string values. :param unicode value: The string to be certified. :param int min_length: The minimum length of the string. :param int max_length: The maximum acceptable length for the string. By default, the length is not checked. :param nonprintable:...
[ "Certifier", "for", "human", "readable", "string", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L74-L135
250,742
sys-git/certifiable
certifiable/core.py
certify_int
def certify_int(value, min_value=None, max_value=None, required=True): """ Certifier for integer values. :param six.integer_types value: The number to be certified. :param int min_value: The minimum acceptable value for the number. :param int max_value: The maximum acceptabl...
python
def certify_int(value, min_value=None, max_value=None, required=True): """ Certifier for integer values. :param six.integer_types value: The number to be certified. :param int min_value: The minimum acceptable value for the number. :param int max_value: The maximum acceptabl...
[ "def", "certify_int", "(", "value", ",", "min_value", "=", "None", ",", "max_value", "=", "None", ",", "required", "=", "True", ")", ":", "certify_params", "(", "(", "_certify_int_param", ",", "'max_length'", ",", "max_value", ",", "dict", "(", "negative", ...
Certifier for integer values. :param six.integer_types value: The number to be certified. :param int min_value: The minimum acceptable value for the number. :param int max_value: The maximum acceptable value for the number. :param bool required: Whether the value can be ...
[ "Certifier", "for", "integer", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L204-L253
250,743
sys-git/certifiable
certifiable/core.py
certify_bool
def certify_bool(value, required=True): """ Certifier for boolean values. :param value: The value to be certified. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierTypeError: The type is invalid """ if certify_required( ...
python
def certify_bool(value, required=True): """ Certifier for boolean values. :param value: The value to be certified. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierTypeError: The type is invalid """ if certify_required( ...
[ "def", "certify_bool", "(", "value", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "value", ",", "bool", ")", ":"...
Certifier for boolean values. :param value: The value to be certified. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierTypeError: The type is invalid
[ "Certifier", "for", "boolean", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L310-L333
250,744
sys-git/certifiable
certifiable/core.py
certify_bytes
def certify_bytes(value, min_length=None, max_length=None, required=True): """ Certifier for bytestring values. Should not be used for certifying human readable strings, Please use `certify_string` instead. :param bytes|str value: The string to be certified. :param int min_length: ...
python
def certify_bytes(value, min_length=None, max_length=None, required=True): """ Certifier for bytestring values. Should not be used for certifying human readable strings, Please use `certify_string` instead. :param bytes|str value: The string to be certified. :param int min_length: ...
[ "def", "certify_bytes", "(", "value", ",", "min_length", "=", "None", ",", "max_length", "=", "None", ",", "required", "=", "True", ")", ":", "certify_params", "(", "(", "_certify_int_param", ",", "'min_value'", ",", "min_length", ",", "dict", "(", "negative...
Certifier for bytestring values. Should not be used for certifying human readable strings, Please use `certify_string` instead. :param bytes|str value: The string to be certified. :param int min_length: The minimum length of the string. :param int max_length: The maximum accept...
[ "Certifier", "for", "bytestring", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L337-L390
250,745
sys-git/certifiable
certifiable/core.py
certify_enum
def certify_enum(value, kind=None, required=True): """ Certifier for enum. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierT...
python
def certify_enum(value, kind=None, required=True): """ Certifier for enum. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierT...
[ "def", "certify_enum", "(", "value", ",", "kind", "=", "None", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "val...
Certifier for enum. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierTypeError: The type is invalid
[ "Certifier", "for", "enum", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L394-L419
250,746
sys-git/certifiable
certifiable/core.py
certify_enum_value
def certify_enum_value(value, kind=None, required=True): """ Certifier for enum values. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :rais...
python
def certify_enum_value(value, kind=None, required=True): """ Certifier for enum values. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :rais...
[ "def", "certify_enum_value", "(", "value", ",", "kind", "=", "None", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "try", ":", "kind", "(", "valu...
Certifier for enum values. :param value: The value to be certified. :param kind: The enum type that value should be an instance of. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierValueError: The type is invalid
[ "Certifier", "for", "enum", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L423-L450
250,747
sys-git/certifiable
certifiable/core.py
certify_object
def certify_object(value, kind=None, required=True): """ Certifier for class object. :param object value: The object to certify. :param object kind: The type of the model that the value is expected to evaluate to. :param bool required: Whether the value can be `None`. Defaul...
python
def certify_object(value, kind=None, required=True): """ Certifier for class object. :param object value: The object to certify. :param object kind: The type of the model that the value is expected to evaluate to. :param bool required: Whether the value can be `None`. Defaul...
[ "def", "certify_object", "(", "value", ",", "kind", "=", "None", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "v...
Certifier for class object. :param object value: The object to certify. :param object kind: The type of the model that the value is expected to evaluate to. :param bool required: Whether the value can be `None`. Defaults to True. :raises CertifierTypeError: The type is i...
[ "Certifier", "for", "class", "object", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L454-L491
250,748
sys-git/certifiable
certifiable/core.py
certify_time
def certify_time(value, required=True): """ Certifier for datetime.time values. :param value: The value to be certified. :param bool required: Whether the value can be `None` Defaults to True. :raises CertifierTypeError: The type is invalid """ if certify_required( ...
python
def certify_time(value, required=True): """ Certifier for datetime.time values. :param value: The value to be certified. :param bool required: Whether the value can be `None` Defaults to True. :raises CertifierTypeError: The type is invalid """ if certify_required( ...
[ "def", "certify_time", "(", "value", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "value", ",", "time", ")", ":"...
Certifier for datetime.time values. :param value: The value to be certified. :param bool required: Whether the value can be `None` Defaults to True. :raises CertifierTypeError: The type is invalid
[ "Certifier", "for", "datetime", ".", "time", "values", "." ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L549-L572
250,749
jeremylow/pyshk
pyshk/models.py
User.AsDict
def AsDict(self, dt=True): """ A dict representation of this User instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. Re...
python
def AsDict(self, dt=True): """ A dict representation of this User instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. Re...
[ "def", "AsDict", "(", "self", ",", "dt", "=", "True", ")", ":", "data", "=", "{", "}", "if", "self", ".", "name", ":", "data", "[", "'name'", "]", "=", "self", ".", "name", "data", "[", "'mlkshk_url'", "]", "=", "self", ".", "mlkshk_url", "if", ...
A dict representation of this User instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. Return: A dict representing this User...
[ "A", "dict", "representation", "of", "this", "User", "instance", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L51-L79
250,750
jeremylow/pyshk
pyshk/models.py
User.AsJsonString
def AsJsonString(self): """A JSON string representation of this User instance. Returns: A JSON string representation of this User instance """ return json.dumps(self.AsDict(dt=False), sort_keys=True)
python
def AsJsonString(self): """A JSON string representation of this User instance. Returns: A JSON string representation of this User instance """ return json.dumps(self.AsDict(dt=False), sort_keys=True)
[ "def", "AsJsonString", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "AsDict", "(", "dt", "=", "False", ")", ",", "sort_keys", "=", "True", ")" ]
A JSON string representation of this User instance. Returns: A JSON string representation of this User instance
[ "A", "JSON", "string", "representation", "of", "this", "User", "instance", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L81-L87
250,751
jeremylow/pyshk
pyshk/models.py
User.NewFromJSON
def NewFromJSON(data): """ Create a new User instance from a JSON dict. Args: data (dict): JSON dictionary representing a user. Returns: A User instance. """ if data.get('shakes', None): shakes = [Shake.NewFromJSON(shk) for shk in dat...
python
def NewFromJSON(data): """ Create a new User instance from a JSON dict. Args: data (dict): JSON dictionary representing a user. Returns: A User instance. """ if data.get('shakes', None): shakes = [Shake.NewFromJSON(shk) for shk in dat...
[ "def", "NewFromJSON", "(", "data", ")", ":", "if", "data", ".", "get", "(", "'shakes'", ",", "None", ")", ":", "shakes", "=", "[", "Shake", ".", "NewFromJSON", "(", "shk", ")", "for", "shk", "in", "data", ".", "get", "(", "'shakes'", ")", "]", "e...
Create a new User instance from a JSON dict. Args: data (dict): JSON dictionary representing a user. Returns: A User instance.
[ "Create", "a", "new", "User", "instance", "from", "a", "JSON", "dict", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L90-L111
250,752
jeremylow/pyshk
pyshk/models.py
Comment.AsDict
def AsDict(self, dt=True): """ A dict representation of this Comment instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. ...
python
def AsDict(self, dt=True): """ A dict representation of this Comment instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. ...
[ "def", "AsDict", "(", "self", ",", "dt", "=", "True", ")", ":", "data", "=", "{", "}", "if", "self", ".", "body", ":", "data", "[", "'body'", "]", "=", "self", ".", "body", "if", "self", ".", "posted_at", ":", "data", "[", "'posted_at'", "]", "...
A dict representation of this Comment instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. Return: A dict representing this Com...
[ "A", "dict", "representation", "of", "this", "Comment", "instance", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L159-L181
250,753
jeremylow/pyshk
pyshk/models.py
Comment.NewFromJSON
def NewFromJSON(data): """ Create a new Comment instance from a JSON dict. Args: data (dict): JSON dictionary representing a Comment. Returns: A Comment instance. """ return Comment( body=data.get('body', None), posted_at=...
python
def NewFromJSON(data): """ Create a new Comment instance from a JSON dict. Args: data (dict): JSON dictionary representing a Comment. Returns: A Comment instance. """ return Comment( body=data.get('body', None), posted_at=...
[ "def", "NewFromJSON", "(", "data", ")", ":", "return", "Comment", "(", "body", "=", "data", ".", "get", "(", "'body'", ",", "None", ")", ",", "posted_at", "=", "data", ".", "get", "(", "'posted_at'", ",", "None", ")", ",", "user", "=", "User", ".",...
Create a new Comment instance from a JSON dict. Args: data (dict): JSON dictionary representing a Comment. Returns: A Comment instance.
[ "Create", "a", "new", "Comment", "instance", "from", "a", "JSON", "dict", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L193-L207
250,754
jeremylow/pyshk
pyshk/models.py
Shake.NewFromJSON
def NewFromJSON(data): """ Create a new Shake instance from a JSON dict. Args: data (dict): JSON dictionary representing a Shake. Returns: A Shake instance. """ s = Shake( id=data.get('id', None), name=data.get('name', Non...
python
def NewFromJSON(data): """ Create a new Shake instance from a JSON dict. Args: data (dict): JSON dictionary representing a Shake. Returns: A Shake instance. """ s = Shake( id=data.get('id', None), name=data.get('name', Non...
[ "def", "NewFromJSON", "(", "data", ")", ":", "s", "=", "Shake", "(", "id", "=", "data", ".", "get", "(", "'id'", ",", "None", ")", ",", "name", "=", "data", ".", "get", "(", "'name'", ",", "None", ")", ",", "url", "=", "data", ".", "get", "("...
Create a new Shake instance from a JSON dict. Args: data (dict): JSON dictionary representing a Shake. Returns: A Shake instance.
[ "Create", "a", "new", "Shake", "instance", "from", "a", "JSON", "dict", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L332-L354
250,755
jeremylow/pyshk
pyshk/models.py
SharedFile.NewFromJSON
def NewFromJSON(data): """ Create a new SharedFile instance from a JSON dict. Args: data (dict): JSON dictionary representing a SharedFile. Returns: A SharedFile instance. """ return SharedFile( sharekey=data.get('sharekey', None), ...
python
def NewFromJSON(data): """ Create a new SharedFile instance from a JSON dict. Args: data (dict): JSON dictionary representing a SharedFile. Returns: A SharedFile instance. """ return SharedFile( sharekey=data.get('sharekey', None), ...
[ "def", "NewFromJSON", "(", "data", ")", ":", "return", "SharedFile", "(", "sharekey", "=", "data", ".", "get", "(", "'sharekey'", ",", "None", ")", ",", "name", "=", "data", ".", "get", "(", "'name'", ",", "None", ")", ",", "user", "=", "User", "."...
Create a new SharedFile instance from a JSON dict. Args: data (dict): JSON dictionary representing a SharedFile. Returns: A SharedFile instance.
[ "Create", "a", "new", "SharedFile", "instance", "from", "a", "JSON", "dict", "." ]
3ab92f6706397cde7a18367266eba9e0f1ada868
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L522-L551
250,756
dcramer/peek
peek/collector.py
Collector._start_tracer
def _start_tracer(self, origin): """ Start a new Tracer object, and store it in self.tracers. """ tracer = self._tracer_class(log=self.log) tracer.data = self.data fn = tracer.start(origin) self.tracers.append(tracer) return fn
python
def _start_tracer(self, origin): """ Start a new Tracer object, and store it in self.tracers. """ tracer = self._tracer_class(log=self.log) tracer.data = self.data fn = tracer.start(origin) self.tracers.append(tracer) return fn
[ "def", "_start_tracer", "(", "self", ",", "origin", ")", ":", "tracer", "=", "self", ".", "_tracer_class", "(", "log", "=", "self", ".", "log", ")", "tracer", ".", "data", "=", "self", ".", "data", "fn", "=", "tracer", ".", "start", "(", "origin", ...
Start a new Tracer object, and store it in self.tracers.
[ "Start", "a", "new", "Tracer", "object", "and", "store", "it", "in", "self", ".", "tracers", "." ]
da7c086660fc870c6632c4dc5ccb2ff9bfbee52e
https://github.com/dcramer/peek/blob/da7c086660fc870c6632c4dc5ccb2ff9bfbee52e/peek/collector.py#L22-L30
250,757
dcramer/peek
peek/collector.py
Collector.start
def start(self): """ Start collecting trace information. """ origin = inspect.stack()[1][0] self.reset() # Install the tracer on this thread. self._start_tracer(origin)
python
def start(self): """ Start collecting trace information. """ origin = inspect.stack()[1][0] self.reset() # Install the tracer on this thread. self._start_tracer(origin)
[ "def", "start", "(", "self", ")", ":", "origin", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "0", "]", "self", ".", "reset", "(", ")", "# Install the tracer on this thread.", "self", ".", "_start_tracer", "(", "origin", ")" ]
Start collecting trace information.
[ "Start", "collecting", "trace", "information", "." ]
da7c086660fc870c6632c4dc5ccb2ff9bfbee52e
https://github.com/dcramer/peek/blob/da7c086660fc870c6632c4dc5ccb2ff9bfbee52e/peek/collector.py#L56-L65
250,758
emilssolmanis/tapes
tapes/registry.py
Registry.gauge
def gauge(self, name, producer): """Creates or gets an existing gauge. :param name: The name :return: The created or existing gauge for the given name """ return self._get_or_add_stat(name, functools.partial(Gauge, producer))
python
def gauge(self, name, producer): """Creates or gets an existing gauge. :param name: The name :return: The created or existing gauge for the given name """ return self._get_or_add_stat(name, functools.partial(Gauge, producer))
[ "def", "gauge", "(", "self", ",", "name", ",", "producer", ")", ":", "return", "self", ".", "_get_or_add_stat", "(", "name", ",", "functools", ".", "partial", "(", "Gauge", ",", "producer", ")", ")" ]
Creates or gets an existing gauge. :param name: The name :return: The created or existing gauge for the given name
[ "Creates", "or", "gets", "an", "existing", "gauge", "." ]
7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c
https://github.com/emilssolmanis/tapes/blob/7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c/tapes/registry.py#L83-L89
250,759
emilssolmanis/tapes
tapes/registry.py
Registry.get_stats
def get_stats(self): """Retrieves the current values of the metrics associated with this registry, formatted as a dict. The metrics form a hierarchy, their names are split on '.'. The returned dict is an `addict`, so you can use it as either a regular dict or via attributes, e.g., >>> ...
python
def get_stats(self): """Retrieves the current values of the metrics associated with this registry, formatted as a dict. The metrics form a hierarchy, their names are split on '.'. The returned dict is an `addict`, so you can use it as either a regular dict or via attributes, e.g., >>> ...
[ "def", "get_stats", "(", "self", ")", ":", "def", "_get_value", "(", "stats", ")", ":", "try", ":", "return", "Dict", "(", "(", "k", ",", "_get_value", "(", "v", ")", ")", "for", "k", ",", "v", "in", "stats", ".", "items", "(", ")", ")", "excep...
Retrieves the current values of the metrics associated with this registry, formatted as a dict. The metrics form a hierarchy, their names are split on '.'. The returned dict is an `addict`, so you can use it as either a regular dict or via attributes, e.g., >>> import tapes >>> registr...
[ "Retrieves", "the", "current", "values", "of", "the", "metrics", "associated", "with", "this", "registry", "formatted", "as", "a", "dict", "." ]
7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c
https://github.com/emilssolmanis/tapes/blob/7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c/tapes/registry.py#L107-L130
250,760
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/dev_tools.py
DevToolsManager._populate_ips_versions
def _populate_ips_versions(self): """ Populate IPS version data for mapping @return: """ # Get a map of version ID's from our most recent IPS version ips = IpsManager(self.ctx) ips = ips.dev_version or ips.latest with ZipFile(ips.filepath) as zip: ...
python
def _populate_ips_versions(self): """ Populate IPS version data for mapping @return: """ # Get a map of version ID's from our most recent IPS version ips = IpsManager(self.ctx) ips = ips.dev_version or ips.latest with ZipFile(ips.filepath) as zip: ...
[ "def", "_populate_ips_versions", "(", "self", ")", ":", "# Get a map of version ID's from our most recent IPS version", "ips", "=", "IpsManager", "(", "self", ".", "ctx", ")", "ips", "=", "ips", ".", "dev_version", "or", "ips", ".", "latest", "with", "ZipFile", "(...
Populate IPS version data for mapping @return:
[ "Populate", "IPS", "version", "data", "for", "mapping" ]
7b1d6d095034dd8befb026d9315ecc6494d52269
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/dev_tools.py#L35-L50
250,761
marteinn/genres
genres/db.py
Db.load
def load(data_path): """ Extract data from provided file and return it as a string. """ with open(data_path, "r") as data_file: raw_data = data_file.read() data_file.close() return raw_data
python
def load(data_path): """ Extract data from provided file and return it as a string. """ with open(data_path, "r") as data_file: raw_data = data_file.read() data_file.close() return raw_data
[ "def", "load", "(", "data_path", ")", ":", "with", "open", "(", "data_path", ",", "\"r\"", ")", "as", "data_file", ":", "raw_data", "=", "data_file", ".", "read", "(", ")", "data_file", ".", "close", "(", ")", "return", "raw_data" ]
Extract data from provided file and return it as a string.
[ "Extract", "data", "from", "provided", "file", "and", "return", "it", "as", "a", "string", "." ]
4bbc90f7c2c527631380c08b4d99a4e40abed955
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L28-L36
250,762
marteinn/genres
genres/db.py
Db.parse
def parse(self, data): """ Split and iterate through the datafile to extract genres, tags and points. """ categories = data.split("\n\n") reference = {} reference_points = {} genre_index = [] tag_index = [] for category in categories: ...
python
def parse(self, data): """ Split and iterate through the datafile to extract genres, tags and points. """ categories = data.split("\n\n") reference = {} reference_points = {} genre_index = [] tag_index = [] for category in categories: ...
[ "def", "parse", "(", "self", ",", "data", ")", ":", "categories", "=", "data", ".", "split", "(", "\"\\n\\n\"", ")", "reference", "=", "{", "}", "reference_points", "=", "{", "}", "genre_index", "=", "[", "]", "tag_index", "=", "[", "]", "for", "cate...
Split and iterate through the datafile to extract genres, tags and points.
[ "Split", "and", "iterate", "through", "the", "datafile", "to", "extract", "genres", "tags", "and", "points", "." ]
4bbc90f7c2c527631380c08b4d99a4e40abed955
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L38-L86
250,763
marteinn/genres
genres/db.py
Db._parse_entry
def _parse_entry(entry, limit=10): """ Finds both label and if provided, the points for ranking. """ entry = entry.split(",") label = entry[0] points = limit if len(entry) > 1: proc = float(entry[1].strip()) points = limit * proc ...
python
def _parse_entry(entry, limit=10): """ Finds both label and if provided, the points for ranking. """ entry = entry.split(",") label = entry[0] points = limit if len(entry) > 1: proc = float(entry[1].strip()) points = limit * proc ...
[ "def", "_parse_entry", "(", "entry", ",", "limit", "=", "10", ")", ":", "entry", "=", "entry", ".", "split", "(", "\",\"", ")", "label", "=", "entry", "[", "0", "]", "points", "=", "limit", "if", "len", "(", "entry", ")", ">", "1", ":", "proc", ...
Finds both label and if provided, the points for ranking.
[ "Finds", "both", "label", "and", "if", "provided", "the", "points", "for", "ranking", "." ]
4bbc90f7c2c527631380c08b4d99a4e40abed955
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L89-L102
250,764
minhhoit/yacms
yacms/utils/sites.py
has_site_permission
def has_site_permission(user): """ Checks if a staff user has staff-level access for the current site. The actual permission lookup occurs in ``SitePermissionMiddleware`` which then marks the request with the ``has_site_permission`` flag, so that we only query the db once per request, so this functi...
python
def has_site_permission(user): """ Checks if a staff user has staff-level access for the current site. The actual permission lookup occurs in ``SitePermissionMiddleware`` which then marks the request with the ``has_site_permission`` flag, so that we only query the db once per request, so this functi...
[ "def", "has_site_permission", "(", "user", ")", ":", "mw", "=", "\"yacms.core.middleware.SitePermissionMiddleware\"", "if", "mw", "not", "in", "get_middleware_setting", "(", ")", ":", "from", "warnings", "import", "warn", "warn", "(", "mw", "+", "\" missing from set...
Checks if a staff user has staff-level access for the current site. The actual permission lookup occurs in ``SitePermissionMiddleware`` which then marks the request with the ``has_site_permission`` flag, so that we only query the db once per request, so this function serves as the entry point for everyt...
[ "Checks", "if", "a", "staff", "user", "has", "staff", "-", "level", "access", "for", "the", "current", "site", ".", "The", "actual", "permission", "lookup", "occurs", "in", "SitePermissionMiddleware", "which", "then", "marks", "the", "request", "with", "the", ...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L80-L96
250,765
minhhoit/yacms
yacms/utils/sites.py
host_theme_path
def host_theme_path(): """ Returns the directory of the theme associated with the given host. """ # Set domain to None, which we'll then query for in the first # iteration of HOST_THEMES. We use the current site_id rather # than a request object here, as it may differ for admin users. domai...
python
def host_theme_path(): """ Returns the directory of the theme associated with the given host. """ # Set domain to None, which we'll then query for in the first # iteration of HOST_THEMES. We use the current site_id rather # than a request object here, as it may differ for admin users. domai...
[ "def", "host_theme_path", "(", ")", ":", "# Set domain to None, which we'll then query for in the first", "# iteration of HOST_THEMES. We use the current site_id rather", "# than a request object here, as it may differ for admin users.", "domain", "=", "None", "for", "(", "host", ",", ...
Returns the directory of the theme associated with the given host.
[ "Returns", "the", "directory", "of", "the", "theme", "associated", "with", "the", "given", "host", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L99-L120
250,766
monkeython/scriba
scriba/schemes/data.py
read
def read(url, **args): """Loads an object from a data URI.""" info, data = url.path.split(',') info = data_re.search(info).groupdict() mediatype = info.setdefault('mediatype', 'text/plain;charset=US-ASCII') if ';' in mediatype: mimetype, params = mediatype.split(';', 1) params = [p.s...
python
def read(url, **args): """Loads an object from a data URI.""" info, data = url.path.split(',') info = data_re.search(info).groupdict() mediatype = info.setdefault('mediatype', 'text/plain;charset=US-ASCII') if ';' in mediatype: mimetype, params = mediatype.split(';', 1) params = [p.s...
[ "def", "read", "(", "url", ",", "*", "*", "args", ")", ":", "info", ",", "data", "=", "url", ".", "path", ".", "split", "(", "','", ")", "info", "=", "data_re", ".", "search", "(", "info", ")", ".", "groupdict", "(", ")", "mediatype", "=", "inf...
Loads an object from a data URI.
[ "Loads", "an", "object", "from", "a", "data", "URI", "." ]
fb8e7636ed07c3d035433fdd153599ac8b24dfc4
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/schemes/data.py#L23-L35
250,767
monkeython/scriba
scriba/schemes/data.py
write
def write(url, object_, **args): """Writes an object to a data URI.""" default_content_type = ('text/plain', {'charset': 'US-ASCII'}) content_encoding = args.get('content_encoding', 'base64') content_type, params = args.get('content_type', default_content_type) data = content_types.get(content_type)...
python
def write(url, object_, **args): """Writes an object to a data URI.""" default_content_type = ('text/plain', {'charset': 'US-ASCII'}) content_encoding = args.get('content_encoding', 'base64') content_type, params = args.get('content_type', default_content_type) data = content_types.get(content_type)...
[ "def", "write", "(", "url", ",", "object_", ",", "*", "*", "args", ")", ":", "default_content_type", "=", "(", "'text/plain'", ",", "{", "'charset'", ":", "'US-ASCII'", "}", ")", "content_encoding", "=", "args", ".", "get", "(", "'content_encoding'", ",", ...
Writes an object to a data URI.
[ "Writes", "an", "object", "to", "a", "data", "URI", "." ]
fb8e7636ed07c3d035433fdd153599ac8b24dfc4
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/schemes/data.py#L38-L51
250,768
kodexlab/reliure
reliure/utils/__init__.py
deprecated
def deprecated(new_fct_name, logger=None): """ Decorator to notify that a fct is deprecated """ if logger is None: logger = logging.getLogger("kodex") nfct_name = new_fct_name def aux_deprecated(func): """This is a decorator which can be used to mark functions as deprecated. ...
python
def deprecated(new_fct_name, logger=None): """ Decorator to notify that a fct is deprecated """ if logger is None: logger = logging.getLogger("kodex") nfct_name = new_fct_name def aux_deprecated(func): """This is a decorator which can be used to mark functions as deprecated. ...
[ "def", "deprecated", "(", "new_fct_name", ",", "logger", "=", "None", ")", ":", "if", "logger", "is", "None", ":", "logger", "=", "logging", ".", "getLogger", "(", "\"kodex\"", ")", "nfct_name", "=", "new_fct_name", "def", "aux_deprecated", "(", "func", ")...
Decorator to notify that a fct is deprecated
[ "Decorator", "to", "notify", "that", "a", "fct", "is", "deprecated" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/utils/__init__.py#L52-L71
250,769
gfranxman/utinypass
utinypass/crypto.py
blockgen
def blockgen(bytes, block_size=16): ''' a block generator for pprp ''' for i in range(0, len(bytes), block_size): block = bytes[i:i + block_size] block_len = len(block) if block_len > 0: yield block if block_len < block_size: break
python
def blockgen(bytes, block_size=16): ''' a block generator for pprp ''' for i in range(0, len(bytes), block_size): block = bytes[i:i + block_size] block_len = len(block) if block_len > 0: yield block if block_len < block_size: break
[ "def", "blockgen", "(", "bytes", ",", "block_size", "=", "16", ")", ":", "for", "i", "in", "range", "(", "0", ",", "len", "(", "bytes", ")", ",", "block_size", ")", ":", "block", "=", "bytes", "[", "i", ":", "i", "+", "block_size", "]", "block_le...
a block generator for pprp
[ "a", "block", "generator", "for", "pprp" ]
c49cff25ae408dbbb58ec98d1c87894474011cdf
https://github.com/gfranxman/utinypass/blob/c49cff25ae408dbbb58ec98d1c87894474011cdf/utinypass/crypto.py#L78-L86
250,770
kodexlab/reliure
reliure/utils/log.py
get_basic_logger
def get_basic_logger(level=logging.WARN, scope='reliure'): """ return a basic logger that print on stdout msg from reliure lib """ logger = logging.getLogger(scope) logger.setLevel(level) # create console handler with a higher log level ch = logging.StreamHandler() ch.setLevel(level) # c...
python
def get_basic_logger(level=logging.WARN, scope='reliure'): """ return a basic logger that print on stdout msg from reliure lib """ logger = logging.getLogger(scope) logger.setLevel(level) # create console handler with a higher log level ch = logging.StreamHandler() ch.setLevel(level) # c...
[ "def", "get_basic_logger", "(", "level", "=", "logging", ".", "WARN", ",", "scope", "=", "'reliure'", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "scope", ")", "logger", ".", "setLevel", "(", "level", ")", "# create console handler with a higher...
return a basic logger that print on stdout msg from reliure lib
[ "return", "a", "basic", "logger", "that", "print", "on", "stdout", "msg", "from", "reliure", "lib" ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/utils/log.py#L20-L33
250,771
af/turrentine
turrentine/admin.py
ChangeableContentForm.save
def save(self, *args, **kwargs): """ Save the created_by and last_modified_by fields based on the current admin user. """ if not self.instance.id: self.instance.created_by = self.user self.instance.last_modified_by = self.user return super(ChangeableContentFor...
python
def save(self, *args, **kwargs): """ Save the created_by and last_modified_by fields based on the current admin user. """ if not self.instance.id: self.instance.created_by = self.user self.instance.last_modified_by = self.user return super(ChangeableContentFor...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "instance", ".", "id", ":", "self", ".", "instance", ".", "created_by", "=", "self", ".", "user", "self", ".", "instance", ".", "last_modifie...
Save the created_by and last_modified_by fields based on the current admin user.
[ "Save", "the", "created_by", "and", "last_modified_by", "fields", "based", "on", "the", "current", "admin", "user", "." ]
bbbd5139744ccc6264595cc8960784e5c308c009
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/admin.py#L19-L26
250,772
af/turrentine
turrentine/admin.py
PageAdmin.get_urls
def get_urls(self): """ Add our preview view to our urls. """ urls = super(PageAdmin, self).get_urls() my_urls = patterns('', (r'^add/preview$', self.admin_site.admin_view(PagePreviewView.as_view())), (r'^(?P<id>\d+)/preview$', self.admin_site.admin_view(P...
python
def get_urls(self): """ Add our preview view to our urls. """ urls = super(PageAdmin, self).get_urls() my_urls = patterns('', (r'^add/preview$', self.admin_site.admin_view(PagePreviewView.as_view())), (r'^(?P<id>\d+)/preview$', self.admin_site.admin_view(P...
[ "def", "get_urls", "(", "self", ")", ":", "urls", "=", "super", "(", "PageAdmin", ",", "self", ")", ".", "get_urls", "(", ")", "my_urls", "=", "patterns", "(", "''", ",", "(", "r'^add/preview$'", ",", "self", ".", "admin_site", ".", "admin_view", "(", ...
Add our preview view to our urls.
[ "Add", "our", "preview", "view", "to", "our", "urls", "." ]
bbbd5139744ccc6264595cc8960784e5c308c009
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/admin.py#L101-L111
250,773
af/turrentine
turrentine/admin.py
PagePreviewView.get_template_names
def get_template_names(self): """ Return the page's specified template name, or a fallback if one hasn't been chosen. """ posted_name = self.request.POST.get('template_name') if posted_name: return [posted_name,] else: return super(PagePreviewView,...
python
def get_template_names(self): """ Return the page's specified template name, or a fallback if one hasn't been chosen. """ posted_name = self.request.POST.get('template_name') if posted_name: return [posted_name,] else: return super(PagePreviewView,...
[ "def", "get_template_names", "(", "self", ")", ":", "posted_name", "=", "self", ".", "request", ".", "POST", ".", "get", "(", "'template_name'", ")", "if", "posted_name", ":", "return", "[", "posted_name", ",", "]", "else", ":", "return", "super", "(", "...
Return the page's specified template name, or a fallback if one hasn't been chosen.
[ "Return", "the", "page", "s", "specified", "template", "name", "or", "a", "fallback", "if", "one", "hasn", "t", "been", "chosen", "." ]
bbbd5139744ccc6264595cc8960784e5c308c009
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/admin.py#L135-L143
250,774
af/turrentine
turrentine/admin.py
PagePreviewView.post
def post(self, request, *args, **kwargs): """ Accepts POST requests, and substitute the data in for the page's attributes. """ self.object = self.get_object() self.object.content = request.POST['content'] self.object.title = request.POST['title'] self.object = se...
python
def post(self, request, *args, **kwargs): """ Accepts POST requests, and substitute the data in for the page's attributes. """ self.object = self.get_object() self.object.content = request.POST['content'] self.object.title = request.POST['title'] self.object = se...
[ "def", "post", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "object", "=", "self", ".", "get_object", "(", ")", "self", ".", "object", ".", "content", "=", "request", ".", "POST", "[", "'content'", ...
Accepts POST requests, and substitute the data in for the page's attributes.
[ "Accepts", "POST", "requests", "and", "substitute", "the", "data", "in", "for", "the", "page", "s", "attributes", "." ]
bbbd5139744ccc6264595cc8960784e5c308c009
https://github.com/af/turrentine/blob/bbbd5139744ccc6264595cc8960784e5c308c009/turrentine/admin.py#L145-L155
250,775
hitchtest/hitchserve
hitchserve/service_bundle.py
ServiceBundle.redirect_stdout
def redirect_stdout(self): """Redirect stdout to file so that it can be tailed and aggregated with the other logs.""" self.hijacked_stdout = sys.stdout self.hijacked_stderr = sys.stderr # 0 must be set as the buffer, otherwise lines won't get logged in time. sys.stdout = open(sel...
python
def redirect_stdout(self): """Redirect stdout to file so that it can be tailed and aggregated with the other logs.""" self.hijacked_stdout = sys.stdout self.hijacked_stderr = sys.stderr # 0 must be set as the buffer, otherwise lines won't get logged in time. sys.stdout = open(sel...
[ "def", "redirect_stdout", "(", "self", ")", ":", "self", ".", "hijacked_stdout", "=", "sys", ".", "stdout", "self", ".", "hijacked_stderr", "=", "sys", ".", "stderr", "# 0 must be set as the buffer, otherwise lines won't get logged in time.", "sys", ".", "stdout", "="...
Redirect stdout to file so that it can be tailed and aggregated with the other logs.
[ "Redirect", "stdout", "to", "file", "so", "that", "it", "can", "be", "tailed", "and", "aggregated", "with", "the", "other", "logs", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_bundle.py#L202-L208
250,776
hitchtest/hitchserve
hitchserve/service_bundle.py
ServiceBundle.unredirect_stdout
def unredirect_stdout(self): """Redirect stdout and stderr back to screen.""" if hasattr(self, 'hijacked_stdout') and hasattr(self, 'hijacked_stderr'): sys.stdout = self.hijacked_stdout sys.stderr = self.hijacked_stderr
python
def unredirect_stdout(self): """Redirect stdout and stderr back to screen.""" if hasattr(self, 'hijacked_stdout') and hasattr(self, 'hijacked_stderr'): sys.stdout = self.hijacked_stdout sys.stderr = self.hijacked_stderr
[ "def", "unredirect_stdout", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'hijacked_stdout'", ")", "and", "hasattr", "(", "self", ",", "'hijacked_stderr'", ")", ":", "sys", ".", "stdout", "=", "self", ".", "hijacked_stdout", "sys", ".", "stder...
Redirect stdout and stderr back to screen.
[ "Redirect", "stdout", "and", "stderr", "back", "to", "screen", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_bundle.py#L210-L214
250,777
hitchtest/hitchserve
hitchserve/service_bundle.py
ServiceBundle.time_travel
def time_travel(self, datetime=None, timedelta=None, seconds=0, minutes=0, hours=0, days=0): """Mock moving forward or backward in time by shifting the system clock fed to the services tested. Note that all of these arguments can be used together, individually or not at all. The time traveled t...
python
def time_travel(self, datetime=None, timedelta=None, seconds=0, minutes=0, hours=0, days=0): """Mock moving forward or backward in time by shifting the system clock fed to the services tested. Note that all of these arguments can be used together, individually or not at all. The time traveled t...
[ "def", "time_travel", "(", "self", ",", "datetime", "=", "None", ",", "timedelta", "=", "None", ",", "seconds", "=", "0", ",", "minutes", "=", "0", ",", "hours", "=", "0", ",", "days", "=", "0", ")", ":", "if", "datetime", "is", "not", "None", ":...
Mock moving forward or backward in time by shifting the system clock fed to the services tested. Note that all of these arguments can be used together, individually or not at all. The time traveled to will be the sum of all specified time deltas from datetime. If no datetime is specified, the d...
[ "Mock", "moving", "forward", "or", "backward", "in", "time", "by", "shifting", "the", "system", "clock", "fed", "to", "the", "services", "tested", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_bundle.py#L261-L285
250,778
hitchtest/hitchserve
hitchserve/service_bundle.py
ServiceBundle.wait_for_ipykernel
def wait_for_ipykernel(self, service_name, timeout=10): """Wait for an IPython kernel-nnnn.json filename message to appear in log.""" kernel_line = self._services[service_name].logs.tail.until( lambda line: "--existing" in line[1], timeout=10, lines_back=5 ) return kernel_lin...
python
def wait_for_ipykernel(self, service_name, timeout=10): """Wait for an IPython kernel-nnnn.json filename message to appear in log.""" kernel_line = self._services[service_name].logs.tail.until( lambda line: "--existing" in line[1], timeout=10, lines_back=5 ) return kernel_lin...
[ "def", "wait_for_ipykernel", "(", "self", ",", "service_name", ",", "timeout", "=", "10", ")", ":", "kernel_line", "=", "self", ".", "_services", "[", "service_name", "]", ".", "logs", ".", "tail", ".", "until", "(", "lambda", "line", ":", "\"--existing\""...
Wait for an IPython kernel-nnnn.json filename message to appear in log.
[ "Wait", "for", "an", "IPython", "kernel", "-", "nnnn", ".", "json", "filename", "message", "to", "appear", "in", "log", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_bundle.py#L294-L299
250,779
hitchtest/hitchserve
hitchserve/service_bundle.py
ServiceBundle.connect_to_ipykernel
def connect_to_ipykernel(self, service_name, timeout=10): """Connect to an IPython kernel as soon as its message is logged.""" kernel_json_file = self.wait_for_ipykernel(service_name, timeout=10) self.start_interactive_mode() subprocess.check_call([ sys.executable, "-m", "IPy...
python
def connect_to_ipykernel(self, service_name, timeout=10): """Connect to an IPython kernel as soon as its message is logged.""" kernel_json_file = self.wait_for_ipykernel(service_name, timeout=10) self.start_interactive_mode() subprocess.check_call([ sys.executable, "-m", "IPy...
[ "def", "connect_to_ipykernel", "(", "self", ",", "service_name", ",", "timeout", "=", "10", ")", ":", "kernel_json_file", "=", "self", ".", "wait_for_ipykernel", "(", "service_name", ",", "timeout", "=", "10", ")", "self", ".", "start_interactive_mode", "(", "...
Connect to an IPython kernel as soon as its message is logged.
[ "Connect", "to", "an", "IPython", "kernel", "as", "soon", "as", "its", "message", "is", "logged", "." ]
a2def19979264186d283e76f7f0c88f3ed97f2e0
https://github.com/hitchtest/hitchserve/blob/a2def19979264186d283e76f7f0c88f3ed97f2e0/hitchserve/service_bundle.py#L301-L308
250,780
EventTeam/beliefs
src/beliefs/referent.py
TaxonomyCell.build_class_graph
def build_class_graph(modules, klass=None, graph=None): """ Builds up a graph of the DictCell subclass structure """ if klass is None: class_graph = nx.DiGraph() for name, classmember in inspect.getmembers(modules, inspect.isclass): if issubclass(classmember, Refe...
python
def build_class_graph(modules, klass=None, graph=None): """ Builds up a graph of the DictCell subclass structure """ if klass is None: class_graph = nx.DiGraph() for name, classmember in inspect.getmembers(modules, inspect.isclass): if issubclass(classmember, Refe...
[ "def", "build_class_graph", "(", "modules", ",", "klass", "=", "None", ",", "graph", "=", "None", ")", ":", "if", "klass", "is", "None", ":", "class_graph", "=", "nx", ".", "DiGraph", "(", ")", "for", "name", ",", "classmember", "in", "inspect", ".", ...
Builds up a graph of the DictCell subclass structure
[ "Builds", "up", "a", "graph", "of", "the", "DictCell", "subclass", "structure" ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/referent.py#L45-L62
250,781
EventTeam/beliefs
src/beliefs/referent.py
Referent.cells_from_defaults
def cells_from_defaults(clz, jsonobj): """ Creates a referent instance of type `json.kind` and initializes it to default values. """ # convert strings to dicts if isinstance(jsonobj, (str, unicode)): jsonobj = json.loads(jsonobj) assert 'cells' in js...
python
def cells_from_defaults(clz, jsonobj): """ Creates a referent instance of type `json.kind` and initializes it to default values. """ # convert strings to dicts if isinstance(jsonobj, (str, unicode)): jsonobj = json.loads(jsonobj) assert 'cells' in js...
[ "def", "cells_from_defaults", "(", "clz", ",", "jsonobj", ")", ":", "# convert strings to dicts", "if", "isinstance", "(", "jsonobj", ",", "(", "str", ",", "unicode", ")", ")", ":", "jsonobj", "=", "json", ".", "loads", "(", "jsonobj", ")", "assert", "'cel...
Creates a referent instance of type `json.kind` and initializes it to default values.
[ "Creates", "a", "referent", "instance", "of", "type", "json", ".", "kind", "and", "initializes", "it", "to", "default", "values", "." ]
c07d22b61bebeede74a72800030dde770bf64208
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/referent.py#L75-L96
250,782
Ffisegydd/whatis
whatis/_iterable.py
get_element_types
def get_element_types(obj, **kwargs): """Get element types as a set.""" max_iterable_length = kwargs.get('max_iterable_length', 10000) consume_generator = kwargs.get('consume_generator', False) if not isiterable(obj): return None if isgenerator(obj) and not consume_generator: retu...
python
def get_element_types(obj, **kwargs): """Get element types as a set.""" max_iterable_length = kwargs.get('max_iterable_length', 10000) consume_generator = kwargs.get('consume_generator', False) if not isiterable(obj): return None if isgenerator(obj) and not consume_generator: retu...
[ "def", "get_element_types", "(", "obj", ",", "*", "*", "kwargs", ")", ":", "max_iterable_length", "=", "kwargs", ".", "get", "(", "'max_iterable_length'", ",", "10000", ")", "consume_generator", "=", "kwargs", ".", "get", "(", "'consume_generator'", ",", "Fals...
Get element types as a set.
[ "Get", "element", "types", "as", "a", "set", "." ]
eef780ced61aae6d001aeeef7574e5e27e613583
https://github.com/Ffisegydd/whatis/blob/eef780ced61aae6d001aeeef7574e5e27e613583/whatis/_iterable.py#L37-L57
250,783
xtrementl/focus
focus/plugin/modules/stats.py
Stats._setup_dir
def _setup_dir(self, base_dir): """ Creates stats directory for storing stat files. `base_dir` Base directory. """ stats_dir = self._sdir(base_dir) if not os.path.isdir(stats_dir): try: os.mkdir(stats_dir) except O...
python
def _setup_dir(self, base_dir): """ Creates stats directory for storing stat files. `base_dir` Base directory. """ stats_dir = self._sdir(base_dir) if not os.path.isdir(stats_dir): try: os.mkdir(stats_dir) except O...
[ "def", "_setup_dir", "(", "self", ",", "base_dir", ")", ":", "stats_dir", "=", "self", ".", "_sdir", "(", "base_dir", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "stats_dir", ")", ":", "try", ":", "os", ".", "mkdir", "(", "stats_dir", "...
Creates stats directory for storing stat files. `base_dir` Base directory.
[ "Creates", "stats", "directory", "for", "storing", "stat", "files", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/stats.py#L40-L52
250,784
xtrementl/focus
focus/plugin/modules/stats.py
Stats._log_task
def _log_task(self, task): """ Logs task record to file. `task` ``Task`` instance. """ if not task.duration: return self._setup_dir(task.base_dir) stats_dir = self._sdir(task.base_dir) duration = task.duration while d...
python
def _log_task(self, task): """ Logs task record to file. `task` ``Task`` instance. """ if not task.duration: return self._setup_dir(task.base_dir) stats_dir = self._sdir(task.base_dir) duration = task.duration while d...
[ "def", "_log_task", "(", "self", ",", "task", ")", ":", "if", "not", "task", ".", "duration", ":", "return", "self", ".", "_setup_dir", "(", "task", ".", "base_dir", ")", "stats_dir", "=", "self", ".", "_sdir", "(", "task", ".", "base_dir", ")", "dur...
Logs task record to file. `task` ``Task`` instance.
[ "Logs", "task", "record", "to", "file", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/stats.py#L54-L112
250,785
xtrementl/focus
focus/plugin/modules/stats.py
Stats._fuzzy_time_parse
def _fuzzy_time_parse(self, value): """ Parses a fuzzy time value into a meaningful interpretation. `value` String value to parse. """ value = value.lower().strip() today = datetime.date.today() if value in ('today', 't'): return tod...
python
def _fuzzy_time_parse(self, value): """ Parses a fuzzy time value into a meaningful interpretation. `value` String value to parse. """ value = value.lower().strip() today = datetime.date.today() if value in ('today', 't'): return tod...
[ "def", "_fuzzy_time_parse", "(", "self", ",", "value", ")", ":", "value", "=", "value", ".", "lower", "(", ")", ".", "strip", "(", ")", "today", "=", "datetime", ".", "date", ".", "today", "(", ")", "if", "value", "in", "(", "'today'", ",", "'t'", ...
Parses a fuzzy time value into a meaningful interpretation. `value` String value to parse.
[ "Parses", "a", "fuzzy", "time", "value", "into", "a", "meaningful", "interpretation", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/stats.py#L114-L152
250,786
xtrementl/focus
focus/plugin/modules/stats.py
Stats._get_stats
def _get_stats(self, task, start_date): """ Fetches statistic information for given task and start range. """ stats = [] stats_dir = self._sdir(task.base_dir) date = start_date end_date = datetime.date.today() delta = datetime.timedelta(days=1) while...
python
def _get_stats(self, task, start_date): """ Fetches statistic information for given task and start range. """ stats = [] stats_dir = self._sdir(task.base_dir) date = start_date end_date = datetime.date.today() delta = datetime.timedelta(days=1) while...
[ "def", "_get_stats", "(", "self", ",", "task", ",", "start_date", ")", ":", "stats", "=", "[", "]", "stats_dir", "=", "self", ".", "_sdir", "(", "task", ".", "base_dir", ")", "date", "=", "start_date", "end_date", "=", "datetime", ".", "date", ".", "...
Fetches statistic information for given task and start range.
[ "Fetches", "statistic", "information", "for", "given", "task", "and", "start", "range", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/stats.py#L154-L184
250,787
xtrementl/focus
focus/plugin/modules/stats.py
Stats._print_stats
def _print_stats(self, env, stats): """ Prints statistic information using io stream. `env` ``Environment`` object. `stats` Tuple of task stats for each date. """ def _format_time(mins): """ Generates formatted time string...
python
def _print_stats(self, env, stats): """ Prints statistic information using io stream. `env` ``Environment`` object. `stats` Tuple of task stats for each date. """ def _format_time(mins): """ Generates formatted time string...
[ "def", "_print_stats", "(", "self", ",", "env", ",", "stats", ")", ":", "def", "_format_time", "(", "mins", ")", ":", "\"\"\" Generates formatted time string.\n \"\"\"", "mins", "=", "int", "(", "mins", ")", "if", "mins", "<", "MINS_IN_HOUR", ":",...
Prints statistic information using io stream. `env` ``Environment`` object. `stats` Tuple of task stats for each date.
[ "Prints", "statistic", "information", "using", "io", "stream", "." ]
cbbbc0b49a7409f9e0dc899de5b7e057f50838e4
https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/plugin/modules/stats.py#L186-L239
250,788
rich-pixley/rain
rain/__init__.py
WorkSpace.create
def create(self): """called to create the work space""" self.logger.log(logging.DEBUG, 'os.mkdir %s', self.name) os.mkdir(self.name)
python
def create(self): """called to create the work space""" self.logger.log(logging.DEBUG, 'os.mkdir %s', self.name) os.mkdir(self.name)
[ "def", "create", "(", "self", ")", ":", "self", ".", "logger", ".", "log", "(", "logging", ".", "DEBUG", ",", "'os.mkdir %s'", ",", "self", ".", "name", ")", "os", ".", "mkdir", "(", "self", ".", "name", ")" ]
called to create the work space
[ "called", "to", "create", "the", "work", "space" ]
ed95aafc73002fbf0466be9a5eaa1e6ed3990a6d
https://github.com/rich-pixley/rain/blob/ed95aafc73002fbf0466be9a5eaa1e6ed3990a6d/rain/__init__.py#L40-L43
250,789
ryanjdillon/pyotelem
pyotelem/physio_seal.py
bodycomp
def bodycomp(mass, tbw, method='reilly', simulate=False, n_rand=1000): '''Create dataframe with derived body composition values Args ---- mass: ndarray Mass of the seal (kg) tbw: ndarray Total body water (kg) method: str name of method used to derive composition values ...
python
def bodycomp(mass, tbw, method='reilly', simulate=False, n_rand=1000): '''Create dataframe with derived body composition values Args ---- mass: ndarray Mass of the seal (kg) tbw: ndarray Total body water (kg) method: str name of method used to derive composition values ...
[ "def", "bodycomp", "(", "mass", ",", "tbw", ",", "method", "=", "'reilly'", ",", "simulate", "=", "False", ",", "n_rand", "=", "1000", ")", ":", "import", "numpy", "import", "pandas", "if", "len", "(", "mass", ")", "!=", "len", "(", "tbw", ")", ":"...
Create dataframe with derived body composition values Args ---- mass: ndarray Mass of the seal (kg) tbw: ndarray Total body water (kg) method: str name of method used to derive composition values simulate: bool switch for generating values with random noise n...
[ "Create", "dataframe", "with", "derived", "body", "composition", "values" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L49-L124
250,790
ryanjdillon/pyotelem
pyotelem/physio_seal.py
perc_bc_from_lipid
def perc_bc_from_lipid(perc_lipid, perc_water=None): '''Calculate body composition component percentages based on % lipid Calculation of percent protein and percent ash are based on those presented in Reilly and Fedak (1990). Args ---- perc_lipid: float or ndarray 1D array of percent l...
python
def perc_bc_from_lipid(perc_lipid, perc_water=None): '''Calculate body composition component percentages based on % lipid Calculation of percent protein and percent ash are based on those presented in Reilly and Fedak (1990). Args ---- perc_lipid: float or ndarray 1D array of percent l...
[ "def", "perc_bc_from_lipid", "(", "perc_lipid", ",", "perc_water", "=", "None", ")", ":", "import", "numpy", "# Cast iterables to numpy arrays", "if", "numpy", ".", "iterable", "(", "perc_lipid", ")", ":", "perc_lipid", "=", "numpy", ".", "asarray", "(", "perc_l...
Calculate body composition component percentages based on % lipid Calculation of percent protein and percent ash are based on those presented in Reilly and Fedak (1990). Args ---- perc_lipid: float or ndarray 1D array of percent lipid values from which to calculate body composition per...
[ "Calculate", "body", "composition", "component", "percentages", "based", "on", "%", "lipid" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L127-L176
250,791
ryanjdillon/pyotelem
pyotelem/physio_seal.py
lip2dens
def lip2dens(perc_lipid, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Derive tissue density from lipids The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in the book by Moore ...
python
def lip2dens(perc_lipid, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Derive tissue density from lipids The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in the book by Moore ...
[ "def", "lip2dens", "(", "perc_lipid", ",", "dens_lipid", "=", "0.9007", ",", "dens_prot", "=", "1.34", ",", "dens_water", "=", "0.994", ",", "dens_ash", "=", "2.3", ")", ":", "import", "numpy", "# Cast iterables to numpy array", "if", "numpy", ".", "iterable",...
Derive tissue density from lipids The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in the book by Moore et al. (1963). Args ---- perc_lipid: float or ndarray Percent lipid of body composition...
[ "Derive", "tissue", "density", "from", "lipids" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L203-L254
250,792
ryanjdillon/pyotelem
pyotelem/physio_seal.py
dens2lip
def dens2lip(dens_gcm3, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in t...
python
def dens2lip(dens_gcm3, dens_lipid=0.9007, dens_prot=1.34, dens_water=0.994, dens_ash=2.3): '''Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in t...
[ "def", "dens2lip", "(", "dens_gcm3", ",", "dens_lipid", "=", "0.9007", ",", "dens_prot", "=", "1.34", ",", "dens_water", "=", "0.994", ",", "dens_ash", "=", "2.3", ")", ":", "import", "numpy", "# Cast iterables to numpy array", "if", "numpy", ".", "iterable", ...
Get percent composition of animal from body density The equation calculating animal density is from Biuw et al. (2003), and default values for component densities are from human studies collected in the book by Moore et al. (1963). Args ---- dens_gcm3: float or ndarray An array of seal...
[ "Get", "percent", "composition", "of", "animal", "from", "body", "density" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L257-L315
250,793
ryanjdillon/pyotelem
pyotelem/physio_seal.py
diff_speed
def diff_speed(sw_dens=1.028, dens_gcm3=1.053, seal_length=300, seal_girth=200, Cd=0.09): '''Calculate terminal velocity of animal with a body size Args ---- sw_dens: float Density of seawater (g/cm^3) dens_gcm3: float Density of animal (g/cm^3) seal_length: float ...
python
def diff_speed(sw_dens=1.028, dens_gcm3=1.053, seal_length=300, seal_girth=200, Cd=0.09): '''Calculate terminal velocity of animal with a body size Args ---- sw_dens: float Density of seawater (g/cm^3) dens_gcm3: float Density of animal (g/cm^3) seal_length: float ...
[ "def", "diff_speed", "(", "sw_dens", "=", "1.028", ",", "dens_gcm3", "=", "1.053", ",", "seal_length", "=", "300", ",", "seal_girth", "=", "200", ",", "Cd", "=", "0.09", ")", ":", "import", "numpy", "surf", ",", "vol", "=", "surf_vol", "(", "seal_lengt...
Calculate terminal velocity of animal with a body size Args ---- sw_dens: float Density of seawater (g/cm^3) dens_gcm3: float Density of animal (g/cm^3) seal_length: float Length of animal (cm) seal_girth: float Girth of animal (cm) Cd: float Drag coe...
[ "Calculate", "terminal", "velocity", "of", "animal", "with", "a", "body", "size" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L344-L388
250,794
ryanjdillon/pyotelem
pyotelem/physio_seal.py
surf_vol
def surf_vol(length, girth): '''Calculate the surface volume of an animal from its length and girth Args ---- length: float or ndarray Length of animal (m) girth: float or ndarray Girth of animal (m) Returns ------- surf: Surface area of animal (m^2) vol: fl...
python
def surf_vol(length, girth): '''Calculate the surface volume of an animal from its length and girth Args ---- length: float or ndarray Length of animal (m) girth: float or ndarray Girth of animal (m) Returns ------- surf: Surface area of animal (m^2) vol: fl...
[ "def", "surf_vol", "(", "length", ",", "girth", ")", ":", "import", "numpy", "a_r", "=", "0.01", "*", "girth", "/", "(", "2", "*", "numpy", ".", "pi", ")", "stl_l", "=", "0.01", "*", "length", "c_r", "=", "stl_l", "/", "2", "e", "=", "numpy", "...
Calculate the surface volume of an animal from its length and girth Args ---- length: float or ndarray Length of animal (m) girth: float or ndarray Girth of animal (m) Returns ------- surf: Surface area of animal (m^2) vol: float or ndarray Volume of ani...
[ "Calculate", "the", "surface", "volume", "of", "an", "animal", "from", "its", "length", "and", "girth" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L411-L440
250,795
ryanjdillon/pyotelem
pyotelem/physio_seal.py
calc_seal_volume
def calc_seal_volume(mass_kg, dens_kgm3, length=None, girth=None): '''Calculate an animal's volume from mass and density or length and girth Args ---- mass_kg: float or ndarray Mass of animal (kg) dens_kgm3: float or ndarray Density of animal (kg/m^3) length: float or None ...
python
def calc_seal_volume(mass_kg, dens_kgm3, length=None, girth=None): '''Calculate an animal's volume from mass and density or length and girth Args ---- mass_kg: float or ndarray Mass of animal (kg) dens_kgm3: float or ndarray Density of animal (kg/m^3) length: float or None ...
[ "def", "calc_seal_volume", "(", "mass_kg", ",", "dens_kgm3", ",", "length", "=", "None", ",", "girth", "=", "None", ")", ":", "if", "(", "length", "is", "not", "None", ")", "and", "(", "girth", "is", "not", "None", ")", ":", "_", ",", "seal_vol", "...
Calculate an animal's volume from mass and density or length and girth Args ---- mass_kg: float or ndarray Mass of animal (kg) dens_kgm3: float or ndarray Density of animal (kg/m^3) length: float or None Length of animal. Default `None` (m) girth: float or None G...
[ "Calculate", "an", "animal", "s", "volume", "from", "mass", "and", "density", "or", "length", "and", "girth" ]
816563a9c3feb3fa416f1c2921c6b75db34111ad
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/physio_seal.py#L443-L467
250,796
pschmitt/zhue
zhue/model/bridge.py
Bridge.__find_new
def __find_new(self, hueobjecttype): ''' Starts a search for new Hue objects ''' assert hueobjecttype in ['lights', 'sensors'], \ 'Unsupported object type {}'.format(hueobjecttype) url = '{}/{}'.format(self.API, hueobjecttype) return self._request( ...
python
def __find_new(self, hueobjecttype): ''' Starts a search for new Hue objects ''' assert hueobjecttype in ['lights', 'sensors'], \ 'Unsupported object type {}'.format(hueobjecttype) url = '{}/{}'.format(self.API, hueobjecttype) return self._request( ...
[ "def", "__find_new", "(", "self", ",", "hueobjecttype", ")", ":", "assert", "hueobjecttype", "in", "[", "'lights'", ",", "'sensors'", "]", ",", "'Unsupported object type {}'", ".", "format", "(", "hueobjecttype", ")", "url", "=", "'{}/{}'", ".", "format", "(",...
Starts a search for new Hue objects
[ "Starts", "a", "search", "for", "new", "Hue", "objects" ]
4a3f4ddf12ceeedcb2157f92d93ff1c6438a7d59
https://github.com/pschmitt/zhue/blob/4a3f4ddf12ceeedcb2157f92d93ff1c6438a7d59/zhue/model/bridge.py#L311-L321
250,797
pschmitt/zhue
zhue/model/bridge.py
Bridge.__get_new
def __get_new(self, hueobjecttype): ''' Get a list of newly found Hue object ''' assert hueobjecttype in ['lights', 'sensors'], \ 'Unsupported object type {}'.format(hueobjecttype) url = '{}/{}/new'.format(self.API, hueobjecttype) return self._request(url=url)
python
def __get_new(self, hueobjecttype): ''' Get a list of newly found Hue object ''' assert hueobjecttype in ['lights', 'sensors'], \ 'Unsupported object type {}'.format(hueobjecttype) url = '{}/{}/new'.format(self.API, hueobjecttype) return self._request(url=url)
[ "def", "__get_new", "(", "self", ",", "hueobjecttype", ")", ":", "assert", "hueobjecttype", "in", "[", "'lights'", ",", "'sensors'", "]", ",", "'Unsupported object type {}'", ".", "format", "(", "hueobjecttype", ")", "url", "=", "'{}/{}/new'", ".", "format", "...
Get a list of newly found Hue object
[ "Get", "a", "list", "of", "newly", "found", "Hue", "object" ]
4a3f4ddf12ceeedcb2157f92d93ff1c6438a7d59
https://github.com/pschmitt/zhue/blob/4a3f4ddf12ceeedcb2157f92d93ff1c6438a7d59/zhue/model/bridge.py#L323-L330
250,798
bogdan-kulynych/defaultcontext
defaultcontext/stack.py
DefaultStack.get_context_manager
def get_context_manager(self, default): """A context manager for manipulating a default stack.""" try: self.stack.append(default) yield default finally: if self.enforce_nesting: if self.stack[-1] is not default: raise Assert...
python
def get_context_manager(self, default): """A context manager for manipulating a default stack.""" try: self.stack.append(default) yield default finally: if self.enforce_nesting: if self.stack[-1] is not default: raise Assert...
[ "def", "get_context_manager", "(", "self", ",", "default", ")", ":", "try", ":", "self", ".", "stack", ".", "append", "(", "default", ")", "yield", "default", "finally", ":", "if", "self", ".", "enforce_nesting", ":", "if", "self", ".", "stack", "[", "...
A context manager for manipulating a default stack.
[ "A", "context", "manager", "for", "manipulating", "a", "default", "stack", "." ]
ec9bb96552dfb3d42a1103da1772b024414dd801
https://github.com/bogdan-kulynych/defaultcontext/blob/ec9bb96552dfb3d42a1103da1772b024414dd801/defaultcontext/stack.py#L229-L242
250,799
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/vpn/ipsec_site_connection.py
IPsecSiteConnectionMixin.args2body
def args2body(self, parsed_args, body=None): """Add in conditional args and then return all conn info.""" if body is None: body = {} if parsed_args.dpd: vpn_utils.validate_dpd_dict(parsed_args.dpd) body['dpd'] = parsed_args.dpd if parsed_args.local_ep...
python
def args2body(self, parsed_args, body=None): """Add in conditional args and then return all conn info.""" if body is None: body = {} if parsed_args.dpd: vpn_utils.validate_dpd_dict(parsed_args.dpd) body['dpd'] = parsed_args.dpd if parsed_args.local_ep...
[ "def", "args2body", "(", "self", ",", "parsed_args", ",", "body", "=", "None", ")", ":", "if", "body", "is", "None", ":", "body", "=", "{", "}", "if", "parsed_args", ".", "dpd", ":", "vpn_utils", ".", "validate_dpd_dict", "(", "parsed_args", ".", "dpd"...
Add in conditional args and then return all conn info.
[ "Add", "in", "conditional", "args", "and", "then", "return", "all", "conn", "info", "." ]
5a5009a8fe078e3aa1d582176669f1b28ab26bef
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/vpn/ipsec_site_connection.py#L70-L88