repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
ariebovenberg/valuable
valuable/xml.py
textgetter
def textgetter(path: str, *, default: T=NO_DEFAULT, strip: bool=False) -> t.Callable[[Element], t.Union[str, T]]: """shortcut for making an XML element text getter""" find = compose( str.strip if strip else identity, partial(_raise_if_none, exc=LookupError(path)), ...
python
def textgetter(path: str, *, default: T=NO_DEFAULT, strip: bool=False) -> t.Callable[[Element], t.Union[str, T]]: """shortcut for making an XML element text getter""" find = compose( str.strip if strip else identity, partial(_raise_if_none, exc=LookupError(path)), ...
[ "def", "textgetter", "(", "path", ":", "str", ",", "*", ",", "default", ":", "T", "=", "NO_DEFAULT", ",", "strip", ":", "bool", "=", "False", ")", "->", "t", ".", "Callable", "[", "[", "Element", "]", ",", "t", ".", "Union", "[", "str", ",", "T...
shortcut for making an XML element text getter
[ "shortcut", "for", "making", "an", "XML", "element", "text", "getter" ]
train
https://github.com/ariebovenberg/valuable/blob/72ac98b5a044233f13d14a9b9f273ce3a237d9ae/valuable/xml.py#L35-L44
abalkin/tz
tz/zoneinfo.py
julian_day
def julian_day(year, n): """Return the Julian day n(1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29. """ if n > 59 and isleap(year): ...
python
def julian_day(year, n): """Return the Julian day n(1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29. """ if n > 59 and isleap(year): ...
[ "def", "julian_day", "(", "year", ",", "n", ")", ":", "if", "n", ">", "59", "and", "isleap", "(", "year", ")", ":", "n", "+=", "1", "return", "datetime", "(", "year", ",", "1", ",", "1", ")", "+", "timedelta", "(", "n", "-", "1", ")" ]
Return the Julian day n(1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29.
[ "Return", "the", "Julian", "day", "n", "(", "1", "<", "=", "n", "<", "=", "365", ")", "." ]
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tz/zoneinfo.py#L237-L246
abalkin/tz
tz/zoneinfo.py
dth_day_of_week_n
def dth_day_of_week_n(y, m, n, d): """Return he d'th day (0 <= d <= 6) of week n of month m of the year. (1 <= n <= 5, 1 <= m <= 12, where week 5 means "the last d day in month m" which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occur...
python
def dth_day_of_week_n(y, m, n, d): """Return he d'th day (0 <= d <= 6) of week n of month m of the year. (1 <= n <= 5, 1 <= m <= 12, where week 5 means "the last d day in month m" which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occur...
[ "def", "dth_day_of_week_n", "(", "y", ",", "m", ",", "n", ",", "d", ")", ":", "if", "n", "==", "5", ":", "# Compute the last dow of the month.", "y", ",", "m", "=", "next_month", "(", "y", ",", "m", ")", "dt", "=", "datetime", "(", "y", ",", "m", ...
Return he d'th day (0 <= d <= 6) of week n of month m of the year. (1 <= n <= 5, 1 <= m <= 12, where week 5 means "the last d day in month m" which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occurs. Day zero is Sunday. :param ye...
[ "Return", "he", "d", "th", "day", "(", "0", "<", "=", "d", "<", "=", "6", ")", "of", "week", "n", "of", "month", "m", "of", "the", "year", "." ]
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tz/zoneinfo.py#L346-L369
abalkin/tz
tz/zoneinfo.py
ZoneInfo.fromutc
def fromutc(self, dt): """datetime in UTC -> datetime in local time.""" if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") dt = dt.replace(tzinfo=None) ...
python
def fromutc(self, dt): """datetime in UTC -> datetime in local time.""" if not isinstance(dt, datetime): raise TypeError("fromutc() requires a datetime argument") if dt.tzinfo is not self: raise ValueError("dt.tzinfo is not self") dt = dt.replace(tzinfo=None) ...
[ "def", "fromutc", "(", "self", ",", "dt", ")", ":", "if", "not", "isinstance", "(", "dt", ",", "datetime", ")", ":", "raise", "TypeError", "(", "\"fromutc() requires a datetime argument\"", ")", "if", "dt", ".", "tzinfo", "is", "not", "self", ":", "raise",...
datetime in UTC -> datetime in local time.
[ "datetime", "in", "UTC", "-", ">", "datetime", "in", "local", "time", "." ]
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tz/zoneinfo.py#L112-L139
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_alt_title
def _parse_alt_title(html_chunk): """ Parse title from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's title. """ title = html_chunk.find("img", fn=has_param("alt")) i...
python
def _parse_alt_title(html_chunk): """ Parse title from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's title. """ title = html_chunk.find("img", fn=has_param("alt")) i...
[ "def", "_parse_alt_title", "(", "html_chunk", ")", ":", "title", "=", "html_chunk", ".", "find", "(", "\"img\"", ",", "fn", "=", "has_param", "(", "\"alt\"", ")", ")", "if", "not", "title", ":", "raise", "UserWarning", "(", "\"Can't find alternative title sour...
Parse title from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's title.
[ "Parse", "title", "from", "alternative", "location", "if", "not", "found", "where", "it", "should", "be", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L27-L42
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_alt_url
def _parse_alt_url(html_chunk): """ Parse URL from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's URL. """ url_list = html_chunk.find("a", fn=has_param("href")) url_li...
python
def _parse_alt_url(html_chunk): """ Parse URL from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's URL. """ url_list = html_chunk.find("a", fn=has_param("href")) url_li...
[ "def", "_parse_alt_url", "(", "html_chunk", ")", ":", "url_list", "=", "html_chunk", ".", "find", "(", "\"a\"", ",", "fn", "=", "has_param", "(", "\"href\"", ")", ")", "url_list", "=", "map", "(", "lambda", "x", ":", "x", ".", "params", "[", "\"href\""...
Parse URL from alternative location if not found where it should be. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str: Book's URL.
[ "Parse", "URL", "from", "alternative", "location", "if", "not", "found", "where", "it", "should", "be", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L45-L62
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_title_url
def _parse_title_url(html_chunk): """ Parse title/name of the book and URL of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: tuple: (title, url), both as strings. """ url = None title_tags = html_chunk.match( ["div"...
python
def _parse_title_url(html_chunk): """ Parse title/name of the book and URL of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: tuple: (title, url), both as strings. """ url = None title_tags = html_chunk.match( ["div"...
[ "def", "_parse_title_url", "(", "html_chunk", ")", ":", "url", "=", "None", "title_tags", "=", "html_chunk", ".", "match", "(", "[", "\"div\"", ",", "{", "\"class\"", ":", "\"polozka_nazev\"", "}", "]", ",", "[", "\"a\"", ",", "None", ",", "has_param", "...
Parse title/name of the book and URL of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: tuple: (title, url), both as strings.
[ "Parse", "title", "/", "name", "of", "the", "book", "and", "URL", "of", "the", "book", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L65-L92
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_authors
def _parse_authors(html_chunk): """ Parse authors of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: list: List of :class:`structures.Author` objects. Blank if no author \ found. """ authors_tags = html_chunk.match...
python
def _parse_authors(html_chunk): """ Parse authors of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: list: List of :class:`structures.Author` objects. Blank if no author \ found. """ authors_tags = html_chunk.match...
[ "def", "_parse_authors", "(", "html_chunk", ")", ":", "authors_tags", "=", "html_chunk", ".", "match", "(", "[", "\"div\"", ",", "{", "\"class\"", ":", "\"polozka_autor\"", "}", "]", ",", "\"a\"", ")", "authors", "=", "[", "]", "for", "author_tag", "in", ...
Parse authors of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: list: List of :class:`structures.Author` objects. Blank if no author \ found.
[ "Parse", "authors", "of", "the", "book", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L95-L129
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", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L150-L163
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_parse_description
def _parse_description(html_chunk): """ Parse description of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str/None: Description as string or None if not found. """ description_tag = html_chunk.match( ["div", {"class":...
python
def _parse_description(html_chunk): """ Parse description of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str/None: Description as string or None if not found. """ description_tag = html_chunk.match( ["div", {"class":...
[ "def", "_parse_description", "(", "html_chunk", ")", ":", "description_tag", "=", "html_chunk", ".", "match", "(", "[", "\"div\"", ",", "{", "\"class\"", ":", "\"kniha_detail_text\"", "}", "]", ",", "\"p\"", ")", "if", "not", "description_tag", ":", "return", ...
Parse description of the book. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: str/None: Description as string or None if not found.
[ "Parse", "description", "of", "the", "book", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L205-L227
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/scrappers/cpress_cz.py
_process_book
def _process_book(html_chunk): """ Parse available informations about book from the book details page. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: obj: :class:`structures.Publication` instance with book details. """ title, book_url = ...
python
def _process_book(html_chunk): """ Parse available informations about book from the book details page. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: obj: :class:`structures.Publication` instance with book details. """ title, book_url = ...
[ "def", "_process_book", "(", "html_chunk", ")", ":", "title", ",", "book_url", "=", "_parse_title_url", "(", "html_chunk", ")", "# download page with details", "data", "=", "DOWNER", ".", "download", "(", "book_url", ")", "dom", "=", "dhtmlparser", ".", "parseSt...
Parse available informations about book from the book details page. Args: html_chunk (obj): HTMLElement containing slice of the page with details. Returns: obj: :class:`structures.Publication` instance with book details.
[ "Parse", "available", "informations", "about", "book", "from", "the", "book", "details", "page", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L230-L264
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", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/cpress_cz.py#L267-L287
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", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/conf.py#L62-L90
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", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/conf.py#L92-L135
darkowlzz/numberify
numberify/numberify.py
Numberify.numberify_file
def numberify_file(self, filename): '''Prepend each line of a file with the line number Argument: filename - name of the file to be numberified ''' try: fd = open(filename, 'r+') lines = fd.readlines() for i in range(len(lines)): ...
python
def numberify_file(self, filename): '''Prepend each line of a file with the line number Argument: filename - name of the file to be numberified ''' try: fd = open(filename, 'r+') lines = fd.readlines() for i in range(len(lines)): ...
[ "def", "numberify_file", "(", "self", ",", "filename", ")", ":", "try", ":", "fd", "=", "open", "(", "filename", ",", "'r+'", ")", "lines", "=", "fd", ".", "readlines", "(", ")", "for", "i", "in", "range", "(", "len", "(", "lines", ")", ")", ":",...
Prepend each line of a file with the line number Argument: filename - name of the file to be numberified
[ "Prepend", "each", "line", "of", "a", "file", "with", "the", "line", "number", "Argument", ":", "filename", "-", "name", "of", "the", "file", "to", "be", "numberified" ]
train
https://github.com/darkowlzz/numberify/blob/e808a5aa2707a5f931fdd82bb2f0b04339eda2d9/numberify/numberify.py#L25-L47
darkowlzz/numberify
numberify/numberify.py
Numberify.numberify_data
def numberify_data(self, source, start=1): '''Return a dictionary with numberified data Arguments: source -- source of data(filename or a list) start -- starting index of numbering ''' if type(source) is str: try: fd = open(source, 'r+') ...
python
def numberify_data(self, source, start=1): '''Return a dictionary with numberified data Arguments: source -- source of data(filename or a list) start -- starting index of numbering ''' if type(source) is str: try: fd = open(source, 'r+') ...
[ "def", "numberify_data", "(", "self", ",", "source", ",", "start", "=", "1", ")", ":", "if", "type", "(", "source", ")", "is", "str", ":", "try", ":", "fd", "=", "open", "(", "source", ",", "'r+'", ")", "data", "=", "fd", ".", "readlines", "(", ...
Return a dictionary with numberified data Arguments: source -- source of data(filename or a list) start -- starting index of numbering
[ "Return", "a", "dictionary", "with", "numberified", "data", "Arguments", ":", "source", "--", "source", "of", "data", "(", "filename", "or", "a", "list", ")", "start", "--", "starting", "index", "of", "numbering" ]
train
https://github.com/darkowlzz/numberify/blob/e808a5aa2707a5f931fdd82bb2f0b04339eda2d9/numberify/numberify.py#L49-L70
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" ]
train
https://github.com/tomekwojcik/flask-htauth/blob/bb89bee3fa7d88de3147ae338048624e01de710b/flask_htauth/htpasswd.py#L10-L70
jut-io/jut-python-tools
jut/api/data_engine.py
get_data_url
def get_data_url(deployment_name, endpoint_type='juttle', token_manager=None, app_url=defaults.APP_URL): """ get the data url for a specified endpoint_type, currently supported types are: * http-import: for importing data points * juttle: for run...
python
def get_data_url(deployment_name, endpoint_type='juttle', token_manager=None, app_url=defaults.APP_URL): """ get the data url for a specified endpoint_type, currently supported types are: * http-import: for importing data points * juttle: for run...
[ "def", "get_data_url", "(", "deployment_name", ",", "endpoint_type", "=", "'juttle'", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "deployment_details", "=", "deployments", ".", "get_deployment_details", "(", "deplo...
get the data url for a specified endpoint_type, currently supported types are: * http-import: for importing data points * juttle: for running juttle programs
[ "get", "the", "data", "url", "for", "a", "specified", "endpoint_type", "currently", "supported", "types", "are", ":" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L21-L47
jut-io/jut-python-tools
jut/api/data_engine.py
get_data_urls
def get_data_urls(deployment_name, endpoint_type='juttle', token_manager=None, app_url=defaults.APP_URL): """ get all of the data urls for a specified endpoint_type, currently supported types are: * http-import: for importing data points * jut...
python
def get_data_urls(deployment_name, endpoint_type='juttle', token_manager=None, app_url=defaults.APP_URL): """ get all of the data urls for a specified endpoint_type, currently supported types are: * http-import: for importing data points * jut...
[ "def", "get_data_urls", "(", "deployment_name", ",", "endpoint_type", "=", "'juttle'", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "deployment_details", "=", "deployments", ".", "get_deployment_details", "(", "depl...
get all of the data urls for a specified endpoint_type, currently supported types are: * http-import: for importing data points * juttle: for running juttle programs
[ "get", "all", "of", "the", "data", "urls", "for", "a", "specified", "endpoint_type", "currently", "supported", "types", "are", ":" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L50-L76
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L79-L89
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L92-L102
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", "...
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L124-L153
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L156-L260
jut-io/jut-python-tools
jut/api/data_engine.py
run
def run(juttle, deployment_name, program_name=None, persist=False, token_manager=None, app_url=defaults.APP_URL): """ run a juttle program through the juttle streaming API and return the various events that are part of running a Juttle program which include: ...
python
def run(juttle, deployment_name, program_name=None, persist=False, token_manager=None, app_url=defaults.APP_URL): """ run a juttle program through the juttle streaming API and return the various events that are part of running a Juttle program which include: ...
[ "def", "run", "(", "juttle", ",", "deployment_name", ",", "program_name", "=", "None", ",", "persist", "=", "False", ",", "token_manager", "=", "None", ",", "app_url", "=", "defaults", ".", "APP_URL", ")", ":", "headers", "=", "token_manager", ".", "get_ac...
run a juttle program through the juttle streaming API and return the various events that are part of running a Juttle program which include: * Initial job status details including information to associate multiple flowgraphs with their individual outputs (sinks): { "status":...
[ "run", "a", "juttle", "program", "through", "the", "juttle", "streaming", "API", "and", "return", "the", "various", "events", "that", "are", "part", "of", "running", "a", "Juttle", "program", "which", "include", ":" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L263-L392
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L395-L425
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L428-L445
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" ]
train
https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/data_engine.py#L448-L466
alexhayes/django-toolkit
django_toolkit/xml_utils.py
prettify
def prettify(root, encoding='utf-8'): """ Return a pretty-printed XML string for the Element. @see: http://www.doughellmann.com/PyMOTW/xml/etree/ElementTree/create.html """ if isinstance(root, ElementTree.Element): node = ElementTree.tostring(root, 'utf-8') else: node = root ...
python
def prettify(root, encoding='utf-8'): """ Return a pretty-printed XML string for the Element. @see: http://www.doughellmann.com/PyMOTW/xml/etree/ElementTree/create.html """ if isinstance(root, ElementTree.Element): node = ElementTree.tostring(root, 'utf-8') else: node = root ...
[ "def", "prettify", "(", "root", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "isinstance", "(", "root", ",", "ElementTree", ".", "Element", ")", ":", "node", "=", "ElementTree", ".", "tostring", "(", "root", ",", "'utf-8'", ")", "else", ":", "node"...
Return a pretty-printed XML string for the Element. @see: http://www.doughellmann.com/PyMOTW/xml/etree/ElementTree/create.html
[ "Return", "a", "pretty", "-", "printed", "XML", "string", "for", "the", "Element", "." ]
train
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/xml_utils.py#L7-L22
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" ]
train
https://github.com/abalkin/tz/blob/f25fca6afbf1abd46fd7aeb978282823c7dab5ab/tzdata-pkg/zic/zic.py#L20-L25
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" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/local.py#L43-L85
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" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/local.py#L87-L100
cirruscluster/cirruscluster
cirruscluster/ext/ansible/runner/connection_plugins/local.py
Connection.fetch_file
def fetch_file(self, in_path, out_path): vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host) ''' fetch a file from local to local -- for copatibility ''' self.put_file(in_path, out_path)
python
def fetch_file(self, in_path, out_path): vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host) ''' fetch a file from local to local -- for copatibility ''' self.put_file(in_path, out_path)
[ "def", "fetch_file", "(", "self", ",", "in_path", ",", "out_path", ")", ":", "vvv", "(", "\"FETCH %s TO %s\"", "%", "(", "in_path", ",", "out_path", ")", ",", "host", "=", "self", ".", "host", ")", "self", ".", "put_file", "(", "in_path", ",", "out_pat...
fetch a file from local to local -- for copatibility
[ "fetch", "a", "file", "from", "local", "to", "local", "--", "for", "copatibility" ]
train
https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/local.py#L102-L105
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" ]
train
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L56-L59
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" ]
train
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L32-L42
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" ]
train
https://github.com/lipixun/pymime/blob/4762cf2e51ba80c21d872f26b8e408b6a6863d26/src/mime/tools/specxmlparser.py#L44-L48
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" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/scrapers/login.py#L35-L46
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" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/scrapers/login.py#L48-L94
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", "." ]
train
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise_cffi.py#L35-L48
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", "." ]
train
https://github.com/fred49/linshare-api/blob/be646c25aa8ba3718abb6869c620b157d53d6e41/linshareapi/user/threads.py#L106-L112
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", "." ]
train
https://github.com/refinery29/chassis/blob/1238d5214cbb8f3e1fe7c0dc2fa72f45bf085192/chassis/util/encoders.py#L9-L18
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" ]
train
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L15-L33
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" ]
train
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L37-L54
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" ]
train
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L58-L80
fedora-infra/fmn.rules
fmn/rules/taskotron.py
taskotron_task_particular_or_changed_outcome
def taskotron_task_particular_or_changed_outcome(config, message, outcome='FAILED,NEEDS_INSPECTION'): """ Taskotron task any particular or changed outcome(s) With this rule, you can limit messages to only those task results with any particular outcome(s) (FA...
python
def taskotron_task_particular_or_changed_outcome(config, message, outcome='FAILED,NEEDS_INSPECTION'): """ Taskotron task any particular or changed outcome(s) With this rule, you can limit messages to only those task results with any particular outcome(s) (FA...
[ "def", "taskotron_task_particular_or_changed_outcome", "(", "config", ",", "message", ",", "outcome", "=", "'FAILED,NEEDS_INSPECTION'", ")", ":", "return", "taskotron_task_outcome", "(", "config", ",", "message", ",", "outcome", ")", "or", "taskotron_changed_outcome", "...
Taskotron task any particular or changed outcome(s) With this rule, you can limit messages to only those task results with any particular outcome(s) (FAILED and NEEDS_INSPECTION by default) or those with changed outcomes. This rule is a handy way of filtering a very useful use case - being notified whe...
[ "Taskotron", "task", "any", "particular", "or", "changed", "outcome", "(", "s", ")" ]
train
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L84-L104
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" ]
train
https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L108-L127
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", "." ]
train
https://github.com/abhinav/reversible/blob/7e28aaf0390f7d4b889c6ac14d7b340f8f314e89/reversible/tornado/core.py#L79-L112
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" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L108-L144
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset.view
def view(self): """ prints the dataset in an easy to read format """ print(self.format(remove='bnode', sort=True, pretty=True, compress=True, output='json', add_ids=True))
python
def view(self): """ prints the dataset in an easy to read format """ print(self.format(remove='bnode', sort=True, pretty=True, compress=True, output='json', add_ids=True))
[ "def", "view", "(", "self", ")", ":", "print", "(", "self", ".", "format", "(", "remove", "=", "'bnode'", ",", "sort", "=", "True", ",", "pretty", "=", "True", ",", "compress", "=", "True", ",", "output", "=", "'json'", ",", "add_ids", "=", "True",...
prints the dataset in an easy to read format
[ "prints", "the", "dataset", "in", "an", "easy", "to", "read", "format" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L191-L198
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset.view_main
def view_main(self): """ prints the dataset in an easy to read format """ print(self.format(remove='bnode', sort=True, pretty=True, compress=True, output='json', base_only = ...
python
def view_main(self): """ prints the dataset in an easy to read format """ print(self.format(remove='bnode', sort=True, pretty=True, compress=True, output='json', base_only = ...
[ "def", "view_main", "(", "self", ")", ":", "print", "(", "self", ".", "format", "(", "remove", "=", "'bnode'", ",", "sort", "=", "True", ",", "pretty", "=", "True", ",", "compress", "=", "True", ",", "output", "=", "'json'", ",", "base_only", "=", ...
prints the dataset in an easy to read format
[ "prints", "the", "dataset", "in", "an", "easy", "to", "read", "format" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L201-L209
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" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L211-L237
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" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L327-L344
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" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L346-L372
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" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L374-L418
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset._get_non_defined
def _get_non_defined(self, data, class_types): """ returns a list of URIs and blanknodes that are not defined within the dataset. For example: schema:Person has an associated rdf:type then it is considered defined. args: data: a list of triples class_type...
python
def _get_non_defined(self, data, class_types): """ returns a list of URIs and blanknodes that are not defined within the dataset. For example: schema:Person has an associated rdf:type then it is considered defined. args: data: a list of triples class_type...
[ "def", "_get_non_defined", "(", "self", ",", "data", ",", "class_types", ")", ":", "subj_set", "=", "set", "(", "[", "item", "[", "self", ".", "smap", "]", "for", "item", "in", "class_types", "]", ")", "non_def_set", "=", "set", "(", "[", "item", "["...
returns a list of URIs and blanknodes that are not defined within the dataset. For example: schema:Person has an associated rdf:type then it is considered defined. args: data: a list of triples class_types: list of subjects that are defined in the dataset
[ "returns", "a", "list", "of", "URIs", "and", "blanknodes", "that", "are", "not", "defined", "within", "the", "dataset", ".", "For", "example", ":", "schema", ":", "Person", "has", "an", "associated", "rdf", ":", "type", "then", "it", "is", "considered", ...
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L432-L444
KnowledgeLinks/rdfframework
rdfframework/datasets/rdfdatasets.py
RdfDataset._convert_results
def _convert_results(self, data, **kwargs): """ converts the results of a query to RdfDatatype instances args: data: a list of triples """ if kwargs.get("multiprocessing", False): m = mp.Manager() output = m.Queue() pdb.set_trace(...
python
def _convert_results(self, data, **kwargs): """ converts the results of a query to RdfDatatype instances args: data: a list of triples """ if kwargs.get("multiprocessing", False): m = mp.Manager() output = m.Queue() pdb.set_trace(...
[ "def", "_convert_results", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "\"multiprocessing\"", ",", "False", ")", ":", "m", "=", "mp", ".", "Manager", "(", ")", "output", "=", "m", ".", "Queue", "(",...
converts the results of a query to RdfDatatype instances args: data: a list of triples
[ "converts", "the", "results", "of", "a", "query", "to", "RdfDatatype", "instances" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datasets/rdfdatasets.py#L446-L489
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", "." ]
train
https://github.com/shaypal5/utilitime/blob/554ca05fa83c2dbf5d6cf9c9cfa6b03ee6cdb609/utilitime/time_interval.py#L19-L37
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", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L88-L120
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", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L123-L185
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", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L188-L226
tomnor/channelpack
channelpack/pullxl.py
_sheet_asdict
def _sheet_asdict(sheet, startstops, usecols=None): """Read data from a spread sheet. Return the data in a dict with column numbers as keys. sheet: xlrd.sheet.Sheet instance Ready for use. startstops: list Four StartStop objects defining the data to read. See :func:`~channelpac...
python
def _sheet_asdict(sheet, startstops, usecols=None): """Read data from a spread sheet. Return the data in a dict with column numbers as keys. sheet: xlrd.sheet.Sheet instance Ready for use. startstops: list Four StartStop objects defining the data to read. See :func:`~channelpac...
[ "def", "_sheet_asdict", "(", "sheet", ",", "startstops", ",", "usecols", "=", "None", ")", ":", "_", ",", "_", ",", "start", ",", "stop", "=", "startstops", "usecols", "=", "_sanitize_usecols", "(", "usecols", ")", "if", "usecols", "is", "not", "None", ...
Read data from a spread sheet. Return the data in a dict with column numbers as keys. sheet: xlrd.sheet.Sheet instance Ready for use. startstops: list Four StartStop objects defining the data to read. See :func:`~channelpack.pullxl.prepread`. usecols: str or seqence of ints or...
[ "Read", "data", "from", "a", "spread", "sheet", ".", "Return", "the", "data", "in", "a", "dict", "with", "column", "numbers", "as", "keys", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L229-L287
tomnor/channelpack
channelpack/pullxl.py
sheet_asdict
def sheet_asdict(fn, sheet=0, header=True, startcell=None, stopcell=None, usecols=None, chnames_out=None): """Read data from a spread sheet. Return the data in a dict with column numbers as keys. fn: str The file to read from. sheet: int or str If int, it is the index ...
python
def sheet_asdict(fn, sheet=0, header=True, startcell=None, stopcell=None, usecols=None, chnames_out=None): """Read data from a spread sheet. Return the data in a dict with column numbers as keys. fn: str The file to read from. sheet: int or str If int, it is the index ...
[ "def", "sheet_asdict", "(", "fn", ",", "sheet", "=", "0", ",", "header", "=", "True", ",", "startcell", "=", "None", ",", "stopcell", "=", "None", ",", "usecols", "=", "None", ",", "chnames_out", "=", "None", ")", ":", "book", "=", "xlrd", ".", "op...
Read data from a spread sheet. Return the data in a dict with column numbers as keys. fn: str The file to read from. sheet: int or str If int, it is the index for the sheet 0-based. Else the sheet name. header: bool or str True if the defined data range includes a head...
[ "Read", "data", "from", "a", "spread", "sheet", ".", "Return", "the", "data", "in", "a", "dict", "with", "column", "numbers", "as", "keys", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L290-L350
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" ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L353-L381
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", "." ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L384-L419
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" ]
train
https://github.com/tomnor/channelpack/blob/9ad3cd11c698aed4c0fc178385b2ba38a7d0efae/channelpack/pullxl.py#L435-L446
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", "." ]
train
https://github.com/kcolford/txt2boil/blob/853a47bb8db27c0224531f24dfd02839c983d027/txt2boil/__init__.py#L42-L58
sys-git/certifiable
certifiable/core.py
certify_printable
def certify_printable(value, nonprintable=False, required=True): """ Certifier for human readable (printable) values. :param unicode value: The string to be certified. :param nonprintable: Whether the string can contain non-printable characters. Non-printable characters are allo...
python
def certify_printable(value, nonprintable=False, required=True): """ Certifier for human readable (printable) values. :param unicode value: The string to be certified. :param nonprintable: Whether the string can contain non-printable characters. Non-printable characters are allo...
[ "def", "certify_printable", "(", "value", ",", "nonprintable", "=", "False", ",", "required", "=", "True", ")", ":", "certify_params", "(", "(", "certify_bool", ",", "'nonprintable'", ",", "nonprintable", ")", ",", ")", "if", "certify_required", "(", "value", ...
Certifier for human readable (printable) values. :param unicode value: The string to be certified. :param nonprintable: Whether the string can contain non-printable characters. Non-printable characters are allowed by default. :param bool required: Whether the value can be `N...
[ "Certifier", "for", "human", "readable", "(", "printable", ")", "values", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L42-L70
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L74-L135
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L204-L253
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L310-L333
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L337-L390
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L394-L419
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L423-L450
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L454-L491
sys-git/certifiable
certifiable/core.py
certify_timestamp
def certify_timestamp(value, required=True): """ Certifier for timestamp (datetime) 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 certif...
python
def certify_timestamp(value, required=True): """ Certifier for timestamp (datetime) 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 certif...
[ "def", "certify_timestamp", "(", "value", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "value", ",", "datetime", "...
Certifier for timestamp (datetime) 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", "timestamp", "(", "datetime", ")", "values", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L495-L518
sys-git/certifiable
certifiable/core.py
certify_date
def certify_date(value, required=True): """ Certifier for datetime.date 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_date(value, required=True): """ Certifier for datetime.date 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_date", "(", "value", ",", "required", "=", "True", ")", ":", "if", "certify_required", "(", "value", "=", "value", ",", "required", "=", "required", ",", ")", ":", "return", "if", "not", "isinstance", "(", "value", ",", "date", ")", ":"...
Certifier for datetime.date 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", ".", "date", "values", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L522-L545
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", "." ]
train
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/core.py#L549-L572
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L51-L79
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L81-L87
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L90-L111
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L159-L181
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L193-L207
jeremylow/pyshk
pyshk/models.py
Shake.AsDict
def AsDict(self, dt=True): """ A dict representation of this Shake instance. The return value uses the same key names as the JSON representation. Return: A dict representing this Shake instance """ data = {} if self.id: data['id'] = self...
python
def AsDict(self, dt=True): """ A dict representation of this Shake instance. The return value uses the same key names as the JSON representation. Return: A dict representing this Shake instance """ data = {} if self.id: data['id'] = self...
[ "def", "AsDict", "(", "self", ",", "dt", "=", "True", ")", ":", "data", "=", "{", "}", "if", "self", ".", "id", ":", "data", "[", "'id'", "]", "=", "self", ".", "id", "if", "self", ".", "name", ":", "data", "[", "'name'", "]", "=", "self", ...
A dict representation of this Shake instance. The return value uses the same key names as the JSON representation. Return: A dict representing this Shake instance
[ "A", "dict", "representation", "of", "this", "Shake", "instance", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L283-L320
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L332-L354
jeremylow/pyshk
pyshk/models.py
SharedFile.AsDict
def AsDict(self, dt=True): """ A dict representation of this Shake 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 Shake 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", ".", "sharekey", ":", "data", "[", "'sharekey'", "]", "=", "self", ".", "sharekey", "if", "self", ".", "name", ":", "data", "[", "'name'", "]", ...
A dict representation of this Shake 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 S...
[ "A", "dict", "representation", "of", "this", "Shake", "instance", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L462-L510
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", "." ]
train
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L522-L551
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", "." ]
train
https://github.com/dcramer/peek/blob/da7c086660fc870c6632c4dc5ccb2ff9bfbee52e/peek/collector.py#L22-L30
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", "." ]
train
https://github.com/dcramer/peek/blob/da7c086660fc870c6632c4dc5ccb2ff9bfbee52e/peek/collector.py#L56-L65
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", "." ]
train
https://github.com/emilssolmanis/tapes/blob/7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c/tapes/registry.py#L83-L89
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", "." ]
train
https://github.com/emilssolmanis/tapes/blob/7797fc9ebcb359cb1ba5085570e3cab5ebcd1d3c/tapes/registry.py#L107-L130
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" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/dev_tools.py#L35-L50
FujiMakoto/IPS-Vagrant
ips_vagrant/downloaders/dev_tools.py
DevToolsManager._read_zip
def _read_zip(self, filepath): """ Read an IPS installation zipfile and return the core version number @type filepath: str @rtype: LooseVersion """ with ZipFile(filepath) as zip: namelist = zip.namelist() if re.match(r'^\d+/?$', namelist[0]): ...
python
def _read_zip(self, filepath): """ Read an IPS installation zipfile and return the core version number @type filepath: str @rtype: LooseVersion """ with ZipFile(filepath) as zip: namelist = zip.namelist() if re.match(r'^\d+/?$', namelist[0]): ...
[ "def", "_read_zip", "(", "self", ",", "filepath", ")", ":", "with", "ZipFile", "(", "filepath", ")", "as", "zip", ":", "namelist", "=", "zip", ".", "namelist", "(", ")", "if", "re", ".", "match", "(", "r'^\\d+/?$'", ",", "namelist", "[", "0", "]", ...
Read an IPS installation zipfile and return the core version number @type filepath: str @rtype: LooseVersion
[ "Read", "an", "IPS", "installation", "zipfile", "and", "return", "the", "core", "version", "number" ]
train
https://github.com/FujiMakoto/IPS-Vagrant/blob/7b1d6d095034dd8befb026d9315ecc6494d52269/ips_vagrant/downloaders/dev_tools.py#L77-L103
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", "." ]
train
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L28-L36
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", "." ]
train
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L38-L86
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", "." ]
train
https://github.com/marteinn/genres/blob/4bbc90f7c2c527631380c08b4d99a4e40abed955/genres/db.py#L89-L102
minhhoit/yacms
yacms/utils/sites.py
current_site_id
def current_site_id(): """ Responsible for determining the current ``Site`` instance to use when retrieving data for any ``SiteRelated`` models. If we're inside an override_current_site_id context manager, return the overriding site ID. Otherwise, try to determine the site using the following method...
python
def current_site_id(): """ Responsible for determining the current ``Site`` instance to use when retrieving data for any ``SiteRelated`` models. If we're inside an override_current_site_id context manager, return the overriding site ID. Otherwise, try to determine the site using the following method...
[ "def", "current_site_id", "(", ")", ":", "if", "hasattr", "(", "override_current_site_id", ".", "thread_local", ",", "\"site_id\"", ")", ":", "return", "override_current_site_id", ".", "thread_local", ".", "site_id", "from", "yacms", ".", "utils", ".", "cache", ...
Responsible for determining the current ``Site`` instance to use when retrieving data for any ``SiteRelated`` models. If we're inside an override_current_site_id context manager, return the overriding site ID. Otherwise, try to determine the site using the following methods in order: - ``site_id`` in...
[ "Responsible", "for", "determining", "the", "current", "Site", "instance", "to", "use", "when", "retrieving", "data", "for", "any", "SiteRelated", "models", ".", "If", "we", "re", "inside", "an", "override_current_site_id", "context", "manager", "return", "the", ...
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L15-L65
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", ...
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L80-L96
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", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L99-L120
minhhoit/yacms
yacms/utils/sites.py
templates_for_host
def templates_for_host(templates): """ Given a template name (or list of them), returns the template names as a list, with each name prefixed with the device directory inserted into the front of the list. """ if not isinstance(templates, (list, tuple)): templates = [templates] theme_...
python
def templates_for_host(templates): """ Given a template name (or list of them), returns the template names as a list, with each name prefixed with the device directory inserted into the front of the list. """ if not isinstance(templates, (list, tuple)): templates = [templates] theme_...
[ "def", "templates_for_host", "(", "templates", ")", ":", "if", "not", "isinstance", "(", "templates", ",", "(", "list", ",", "tuple", ")", ")", ":", "templates", "=", "[", "templates", "]", "theme_dir", "=", "host_theme_path", "(", ")", "host_templates", "...
Given a template name (or list of them), returns the template names as a list, with each name prefixed with the device directory inserted into the front of the list.
[ "Given", "a", "template", "name", "(", "or", "list", "of", "them", ")", "returns", "the", "template", "names", "as", "a", "list", "with", "each", "name", "prefixed", "with", "the", "device", "directory", "inserted", "into", "the", "front", "of", "the", "...
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/utils/sites.py#L123-L138
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", "." ]
train
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/schemes/data.py#L23-L35
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", "." ]
train
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/schemes/data.py#L38-L51