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
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.insert
def insert(self, new_entry): '''Insert a new entry to the end of the list of dictionaries. This entry retains the original index tracking but adds this entry incrementally at the end. >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ...
python
def insert(self, new_entry): '''Insert a new entry to the end of the list of dictionaries. This entry retains the original index tracking but adds this entry incrementally at the end. >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ...
[ "def", "insert", "(", "self", ",", "new_entry", ")", ":", "self", ".", "index_track", ".", "append", "(", "len", "(", "self", ".", "table", ")", ")", "self", ".", "table", ".", "append", "(", "new_entry", ")", "return", "self" ]
Insert a new entry to the end of the list of dictionaries. This entry retains the original index tracking but adds this entry incrementally at the end. >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, ...
[ "Insert", "a", "new", "entry", "to", "the", "end", "of", "the", "list", "of", "dictionaries", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L251-L278
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.deleteByOrigIndex
def deleteByOrigIndex(self, index): """Removes a single entry from the list given the index reference. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"name...
python
def deleteByOrigIndex(self, index): """Removes a single entry from the list given the index reference. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"name...
[ "def", "deleteByOrigIndex", "(", "self", ",", "index", ")", ":", "result", "=", "[", "]", "result_tracker", "=", "[", "]", "for", "counter", ",", "row", "in", "enumerate", "(", "self", ".", "table", ")", ":", "if", "self", ".", "index_track", "[", "c...
Removes a single entry from the list given the index reference. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs":...
[ "Removes", "a", "single", "entry", "from", "the", "list", "given", "the", "index", "reference", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L280-L328
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.deleteByOrigIndexList
def deleteByOrigIndexList(self, indexList): """Remove entries from the list given the index references. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"nam...
python
def deleteByOrigIndexList(self, indexList): """Remove entries from the list given the index references. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"nam...
[ "def", "deleteByOrigIndexList", "(", "self", ",", "indexList", ")", ":", "result", "=", "[", "]", "result_tracker", "=", "[", "]", "counter", "=", "0", "for", "row", "in", "self", ".", "table", ":", "if", "not", "counter", "in", "indexList", ":", "resu...
Remove entries from the list given the index references. The index, in this instance, is a reference to the *original* list indexing as seen when the list was first inserted into PLOD. An example: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 ...
[ "Remove", "entries", "from", "the", "list", "given", "the", "index", "references", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L330-L380
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.renumber
def renumber(self, key, start=1, increment=1, insert=False): '''Incrementally number a key based on the current order of the list. Please note that if an entry in the list does not have the specified key, it is NOT created (unless insert=True is passed). The entry is, however, still cou...
python
def renumber(self, key, start=1, increment=1, insert=False): '''Incrementally number a key based on the current order of the list. Please note that if an entry in the list does not have the specified key, it is NOT created (unless insert=True is passed). The entry is, however, still cou...
[ "def", "renumber", "(", "self", ",", "key", ",", "start", "=", "1", ",", "increment", "=", "1", ",", "insert", "=", "False", ")", ":", "result", "=", "[", "]", "counter", "=", "start", "if", "insert", ":", "self", ".", "addKey", "(", "key", ",", ...
Incrementally number a key based on the current order of the list. Please note that if an entry in the list does not have the specified key, it is NOT created (unless insert=True is passed). The entry is, however, still counted. Example of use: >>> test = [ ... {"na...
[ "Incrementally", "number", "a", "key", "based", "on", "the", "current", "order", "of", "the", "list", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L388-L443
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.sort
def sort(self, key, reverse=False, none_greater=False): '''Sort the list in the order of the dictionary key. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2,...
python
def sort(self, key, reverse=False, none_greater=False): '''Sort the list in the order of the dictionary key. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2,...
[ "def", "sort", "(", "self", ",", "key", ",", "reverse", "=", "False", ",", "none_greater", "=", "False", ")", ":", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", ".", "table", ")", ")", ":", "min", "=", "i", "for", "j", "in", "...
Sort the list in the order of the dictionary key. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "income": 15000, ...
[ "Sort", "the", "list", "in", "the", "order", "of", "the", "dictionary", "key", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L445-L498
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.eq
def eq(self, key, value, includeMissing=False): '''Return entries where the key's value is of equal (==) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3,...
python
def eq(self, key, value, includeMissing=False): '''Return entries where the key's value is of equal (==) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3,...
[ "def", "eq", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index_...
Return entries where the key's value is of equal (==) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "incom...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "of", "equal", "(", "==", ")", "value", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L504-L538
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.ne
def ne(self, key, value, includeMissing=False): '''Return entries where the key's value is NOT of equal (!=) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs":...
python
def ne(self, key, value, includeMissing=False): '''Return entries where the key's value is NOT of equal (!=) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs":...
[ "def", "ne", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index_...
Return entries where the key's value is NOT of equal (!=) value. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "i...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "NOT", "of", "equal", "(", "!", "=", ")", "value", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L540-L577
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.gt
def gt(self, key, value, includeMissing=False): '''Return entries where the key's value is greater (>). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]},...
python
def gt(self, key, value, includeMissing=False): '''Return entries where the key's value is greater (>). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]},...
[ "def", "gt", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index_...
Return entries where the key's value is greater (>). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "income": 1500...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "greater", "(", ">", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L579-L608
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.gte
def gte(self, key, value, includeMissing=False): '''Return entries where the key's value is greater or equal (>=). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": ...
python
def gte(self, key, value, includeMissing=False): '''Return entries where the key's value is greater or equal (>=). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": ...
[ "def", "gte", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index...
Return entries where the key's value is greater or equal (>=). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "inc...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "greater", "or", "equal", "(", ">", "=", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L610-L640
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.lt
def lt(self, key, value, includeMissing=False): '''Return entries where the key's value is less (<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ...
python
def lt(self, key, value, includeMissing=False): '''Return entries where the key's value is less (<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ...
[ "def", "lt", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index_...
Return entries where the key's value is less (<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "income": 15000, ...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "less", "(", "<", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L642-L672
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.lte
def lte(self, key, value, includeMissing=False): '''Return entries where the key's value is less or equal (=<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3,...
python
def lte(self, key, value, includeMissing=False): '''Return entries where the key's value is less or equal (=<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3,...
[ "def", "lte", "(", "self", ",", "key", ",", "value", ",", "includeMissing", "=", "False", ")", ":", "(", "self", ".", "table", ",", "self", ".", "index_track", ")", "=", "internal", ".", "select", "(", "self", ".", "table", ",", "self", ".", "index...
Return entries where the key's value is less or equal (=<). Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "income...
[ "Return", "entries", "where", "the", "key", "s", "value", "is", "less", "or", "equal", "(", "=", "<", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L674-L705
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.hasKey
def hasKey(self, key, notNone=False): '''Return entries where the key is present. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name...
python
def hasKey(self, key, notNone=False): '''Return entries where the key is present. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name...
[ "def", "hasKey", "(", "self", ",", "key", ",", "notNone", "=", "False", ")", ":", "result", "=", "[", "]", "result_tracker", "=", "[", "]", "for", "counter", ",", "row", "in", "enumerate", "(", "self", ".", "table", ")", ":", "(", "target", ",", ...
Return entries where the key is present. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "wigs": 68 }, ... {"name": "Larry", "age": 18, "wigs": [3, 2, 9]}, ... {"name": "Joe", "age": 20, "income": None , "wigs": [...
[ "Return", "entries", "where", "the", "key", "is", "present", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L707-L750
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.contains
def contains(self, key, value, findAll=False, exclude=False, includeMissing=False): '''Return entries that: * have the key * key points to a list, and * value is found in the list. If value is also a list itself, then the list entry is selected if any of the val...
python
def contains(self, key, value, findAll=False, exclude=False, includeMissing=False): '''Return entries that: * have the key * key points to a list, and * value is found in the list. If value is also a list itself, then the list entry is selected if any of the val...
[ "def", "contains", "(", "self", ",", "key", ",", "value", ",", "findAll", "=", "False", ",", "exclude", "=", "False", ",", "includeMissing", "=", "False", ")", ":", "result", "=", "[", "]", "result_index", "=", "[", "]", "for", "counter", ",", "row",...
Return entries that: * have the key * key points to a list, and * value is found in the list. If value is also a list itself, then the list entry is selected if any of the values match. If findAll is set to True, then all the entries must be found. Exa...
[ "Return", "entries", "that", ":", "*", "have", "the", "key", "*", "key", "points", "to", "a", "list", "and", "*", "value", "is", "found", "in", "the", "list", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L793-L872
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnList
def returnList(self, limit=False): '''Return a list of dictionaries (and *not* a PLOD class). The list returned maintains the 'types' of the original entries unless another operation has explicity changed them. For example, an 'upsert' replacement of an entry. Example of use: ...
python
def returnList(self, limit=False): '''Return a list of dictionaries (and *not* a PLOD class). The list returned maintains the 'types' of the original entries unless another operation has explicity changed them. For example, an 'upsert' replacement of an entry. Example of use: ...
[ "def", "returnList", "(", "self", ",", "limit", "=", "False", ")", ":", "if", "limit", "==", "False", ":", "return", "self", ".", "table", "result", "=", "[", "]", "for", "i", "in", "range", "(", "limit", ")", ":", "if", "len", "(", "self", ".", ...
Return a list of dictionaries (and *not* a PLOD class). The list returned maintains the 'types' of the original entries unless another operation has explicity changed them. For example, an 'upsert' replacement of an entry. Example of use: >>> test = [ ... {"name": "...
[ "Return", "a", "list", "of", "dictionaries", "(", "and", "*", "not", "*", "a", "PLOD", "class", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L880-L913
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnLOD
def returnLOD(self, limit=False): '''Return a TRUE list of dictionaries (and *not* a PLOD class). The entries are modified if the original list was not already a list of dictionaries. So, for example, a list of objects would be returned as an interpreted list of dictionaries instead. ...
python
def returnLOD(self, limit=False): '''Return a TRUE list of dictionaries (and *not* a PLOD class). The entries are modified if the original list was not already a list of dictionaries. So, for example, a list of objects would be returned as an interpreted list of dictionaries instead. ...
[ "def", "returnLOD", "(", "self", ",", "limit", "=", "False", ")", ":", "if", "limit", "==", "False", ":", "limit", "=", "len", "(", "self", ".", "table", ")", "result", "=", "[", "]", "if", "limit", ":", "for", "i", "in", "range", "(", "limit", ...
Return a TRUE list of dictionaries (and *not* a PLOD class). The entries are modified if the original list was not already a list of dictionaries. So, for example, a list of objects would be returned as an interpreted list of dictionaries instead.
[ "Return", "a", "TRUE", "list", "of", "dictionaries", "(", "and", "*", "not", "*", "a", "PLOD", "class", ")", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L915-L929
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnString
def returnString(self, limit=False, omitBrackets=False, executable=False, honorMissing=False): '''Return a string containing the list of dictionaries in easy human-readable read format. Each entry is on one line. Key/value pairs are 'spaced' in such a way as to have them all line up ver...
python
def returnString(self, limit=False, omitBrackets=False, executable=False, honorMissing=False): '''Return a string containing the list of dictionaries in easy human-readable read format. Each entry is on one line. Key/value pairs are 'spaced' in such a way as to have them all line up ver...
[ "def", "returnString", "(", "self", ",", "limit", "=", "False", ",", "omitBrackets", "=", "False", ",", "executable", "=", "False", ",", "honorMissing", "=", "False", ")", ":", "result", "=", "\"\"", "# we limit the table if needed", "if", "not", "limit", ":...
Return a string containing the list of dictionaries in easy human-readable read format. Each entry is on one line. Key/value pairs are 'spaced' in such a way as to have them all line up vertically if using a monospace font. The fields are normalized to alphabetical order. Missing keys i...
[ "Return", "a", "string", "containing", "the", "list", "of", "dictionaries", "in", "easy", "human", "-", "readable", "read", "format", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L932-L1064
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnCSV
def returnCSV(self, keys=None, limit=False, omitHeaderLine=False, quoteChar=None, eolChars='\r\n'): r'''Return a list of dictionaries formated as a comma seperated values (CSV) list in a string. Each entry is on one line. By default, each value is seperated by commas and each entry is f...
python
def returnCSV(self, keys=None, limit=False, omitHeaderLine=False, quoteChar=None, eolChars='\r\n'): r'''Return a list of dictionaries formated as a comma seperated values (CSV) list in a string. Each entry is on one line. By default, each value is seperated by commas and each entry is f...
[ "def", "returnCSV", "(", "self", ",", "keys", "=", "None", ",", "limit", "=", "False", ",", "omitHeaderLine", "=", "False", ",", "quoteChar", "=", "None", ",", "eolChars", "=", "'\\r\\n'", ")", ":", "result", "=", "\"\"", "if", "quoteChar", ":", "quote...
r'''Return a list of dictionaries formated as a comma seperated values (CSV) list in a string. Each entry is on one line. By default, each value is seperated by commas and each entry is followed by a newline ('\n'). By default, RFC4180 is followed. See: http://tools.ietf.or...
[ "r", "Return", "a", "list", "of", "dictionaries", "formated", "as", "a", "comma", "seperated", "values", "(", "CSV", ")", "list", "in", "a", "string", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1066-L1200
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnIndexList
def returnIndexList(self, limit=False): '''Return a list of integers that are list-index references to the original list of dictionaries." Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ... {"name": "Larry", "age": 18, ...
python
def returnIndexList(self, limit=False): '''Return a list of integers that are list-index references to the original list of dictionaries." Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ... {"name": "Larry", "age": 18, ...
[ "def", "returnIndexList", "(", "self", ",", "limit", "=", "False", ")", ":", "if", "limit", "==", "False", ":", "return", "self", ".", "index_track", "result", "=", "[", "]", "for", "i", "in", "range", "(", "limit", ")", ":", "if", "len", "(", "sel...
Return a list of integers that are list-index references to the original list of dictionaries." Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ... {"name": "Larry", "age": 18, "order": 3}, ... {"name...
[ "Return", "a", "list", "of", "integers", "that", "are", "list", "-", "index", "references", "to", "the", "original", "list", "of", "dictionaries", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1202-L1231
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnOneIndex
def returnOneIndex(self, last=False): '''Return the first origin index (integer) of the current list. That index refers to it's placement in the original list of dictionaries. This is very useful when one wants to reference the original entry by index. Example of use: ...
python
def returnOneIndex(self, last=False): '''Return the first origin index (integer) of the current list. That index refers to it's placement in the original list of dictionaries. This is very useful when one wants to reference the original entry by index. Example of use: ...
[ "def", "returnOneIndex", "(", "self", ",", "last", "=", "False", ")", ":", "if", "len", "(", "self", ".", "table", ")", "==", "0", ":", "return", "None", "else", ":", "if", "last", ":", "return", "self", ".", "index_track", ".", "pop", "(", ")", ...
Return the first origin index (integer) of the current list. That index refers to it's placement in the original list of dictionaries. This is very useful when one wants to reference the original entry by index. Example of use: >>> test = [ ... {"name": "Jim...
[ "Return", "the", "first", "origin", "index", "(", "integer", ")", "of", "the", "current", "list", ".", "That", "index", "refers", "to", "it", "s", "placement", "in", "the", "original", "list", "of", "dictionaries", ".", "This", "is", "very", "useful", "w...
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1234-L1266
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnOneEntry
def returnOneEntry(self, last=False): '''Return the first entry in the current list. If 'last=True', then the last entry is returned." Returns None is the list is empty. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ...
python
def returnOneEntry(self, last=False): '''Return the first entry in the current list. If 'last=True', then the last entry is returned." Returns None is the list is empty. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ...
[ "def", "returnOneEntry", "(", "self", ",", "last", "=", "False", ")", ":", "if", "len", "(", "self", ".", "table", ")", "==", "0", ":", "return", "None", "else", ":", "if", "last", ":", "return", "self", ".", "table", "[", "len", "(", "self", "."...
Return the first entry in the current list. If 'last=True', then the last entry is returned." Returns None is the list is empty. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ... {"name": "Larry", "age": 18, ...
[ "Return", "the", "first", "entry", "in", "the", "current", "list", ".", "If", "last", "=", "True", "then", "the", "last", "entry", "is", "returned", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1269-L1299
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnValue
def returnValue(self, key, last=False): '''Return the key's value for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty or the key is missing. Example of use: >>> test = [ ... {"name": "Jim", ...
python
def returnValue(self, key, last=False): '''Return the key's value for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty or the key is missing. Example of use: >>> test = [ ... {"name": "Jim", ...
[ "def", "returnValue", "(", "self", ",", "key", ",", "last", "=", "False", ")", ":", "row", "=", "self", ".", "returnOneEntry", "(", "last", "=", "last", ")", "if", "not", "row", ":", "return", "None", "dict_row", "=", "internal", ".", "convert_to_dict"...
Return the key's value for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty or the key is missing. Example of use: >>> test = [ ... {"name": "Jim", "age": 18, "income": 93000, "order": 2}, ....
[ "Return", "the", "key", "s", "value", "for", "the", "first", "entry", "in", "the", "current", "list", ".", "If", "last", "=", "True", "then", "the", "last", "entry", "is", "referenced", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1301-L1331
MakerReduxCorp/PLOD
PLOD/__init__.py
PLOD.returnValueList
def returnValueList(self, key_list, last=False): '''Return a list of key values for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty. If a key is missing, then that entry in the list is None. Example of u...
python
def returnValueList(self, key_list, last=False): '''Return a list of key values for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty. If a key is missing, then that entry in the list is None. Example of u...
[ "def", "returnValueList", "(", "self", ",", "key_list", ",", "last", "=", "False", ")", ":", "result", "=", "[", "]", "row", "=", "self", ".", "returnOneEntry", "(", "last", "=", "last", ")", "if", "not", "row", ":", "return", "None", "dict_row", "="...
Return a list of key values for the first entry in the current list. If 'last=True', then the last entry is referenced." Returns None is the list is empty. If a key is missing, then that entry in the list is None. Example of use: >>> test = [ ... {"name": "Jim", "...
[ "Return", "a", "list", "of", "key", "values", "for", "the", "first", "entry", "in", "the", "current", "list", ".", "If", "last", "=", "True", "then", "the", "last", "entry", "is", "referenced", "." ]
train
https://github.com/MakerReduxCorp/PLOD/blob/707502cd928e5be6bd5e46d7f6de7da0e188cf1e/PLOD/__init__.py#L1333-L1365
radjkarl/fancyTools
fancytools/math/execOnSubArrays.py
execOnSubArrays
def execOnSubArrays(arrs, fn, splitX, splitY): """ execute a function(on or multiple arrays) only on sub sections works only on 2d arrays at the moment >>> a1 = np.ones((1000,1000)) >>> a2 = np.ones((1000,1000)) >>> out = execOnSubArrays((a1,a2), lambda sa1,sa2: sa1+as2, splitX=10, splitY=1...
python
def execOnSubArrays(arrs, fn, splitX, splitY): """ execute a function(on or multiple arrays) only on sub sections works only on 2d arrays at the moment >>> a1 = np.ones((1000,1000)) >>> a2 = np.ones((1000,1000)) >>> out = execOnSubArrays((a1,a2), lambda sa1,sa2: sa1+as2, splitX=10, splitY=1...
[ "def", "execOnSubArrays", "(", "arrs", ",", "fn", ",", "splitX", ",", "splitY", ")", ":", "if", "type", "(", "arrs", ")", "not", "in", "(", "tuple", ",", "list", ")", ":", "arrs", "=", "(", "arrs", ",", ")", "s0", ",", "s1", "=", "arrs", "[", ...
execute a function(on or multiple arrays) only on sub sections works only on 2d arrays at the moment >>> a1 = np.ones((1000,1000)) >>> a2 = np.ones((1000,1000)) >>> out = execOnSubArrays((a1,a2), lambda sa1,sa2: sa1+as2, splitX=10, splitY=10)
[ "execute", "a", "function", "(", "on", "or", "multiple", "arrays", ")", "only", "on", "sub", "sections", "works", "only", "on", "2d", "arrays", "at", "the", "moment" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/execOnSubArrays.py#L7-L44
theirc/rapidsms-multitenancy
multitenancy/admin.py
TenantGroupAdmin.get_queryset
def get_queryset(self, request): """Limit to TenantGroups that this user can access.""" qs = super(TenantGroupAdmin, self).get_queryset(request) if not request.user.is_superuser: qs = qs.filter(tenantrole__user=request.user, tenantrole__role=TenantRole.ROLE...
python
def get_queryset(self, request): """Limit to TenantGroups that this user can access.""" qs = super(TenantGroupAdmin, self).get_queryset(request) if not request.user.is_superuser: qs = qs.filter(tenantrole__user=request.user, tenantrole__role=TenantRole.ROLE...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "super", "(", "TenantGroupAdmin", ",", "self", ")", ".", "get_queryset", "(", "request", ")", "if", "not", "request", ".", "user", ".", "is_superuser", ":", "qs", "=", "qs", ".", ...
Limit to TenantGroups that this user can access.
[ "Limit", "to", "TenantGroups", "that", "this", "user", "can", "access", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/admin.py#L67-L73
theirc/rapidsms-multitenancy
multitenancy/admin.py
TenantAdmin.get_queryset
def get_queryset(self, request): """Limit to Tenants that this user can access.""" qs = super(TenantAdmin, self).get_queryset(request) if not request.user.is_superuser: tenants_by_group_manager_role = qs.filter( group__tenantrole__user=request.user, gr...
python
def get_queryset(self, request): """Limit to Tenants that this user can access.""" qs = super(TenantAdmin, self).get_queryset(request) if not request.user.is_superuser: tenants_by_group_manager_role = qs.filter( group__tenantrole__user=request.user, gr...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "super", "(", "TenantAdmin", ",", "self", ")", ".", "get_queryset", "(", "request", ")", "if", "not", "request", ".", "user", ".", "is_superuser", ":", "tenants_by_group_manager_role", ...
Limit to Tenants that this user can access.
[ "Limit", "to", "Tenants", "that", "this", "user", "can", "access", "." ]
train
https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/admin.py#L129-L142
radjkarl/fancyTools
fancytools/pystructure/headerSetter/headerSetter.py
setHeader
def setHeader(package_path, header_start='', header_end='', header_text='', remove_header=False, exclude_init=True, exclude_empty_files=True): """ Adds, modifies removes a header text in all *.py files in a python package header_start -> string indicating the begin...
python
def setHeader(package_path, header_start='', header_end='', header_text='', remove_header=False, exclude_init=True, exclude_empty_files=True): """ Adds, modifies removes a header text in all *.py files in a python package header_start -> string indicating the begin...
[ "def", "setHeader", "(", "package_path", ",", "header_start", "=", "''", ",", "header_end", "=", "''", ",", "header_text", "=", "''", ",", "remove_header", "=", "False", ",", "exclude_init", "=", "True", ",", "exclude_empty_files", "=", "True", ")", ":", "...
Adds, modifies removes a header text in all *.py files in a python package header_start -> string indicating the begin of the header e.g. '#<<<<<<<<<' header_text -> the header text e.g. '#copyright John Doe 2033\n#licensed under GPLv3' header_end -> string indicating the end of the header e.g. '#>>>>>>>>>...
[ "Adds", "modifies", "removes", "a", "header", "text", "in", "all", "*", ".", "py", "files", "in", "a", "python", "package" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/pystructure/headerSetter/headerSetter.py#L11-L37
datadesk/django-greeking
greeking/jabberwocky.py
get_html
def get_html(grafs): """ Renders the grafs provided in HTML by wrapping them in <p> tags. Linebreaks are replaced with <br> tags. """ html = [format_html('<p>{}</p>', p) for p in grafs] html = [p.replace("\n", "<br>") for p in html] return format_html(six.text_type('\n\n'.join(html)))
python
def get_html(grafs): """ Renders the grafs provided in HTML by wrapping them in <p> tags. Linebreaks are replaced with <br> tags. """ html = [format_html('<p>{}</p>', p) for p in grafs] html = [p.replace("\n", "<br>") for p in html] return format_html(six.text_type('\n\n'.join(html)))
[ "def", "get_html", "(", "grafs", ")", ":", "html", "=", "[", "format_html", "(", "'<p>{}</p>'", ",", "p", ")", "for", "p", "in", "grafs", "]", "html", "=", "[", "p", ".", "replace", "(", "\"\\n\"", ",", "\"<br>\"", ")", "for", "p", "in", "html", ...
Renders the grafs provided in HTML by wrapping them in <p> tags. Linebreaks are replaced with <br> tags.
[ "Renders", "the", "grafs", "provided", "in", "HTML", "by", "wrapping", "them", "in", "<p", ">", "tags", "." ]
train
https://github.com/datadesk/django-greeking/blob/72509c94952279503bbe8d5a710c1fd344da0670/greeking/jabberwocky.py#L53-L61
ronaldguillen/wave
wave/parsers.py
FormParser.parse
def parse(self, stream, media_type=None, parser_context=None): """ Parses the incoming bytestream as a URL encoded form, and returns the resulting QueryDict. """ parser_context = parser_context or {} encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) ...
python
def parse(self, stream, media_type=None, parser_context=None): """ Parses the incoming bytestream as a URL encoded form, and returns the resulting QueryDict. """ parser_context = parser_context or {} encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) ...
[ "def", "parse", "(", "self", ",", "stream", ",", "media_type", "=", "None", ",", "parser_context", "=", "None", ")", ":", "parser_context", "=", "parser_context", "or", "{", "}", "encoding", "=", "parser_context", ".", "get", "(", "'encoding'", ",", "setti...
Parses the incoming bytestream as a URL encoded form, and returns the resulting QueryDict.
[ "Parses", "the", "incoming", "bytestream", "as", "a", "URL", "encoded", "form", "and", "returns", "the", "resulting", "QueryDict", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/parsers.py#L79-L87
ronaldguillen/wave
wave/parsers.py
MultiPartParser.parse
def parse(self, stream, media_type=None, parser_context=None): """ Parses the incoming bytestream as a multipart encoded form, and returns a DataAndFiles object. `.data` will be a `QueryDict` containing all the form parameters. `.files` will be a `QueryDict` containing all the f...
python
def parse(self, stream, media_type=None, parser_context=None): """ Parses the incoming bytestream as a multipart encoded form, and returns a DataAndFiles object. `.data` will be a `QueryDict` containing all the form parameters. `.files` will be a `QueryDict` containing all the f...
[ "def", "parse", "(", "self", ",", "stream", ",", "media_type", "=", "None", ",", "parser_context", "=", "None", ")", ":", "parser_context", "=", "parser_context", "or", "{", "}", "request", "=", "parser_context", "[", "'request'", "]", "encoding", "=", "pa...
Parses the incoming bytestream as a multipart encoded form, and returns a DataAndFiles object. `.data` will be a `QueryDict` containing all the form parameters. `.files` will be a `QueryDict` containing all the form files.
[ "Parses", "the", "incoming", "bytestream", "as", "a", "multipart", "encoded", "form", "and", "returns", "a", "DataAndFiles", "object", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/parsers.py#L97-L117
ronaldguillen/wave
wave/parsers.py
FileUploadParser.parse
def parse(self, stream, media_type=None, parser_context=None): """ Treats the incoming bytestream as a raw file upload and returns a `DataAndFiles` object. `.data` will be None (we expect request body to be a file content). `.files` will be a `QueryDict` containing one 'file' el...
python
def parse(self, stream, media_type=None, parser_context=None): """ Treats the incoming bytestream as a raw file upload and returns a `DataAndFiles` object. `.data` will be None (we expect request body to be a file content). `.files` will be a `QueryDict` containing one 'file' el...
[ "def", "parse", "(", "self", ",", "stream", ",", "media_type", "=", "None", ",", "parser_context", "=", "None", ")", ":", "parser_context", "=", "parser_context", "or", "{", "}", "request", "=", "parser_context", "[", "'request'", "]", "encoding", "=", "pa...
Treats the incoming bytestream as a raw file upload and returns a `DataAndFiles` object. `.data` will be None (we expect request body to be a file content). `.files` will be a `QueryDict` containing one 'file' element.
[ "Treats", "the", "incoming", "bytestream", "as", "a", "raw", "file", "upload", "and", "returns", "a", "DataAndFiles", "object", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/parsers.py#L126-L189
ronaldguillen/wave
wave/parsers.py
FileUploadParser.get_filename
def get_filename(self, stream, media_type, parser_context): """ Detects the uploaded file name. First searches a 'filename' url kwarg. Then tries to parse Content-Disposition header. """ try: return parser_context['kwargs']['filename'] except KeyError: ...
python
def get_filename(self, stream, media_type, parser_context): """ Detects the uploaded file name. First searches a 'filename' url kwarg. Then tries to parse Content-Disposition header. """ try: return parser_context['kwargs']['filename'] except KeyError: ...
[ "def", "get_filename", "(", "self", ",", "stream", ",", "media_type", ",", "parser_context", ")", ":", "try", ":", "return", "parser_context", "[", "'kwargs'", "]", "[", "'filename'", "]", "except", "KeyError", ":", "pass", "try", ":", "meta", "=", "parser...
Detects the uploaded file name. First searches a 'filename' url kwarg. Then tries to parse Content-Disposition header.
[ "Detects", "the", "uploaded", "file", "name", ".", "First", "searches", "a", "filename", "url", "kwarg", ".", "Then", "tries", "to", "parse", "Content", "-", "Disposition", "header", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/parsers.py#L191-L209
ronaldguillen/wave
wave/parsers.py
FileUploadParser.get_encoded_filename
def get_encoded_filename(self, filename_parm): """ Handle encoded filenames per RFC6266. See also: http://tools.ietf.org/html/rfc2231#section-4 """ encoded_filename = force_text(filename_parm['filename*']) try: charset, lang, filename = encoded_filename.split(...
python
def get_encoded_filename(self, filename_parm): """ Handle encoded filenames per RFC6266. See also: http://tools.ietf.org/html/rfc2231#section-4 """ encoded_filename = force_text(filename_parm['filename*']) try: charset, lang, filename = encoded_filename.split(...
[ "def", "get_encoded_filename", "(", "self", ",", "filename_parm", ")", ":", "encoded_filename", "=", "force_text", "(", "filename_parm", "[", "'filename*'", "]", ")", "try", ":", "charset", ",", "lang", ",", "filename", "=", "encoded_filename", ".", "split", "...
Handle encoded filenames per RFC6266. See also: http://tools.ietf.org/html/rfc2231#section-4
[ "Handle", "encoded", "filenames", "per", "RFC6266", ".", "See", "also", ":", "http", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc2231#section", "-", "4" ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/parsers.py#L211-L222
edwards-lab/MVtest
meanvar/mvstandardizer.py
Standardizer.standardize
def standardize(self): """Standardize the variables within a range [-1.0 and 1.0] This replaces the local copies of this data. When it's time to scale back, use destandardize from the datasource for that. """ nonmissing = numpy.invert(self.missing) nmcount = numpy.sum...
python
def standardize(self): """Standardize the variables within a range [-1.0 and 1.0] This replaces the local copies of this data. When it's time to scale back, use destandardize from the datasource for that. """ nonmissing = numpy.invert(self.missing) nmcount = numpy.sum...
[ "def", "standardize", "(", "self", ")", ":", "nonmissing", "=", "numpy", ".", "invert", "(", "self", ".", "missing", ")", "nmcount", "=", "numpy", ".", "sum", "(", "nonmissing", ")", "self", ".", "covariates", "=", "[", "]", "self", ".", "phenotypes", ...
Standardize the variables within a range [-1.0 and 1.0] This replaces the local copies of this data. When it's time to scale back, use destandardize from the datasource for that.
[ "Standardize", "the", "variables", "within", "a", "range", "[", "-", "1", ".", "0", "and", "1", ".", "0", "]" ]
train
https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/meanvar/mvstandardizer.py#L42-L69
edwards-lab/MVtest
meanvar/mvstandardizer.py
Standardizer.destandardize
def destandardize(self, estimates, se, **kwargs): """Revert the betas and variance components back to the original scale. """ pvalues = kwargs["pvalues"] v = kwargs["v"] nonmissing=kwargs["nonmissing"] pheno = self.datasource.phenotype_data[self.idx][self.datasource.phen...
python
def destandardize(self, estimates, se, **kwargs): """Revert the betas and variance components back to the original scale. """ pvalues = kwargs["pvalues"] v = kwargs["v"] nonmissing=kwargs["nonmissing"] pheno = self.datasource.phenotype_data[self.idx][self.datasource.phen...
[ "def", "destandardize", "(", "self", ",", "estimates", ",", "se", ",", "*", "*", "kwargs", ")", ":", "pvalues", "=", "kwargs", "[", "\"pvalues\"", "]", "v", "=", "kwargs", "[", "\"v\"", "]", "nonmissing", "=", "kwargs", "[", "\"nonmissing\"", "]", "phe...
Revert the betas and variance components back to the original scale.
[ "Revert", "the", "betas", "and", "variance", "components", "back", "to", "the", "original", "scale", "." ]
train
https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/meanvar/mvstandardizer.py#L71-L121
yougov/vr.builder
vr/builder/models.py
update_buildpack
def update_buildpack(url, packs_dir=PACKS_HOME, vcs_type=None): """ Checkout/update a buildpack, given its URL. Buildpacks are checked out into folders whose names start with something nicely readable, followed by an MD5 hash of the full URL (thus distinguishing two buildpacks with the same 'name' ...
python
def update_buildpack(url, packs_dir=PACKS_HOME, vcs_type=None): """ Checkout/update a buildpack, given its URL. Buildpacks are checked out into folders whose names start with something nicely readable, followed by an MD5 hash of the full URL (thus distinguishing two buildpacks with the same 'name' ...
[ "def", "update_buildpack", "(", "url", ",", "packs_dir", "=", "PACKS_HOME", ",", "vcs_type", "=", "None", ")", ":", "defrag", "=", "_defrag", "(", "urllib", ".", "parse", ".", "urldefrag", "(", "url", ")", ")", "bpfolder", "=", "repo", ".", "basename", ...
Checkout/update a buildpack, given its URL. Buildpacks are checked out into folders whose names start with something nicely readable, followed by an MD5 hash of the full URL (thus distinguishing two buildpacks with the same 'name' but different URLs).
[ "Checkout", "/", "update", "a", "buildpack", "given", "its", "URL", "." ]
train
https://github.com/yougov/vr.builder/blob/666b28f997d0cff52e82eed4ace1c73fee4b2136/vr/builder/models.py#L149-L165
yougov/vr.builder
vr/builder/models.py
BuildPack.detect
def detect(self, app): """ Given an app, run detect script on it to determine whether it can be built with this pack. Return True/False. """ script = os.path.join(self.folder, 'bin', 'detect') cmd = '%s %s' % (script, app.folder) result = run(cmd) return ...
python
def detect(self, app): """ Given an app, run detect script on it to determine whether it can be built with this pack. Return True/False. """ script = os.path.join(self.folder, 'bin', 'detect') cmd = '%s %s' % (script, app.folder) result = run(cmd) return ...
[ "def", "detect", "(", "self", ",", "app", ")", ":", "script", "=", "os", ".", "path", ".", "join", "(", "self", ".", "folder", ",", "'bin'", ",", "'detect'", ")", "cmd", "=", "'%s %s'", "%", "(", "script", ",", "app", ".", "folder", ")", "result"...
Given an app, run detect script on it to determine whether it can be built with this pack. Return True/False.
[ "Given", "an", "app", "run", "detect", "script", "on", "it", "to", "determine", "whether", "it", "can", "be", "built", "with", "this", "pack", ".", "Return", "True", "/", "False", "." ]
train
https://github.com/yougov/vr.builder/blob/666b28f997d0cff52e82eed4ace1c73fee4b2136/vr/builder/models.py#L46-L54
yougov/vr.builder
vr/builder/models.py
App.tar
def tar(self, appname, appversion): """ Given an app name and version to be used in the tarball name, create a tar.bz2 file with all of this folder's contents inside. Return a Build object with attributes for appname, appversion, time, and path. """ name_tmpl = '...
python
def tar(self, appname, appversion): """ Given an app name and version to be used in the tarball name, create a tar.bz2 file with all of this folder's contents inside. Return a Build object with attributes for appname, appversion, time, and path. """ name_tmpl = '...
[ "def", "tar", "(", "self", ",", "appname", ",", "appversion", ")", ":", "name_tmpl", "=", "'%(app)s-%(version)s-%(time)s.tar.bz2'", "time", "=", "utc", ".", "now", "(", ")", "name", "=", "name_tmpl", "%", "{", "'app'", ":", "appname", ",", "'version'", ":"...
Given an app name and version to be used in the tarball name, create a tar.bz2 file with all of this folder's contents inside. Return a Build object with attributes for appname, appversion, time, and path.
[ "Given", "an", "app", "name", "and", "version", "to", "be", "used", "in", "the", "tarball", "name", "create", "a", "tar", ".", "bz2", "file", "with", "all", "of", "this", "folder", "s", "contents", "inside", "." ]
train
https://github.com/yougov/vr.builder/blob/666b28f997d0cff52e82eed4ace1c73fee4b2136/vr/builder/models.py#L94-L114
rosenbrockc/acorn
acorn/config.py
config_dir
def config_dir(mkcustom=False): """Returns the configuration directory for custom package settings. """ from acorn.utility import reporoot from acorn.base import testmode from os import path alternate = path.join(path.abspath(path.expanduser("~")), ".acorn") if testmode or (not path.isdir(al...
python
def config_dir(mkcustom=False): """Returns the configuration directory for custom package settings. """ from acorn.utility import reporoot from acorn.base import testmode from os import path alternate = path.join(path.abspath(path.expanduser("~")), ".acorn") if testmode or (not path.isdir(al...
[ "def", "config_dir", "(", "mkcustom", "=", "False", ")", ":", "from", "acorn", ".", "utility", "import", "reporoot", "from", "acorn", ".", "base", "import", "testmode", "from", "os", "import", "path", "alternate", "=", "path", ".", "join", "(", "path", "...
Returns the configuration directory for custom package settings.
[ "Returns", "the", "configuration", "directory", "for", "custom", "package", "settings", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/config.py#L16-L31
rosenbrockc/acorn
acorn/config.py
_package_path
def _package_path(package): """Returns the full path to the default package configuration file. Args: package (str): name of the python package to return a path for. """ from os import path confdir = config_dir() return path.join(confdir, "{}.cfg".format(package))
python
def _package_path(package): """Returns the full path to the default package configuration file. Args: package (str): name of the python package to return a path for. """ from os import path confdir = config_dir() return path.join(confdir, "{}.cfg".format(package))
[ "def", "_package_path", "(", "package", ")", ":", "from", "os", "import", "path", "confdir", "=", "config_dir", "(", ")", "return", "path", ".", "join", "(", "confdir", ",", "\"{}.cfg\"", ".", "format", "(", "package", ")", ")" ]
Returns the full path to the default package configuration file. Args: package (str): name of the python package to return a path for.
[ "Returns", "the", "full", "path", "to", "the", "default", "package", "configuration", "file", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/config.py#L33-L41
rosenbrockc/acorn
acorn/config.py
_read_single
def _read_single(parser, filepath): """Reads a single config file into the parser, silently failing if the file does not exist. Args: parser (ConfigParser): parser to read the file into. filepath (str): full path to the config file. """ from os import path global packages if path.is...
python
def _read_single(parser, filepath): """Reads a single config file into the parser, silently failing if the file does not exist. Args: parser (ConfigParser): parser to read the file into. filepath (str): full path to the config file. """ from os import path global packages if path.is...
[ "def", "_read_single", "(", "parser", ",", "filepath", ")", ":", "from", "os", "import", "path", "global", "packages", "if", "path", ".", "isfile", "(", "filepath", ")", ":", "parser", ".", "readfp", "(", "open", "(", "filepath", ")", ")" ]
Reads a single config file into the parser, silently failing if the file does not exist. Args: parser (ConfigParser): parser to read the file into. filepath (str): full path to the config file.
[ "Reads", "a", "single", "config", "file", "into", "the", "parser", "silently", "failing", "if", "the", "file", "does", "not", "exist", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/config.py#L43-L54
rosenbrockc/acorn
acorn/config.py
settings
def settings(package, reload_=False): """Returns the config settings for the specified package. Args: package (str): name of the python package to get settings for. """ global packages if package not in packages or reload_: from os import path result = CaseConfigParser() ...
python
def settings(package, reload_=False): """Returns the config settings for the specified package. Args: package (str): name of the python package to get settings for. """ global packages if package not in packages or reload_: from os import path result = CaseConfigParser() ...
[ "def", "settings", "(", "package", ",", "reload_", "=", "False", ")", ":", "global", "packages", "if", "package", "not", "in", "packages", "or", "reload_", ":", "from", "os", "import", "path", "result", "=", "CaseConfigParser", "(", ")", "if", "package", ...
Returns the config settings for the specified package. Args: package (str): name of the python package to get settings for.
[ "Returns", "the", "config", "settings", "for", "the", "specified", "package", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/config.py#L56-L72
rosenbrockc/acorn
acorn/config.py
descriptors
def descriptors(package): """Returns a dictionary of descriptors deserialized from JSON for the specified package. Args: package (str): name of the python package to get settings for. """ from os import path dpath = _descriptor_path(package) if path.isfile(dpath): import jso...
python
def descriptors(package): """Returns a dictionary of descriptors deserialized from JSON for the specified package. Args: package (str): name of the python package to get settings for. """ from os import path dpath = _descriptor_path(package) if path.isfile(dpath): import jso...
[ "def", "descriptors", "(", "package", ")", ":", "from", "os", "import", "path", "dpath", "=", "_descriptor_path", "(", "package", ")", "if", "path", ".", "isfile", "(", "dpath", ")", ":", "import", "json", "with", "open", "(", "dpath", ")", "as", "f", ...
Returns a dictionary of descriptors deserialized from JSON for the specified package. Args: package (str): name of the python package to get settings for.
[ "Returns", "a", "dictionary", "of", "descriptors", "deserialized", "from", "JSON", "for", "the", "specified", "package", "." ]
train
https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/config.py#L83-L98
walidsa3d/torrentutils
torrentutils/core.py
parse_magnet
def parse_magnet(magnet_uri): """returns a dictionary of parameters contained in a magnet uri""" data = defaultdict(list) if not magnet_uri.startswith('magnet:'): return data else: magnet_uri = magnet_uri.strip('magnet:?') for segment in magnet_uri.split('&'): key, va...
python
def parse_magnet(magnet_uri): """returns a dictionary of parameters contained in a magnet uri""" data = defaultdict(list) if not magnet_uri.startswith('magnet:'): return data else: magnet_uri = magnet_uri.strip('magnet:?') for segment in magnet_uri.split('&'): key, va...
[ "def", "parse_magnet", "(", "magnet_uri", ")", ":", "data", "=", "defaultdict", "(", "list", ")", "if", "not", "magnet_uri", ".", "startswith", "(", "'magnet:'", ")", ":", "return", "data", "else", ":", "magnet_uri", "=", "magnet_uri", ".", "strip", "(", ...
returns a dictionary of parameters contained in a magnet uri
[ "returns", "a", "dictionary", "of", "parameters", "contained", "in", "a", "magnet", "uri" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L19-L36
walidsa3d/torrentutils
torrentutils/core.py
parse_torrent_file
def parse_torrent_file(torrent): """parse local or remote torrent file""" link_re = re.compile(r'^(http?s|ftp)') if link_re.match(torrent): response = requests.get(torrent, headers=HEADERS, timeout=20) data = parse_torrent_buffer(response.content) elif os.path.isfile(torrent): wi...
python
def parse_torrent_file(torrent): """parse local or remote torrent file""" link_re = re.compile(r'^(http?s|ftp)') if link_re.match(torrent): response = requests.get(torrent, headers=HEADERS, timeout=20) data = parse_torrent_buffer(response.content) elif os.path.isfile(torrent): wi...
[ "def", "parse_torrent_file", "(", "torrent", ")", ":", "link_re", "=", "re", ".", "compile", "(", "r'^(http?s|ftp)'", ")", "if", "link_re", ".", "match", "(", "torrent", ")", ":", "response", "=", "requests", ".", "get", "(", "torrent", ",", "headers", "...
parse local or remote torrent file
[ "parse", "local", "or", "remote", "torrent", "file" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L48-L59
walidsa3d/torrentutils
torrentutils/core.py
parse_torrent_buffer
def parse_torrent_buffer(torrent): """parse a torrent buffer""" md = {} try: metadata = bencode.bdecode(torrent) except bencode.BTL.BTFailure: print 'Not a valid encoded torrent' return None if 'announce-list' in metadata: md['trackers'] = [] for tracker in me...
python
def parse_torrent_buffer(torrent): """parse a torrent buffer""" md = {} try: metadata = bencode.bdecode(torrent) except bencode.BTL.BTFailure: print 'Not a valid encoded torrent' return None if 'announce-list' in metadata: md['trackers'] = [] for tracker in me...
[ "def", "parse_torrent_buffer", "(", "torrent", ")", ":", "md", "=", "{", "}", "try", ":", "metadata", "=", "bencode", ".", "bdecode", "(", "torrent", ")", "except", "bencode", ".", "BTL", ".", "BTFailure", ":", "print", "'Not a valid encoded torrent'", "retu...
parse a torrent buffer
[ "parse", "a", "torrent", "buffer" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L62-L110
walidsa3d/torrentutils
torrentutils/core.py
hsize
def hsize(bytes): """converts a bytes to human-readable format""" sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] if bytes == 0: return '0 Byte' i = int(math.floor(math.log(bytes) / math.log(1024))) r = round(bytes / math.pow(1024, i), 2) return str(r) + '' + sizes[i]
python
def hsize(bytes): """converts a bytes to human-readable format""" sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] if bytes == 0: return '0 Byte' i = int(math.floor(math.log(bytes) / math.log(1024))) r = round(bytes / math.pow(1024, i), 2) return str(r) + '' + sizes[i]
[ "def", "hsize", "(", "bytes", ")", ":", "sizes", "=", "[", "'Bytes'", ",", "'KB'", ",", "'MB'", ",", "'GB'", ",", "'TB'", "]", "if", "bytes", "==", "0", ":", "return", "'0 Byte'", "i", "=", "int", "(", "math", ".", "floor", "(", "math", ".", "l...
converts a bytes to human-readable format
[ "converts", "a", "bytes", "to", "human", "-", "readable", "format" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L120-L127
walidsa3d/torrentutils
torrentutils/core.py
ratio
def ratio(leechs, seeds): """ computes the torrent ratio""" try: ratio = float(seeds) / float(leechs) except ZeroDivisionError: ratio = int(seeds) return ratio
python
def ratio(leechs, seeds): """ computes the torrent ratio""" try: ratio = float(seeds) / float(leechs) except ZeroDivisionError: ratio = int(seeds) return ratio
[ "def", "ratio", "(", "leechs", ",", "seeds", ")", ":", "try", ":", "ratio", "=", "float", "(", "seeds", ")", "/", "float", "(", "leechs", ")", "except", "ZeroDivisionError", ":", "ratio", "=", "int", "(", "seeds", ")", "return", "ratio" ]
computes the torrent ratio
[ "computes", "the", "torrent", "ratio" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L130-L136
walidsa3d/torrentutils
torrentutils/core.py
to_torrent
def to_torrent(magnet_link): """turn a magnet link to a link to a torrent file""" infoHash = parse_magnet(magnet_link)['infoHash'] torcache = 'http://torcache.net/torrent/' + infoHash + '.torrent' torrage = 'https://torrage.com/torrent/' + infoHash + '.torrent' reflektor = 'http://reflektor.karmorra...
python
def to_torrent(magnet_link): """turn a magnet link to a link to a torrent file""" infoHash = parse_magnet(magnet_link)['infoHash'] torcache = 'http://torcache.net/torrent/' + infoHash + '.torrent' torrage = 'https://torrage.com/torrent/' + infoHash + '.torrent' reflektor = 'http://reflektor.karmorra...
[ "def", "to_torrent", "(", "magnet_link", ")", ":", "infoHash", "=", "parse_magnet", "(", "magnet_link", ")", "[", "'infoHash'", "]", "torcache", "=", "'http://torcache.net/torrent/'", "+", "infoHash", "+", "'.torrent'", "torrage", "=", "'https://torrage.com/torrent/'"...
turn a magnet link to a link to a torrent file
[ "turn", "a", "magnet", "link", "to", "a", "link", "to", "a", "torrent", "file" ]
train
https://github.com/walidsa3d/torrentutils/blob/a13d637c4222934e84922ebc63d59efb29fe9e39/torrentutils/core.py#L139-L157
datadesk/django-greeking
greeking/latimes_ipsum.py
get_story
def get_story(): """ Returns a boiler plate story as an object. """ return Story( slug="la-data-latimes-ipsum", headline="This is not a headline", byline="This is not a byline", pub_date=datetime.now(), canonical_url="http://www.example.com/", kicker="This...
python
def get_story(): """ Returns a boiler plate story as an object. """ return Story( slug="la-data-latimes-ipsum", headline="This is not a headline", byline="This is not a byline", pub_date=datetime.now(), canonical_url="http://www.example.com/", kicker="This...
[ "def", "get_story", "(", ")", ":", "return", "Story", "(", "slug", "=", "\"la-data-latimes-ipsum\"", ",", "headline", "=", "\"This is not a headline\"", ",", "byline", "=", "\"This is not a byline\"", ",", "pub_date", "=", "datetime", ".", "now", "(", ")", ",", ...
Returns a boiler plate story as an object.
[ "Returns", "a", "boiler", "plate", "story", "as", "an", "object", "." ]
train
https://github.com/datadesk/django-greeking/blob/72509c94952279503bbe8d5a710c1fd344da0670/greeking/latimes_ipsum.py#L80-L96
datadesk/django-greeking
greeking/latimes_ipsum.py
get_related_items
def get_related_items(count=4): """ Returns the requested number of boiler plate related items as a list. """ defaults = dict( headline="This is not a headline", url="http://www.example.com/", image=get_image(400, 400) ) return [RelatedItem(**defaults) for x in range(0, c...
python
def get_related_items(count=4): """ Returns the requested number of boiler plate related items as a list. """ defaults = dict( headline="This is not a headline", url="http://www.example.com/", image=get_image(400, 400) ) return [RelatedItem(**defaults) for x in range(0, c...
[ "def", "get_related_items", "(", "count", "=", "4", ")", ":", "defaults", "=", "dict", "(", "headline", "=", "\"This is not a headline\"", ",", "url", "=", "\"http://www.example.com/\"", ",", "image", "=", "get_image", "(", "400", ",", "400", ")", ")", "retu...
Returns the requested number of boiler plate related items as a list.
[ "Returns", "the", "requested", "number", "of", "boiler", "plate", "related", "items", "as", "a", "list", "." ]
train
https://github.com/datadesk/django-greeking/blob/72509c94952279503bbe8d5a710c1fd344da0670/greeking/latimes_ipsum.py#L99-L108
datadesk/django-greeking
greeking/latimes_ipsum.py
get_image
def get_image(width, height=None, background_color="cccccc", random_background_color=False): """ Returns image with caption, credit, and random background color as requested. """ return Image( url=placeholdit.get_url( width, height=height, background_color=bac...
python
def get_image(width, height=None, background_color="cccccc", random_background_color=False): """ Returns image with caption, credit, and random background color as requested. """ return Image( url=placeholdit.get_url( width, height=height, background_color=bac...
[ "def", "get_image", "(", "width", ",", "height", "=", "None", ",", "background_color", "=", "\"cccccc\"", ",", "random_background_color", "=", "False", ")", ":", "return", "Image", "(", "url", "=", "placeholdit", ".", "get_url", "(", "width", ",", "height", ...
Returns image with caption, credit, and random background color as requested.
[ "Returns", "image", "with", "caption", "credit", "and", "random", "background", "color", "as", "requested", "." ]
train
https://github.com/datadesk/django-greeking/blob/72509c94952279503bbe8d5a710c1fd344da0670/greeking/latimes_ipsum.py#L111-L124
ronaldguillen/wave
wave/validators.py
UniqueValidator.set_context
def set_context(self, serializer_field): """ This hook is called by the serializer instance, prior to the validation call being made. """ # Determine the underlying model field name. This may not be the # same as the serializer field name if `source=<>` is set. se...
python
def set_context(self, serializer_field): """ This hook is called by the serializer instance, prior to the validation call being made. """ # Determine the underlying model field name. This may not be the # same as the serializer field name if `source=<>` is set. se...
[ "def", "set_context", "(", "self", ",", "serializer_field", ")", ":", "# Determine the underlying model field name. This may not be the", "# same as the serializer field name if `source=<>` is set.", "self", ".", "field_name", "=", "serializer_field", ".", "source_attrs", "[", "0...
This hook is called by the serializer instance, prior to the validation call being made.
[ "This", "hook", "is", "called", "by", "the", "serializer", "instance", "prior", "to", "the", "validation", "call", "being", "made", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L31-L40
ronaldguillen/wave
wave/validators.py
UniqueValidator.filter_queryset
def filter_queryset(self, value, queryset): """ Filter the queryset to all instances matching the given attribute. """ filter_kwargs = {self.field_name: value} return queryset.filter(**filter_kwargs)
python
def filter_queryset(self, value, queryset): """ Filter the queryset to all instances matching the given attribute. """ filter_kwargs = {self.field_name: value} return queryset.filter(**filter_kwargs)
[ "def", "filter_queryset", "(", "self", ",", "value", ",", "queryset", ")", ":", "filter_kwargs", "=", "{", "self", ".", "field_name", ":", "value", "}", "return", "queryset", ".", "filter", "(", "*", "*", "filter_kwargs", ")" ]
Filter the queryset to all instances matching the given attribute.
[ "Filter", "the", "queryset", "to", "all", "instances", "matching", "the", "given", "attribute", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L42-L47
ronaldguillen/wave
wave/validators.py
UniqueValidator.exclude_current_instance
def exclude_current_instance(self, queryset): """ If an instance is being updated, then do not include that instance itself as a uniqueness conflict. """ if self.instance is not None: return queryset.exclude(pk=self.instance.pk) return queryset
python
def exclude_current_instance(self, queryset): """ If an instance is being updated, then do not include that instance itself as a uniqueness conflict. """ if self.instance is not None: return queryset.exclude(pk=self.instance.pk) return queryset
[ "def", "exclude_current_instance", "(", "self", ",", "queryset", ")", ":", "if", "self", ".", "instance", "is", "not", "None", ":", "return", "queryset", ".", "exclude", "(", "pk", "=", "self", ".", "instance", ".", "pk", ")", "return", "queryset" ]
If an instance is being updated, then do not include that instance itself as a uniqueness conflict.
[ "If", "an", "instance", "is", "being", "updated", "then", "do", "not", "include", "that", "instance", "itself", "as", "a", "uniqueness", "conflict", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L49-L56
ronaldguillen/wave
wave/validators.py
UniqueTogetherValidator.enforce_required_fields
def enforce_required_fields(self, attrs): """ The `UniqueTogetherValidator` always forces an implied 'required' state on the fields it applies to. """ if self.instance is not None: return missing = { field_name: self.missing_message fo...
python
def enforce_required_fields(self, attrs): """ The `UniqueTogetherValidator` always forces an implied 'required' state on the fields it applies to. """ if self.instance is not None: return missing = { field_name: self.missing_message fo...
[ "def", "enforce_required_fields", "(", "self", ",", "attrs", ")", ":", "if", "self", ".", "instance", "is", "not", "None", ":", "return", "missing", "=", "{", "field_name", ":", "self", ".", "missing_message", "for", "field_name", "in", "self", ".", "field...
The `UniqueTogetherValidator` always forces an implied 'required' state on the fields it applies to.
[ "The", "UniqueTogetherValidator", "always", "forces", "an", "implied", "required", "state", "on", "the", "fields", "it", "applies", "to", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L95-L109
ronaldguillen/wave
wave/validators.py
UniqueTogetherValidator.filter_queryset
def filter_queryset(self, attrs, queryset): """ Filter the queryset to all instances matching the given attributes. """ # If this is an update, then any unprovided field should # have it's value set based on the existing instance attribute. if self.instance is not None: ...
python
def filter_queryset(self, attrs, queryset): """ Filter the queryset to all instances matching the given attributes. """ # If this is an update, then any unprovided field should # have it's value set based on the existing instance attribute. if self.instance is not None: ...
[ "def", "filter_queryset", "(", "self", ",", "attrs", ",", "queryset", ")", ":", "# If this is an update, then any unprovided field should", "# have it's value set based on the existing instance attribute.", "if", "self", ".", "instance", "is", "not", "None", ":", "for", "fi...
Filter the queryset to all instances matching the given attributes.
[ "Filter", "the", "queryset", "to", "all", "instances", "matching", "the", "given", "attributes", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L111-L127
ronaldguillen/wave
wave/validators.py
BaseUniqueForValidator.set_context
def set_context(self, serializer): """ This hook is called by the serializer instance, prior to the validation call being made. """ # Determine the underlying model field names. These may not be the # same as the serializer field names if `source=<>` is set. self....
python
def set_context(self, serializer): """ This hook is called by the serializer instance, prior to the validation call being made. """ # Determine the underlying model field names. These may not be the # same as the serializer field names if `source=<>` is set. self....
[ "def", "set_context", "(", "self", ",", "serializer", ")", ":", "# Determine the underlying model field names. These may not be the", "# same as the serializer field names if `source=<>` is set.", "self", ".", "field_name", "=", "serializer", ".", "fields", "[", "self", ".", ...
This hook is called by the serializer instance, prior to the validation call being made.
[ "This", "hook", "is", "called", "by", "the", "serializer", "instance", "prior", "to", "the", "validation", "call", "being", "made", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L170-L180
ronaldguillen/wave
wave/validators.py
BaseUniqueForValidator.enforce_required_fields
def enforce_required_fields(self, attrs): """ The `UniqueFor<Range>Validator` classes always force an implied 'required' state on the fields they are applied to. """ missing = { field_name: self.missing_message for field_name in [self.field, self.date_fiel...
python
def enforce_required_fields(self, attrs): """ The `UniqueFor<Range>Validator` classes always force an implied 'required' state on the fields they are applied to. """ missing = { field_name: self.missing_message for field_name in [self.field, self.date_fiel...
[ "def", "enforce_required_fields", "(", "self", ",", "attrs", ")", ":", "missing", "=", "{", "field_name", ":", "self", ".", "missing_message", "for", "field_name", "in", "[", "self", ".", "field", ",", "self", ".", "date_field", "]", "if", "field_name", "n...
The `UniqueFor<Range>Validator` classes always force an implied 'required' state on the fields they are applied to.
[ "The", "UniqueFor<Range", ">", "Validator", "classes", "always", "force", "an", "implied", "required", "state", "on", "the", "fields", "they", "are", "applied", "to", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/validators.py#L182-L193
praekelt/panya
panya/view_modifiers/items.py
GetItem.modify
def modify(self, view): """ adds the get item as extra context """ view.params['extra_context'][self.get['name']] = self.get['value'] return view
python
def modify(self, view): """ adds the get item as extra context """ view.params['extra_context'][self.get['name']] = self.get['value'] return view
[ "def", "modify", "(", "self", ",", "view", ")", ":", "view", ".", "params", "[", "'extra_context'", "]", "[", "self", ".", "get", "[", "'name'", "]", "]", "=", "self", ".", "get", "[", "'value'", "]", "return", "view" ]
adds the get item as extra context
[ "adds", "the", "get", "item", "as", "extra", "context" ]
train
https://github.com/praekelt/panya/blob/0fd621e15a7c11a2716a9554a2f820d6259818e5/panya/view_modifiers/items.py#L33-L38
minorg/pastpy
py/src/pastpy/gen/database/impl/online/online_database_configuration.py
OnlineDatabaseConfiguration.write
def write(self, oprot): ''' Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_configuration.OnlineDatabaseConfiguration ''' oprot.write_st...
python
def write(self, oprot): ''' Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_configuration.OnlineDatabaseConfiguration ''' oprot.write_st...
[ "def", "write", "(", "self", ",", "oprot", ")", ":", "oprot", ".", "write_struct_begin", "(", "'OnlineDatabaseConfiguration'", ")", "oprot", ".", "write_field_begin", "(", "name", "=", "'collection_name'", ",", "type", "=", "11", ",", "id", "=", "None", ")",...
Write this object to the given output protocol and return self. :type oprot: thryft.protocol._output_protocol._OutputProtocol :rtype: pastpy.gen.database.impl.online.online_database_configuration.OnlineDatabaseConfiguration
[ "Write", "this", "object", "to", "the", "given", "output", "protocol", "and", "return", "self", "." ]
train
https://github.com/minorg/pastpy/blob/7d5d6d511629481850216565e7451b5dcb8027a9/py/src/pastpy/gen/database/impl/online/online_database_configuration.py#L219-L242
twidi/py-dataql
dataql/resources.py
Filter.get_args_and_kwargs
def get_args_and_kwargs(self): """Return a list and a dict usable as ``*args, **kwargs`` to pass to a callable." If the entity is known to not accept arguments (``self.args`` is ``None``), then this method returns ``None`` for both args and kwargs. Returns ------- tuple...
python
def get_args_and_kwargs(self): """Return a list and a dict usable as ``*args, **kwargs`` to pass to a callable." If the entity is known to not accept arguments (``self.args`` is ``None``), then this method returns ``None`` for both args and kwargs. Returns ------- tuple...
[ "def", "get_args_and_kwargs", "(", "self", ")", ":", "args", "=", "None", "kwargs", "=", "None", "if", "self", ".", "args", ":", "args", "=", "[", "]", "kwargs", "=", "{", "}", "for", "arg", "in", "self", ".", "args", ":", "if", "arg", ".", "is_n...
Return a list and a dict usable as ``*args, **kwargs`` to pass to a callable." If the entity is known to not accept arguments (``self.args`` is ``None``), then this method returns ``None`` for both args and kwargs. Returns ------- tuple (list or None, dict or None) ...
[ "Return", "a", "list", "and", "a", "dict", "usable", "as", "*", "args", "**", "kwargs", "to", "pass", "to", "a", "callable", "." ]
train
https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/resources.py#L355-L381
fogcitymarathoner/s3_mysql_backup
s3_mysql_backup/scripts/get_bucket_list.py
get_bucket_list
def get_bucket_list(): """ Get list of S3 Buckets """ args = parser.parse_args() for b in s3_conn(args.aws_access_key_id, args.aws_secret_access_key).get_all_buckets(): print(''.join([i if ord(i) < 128 else ' ' for i in b.name]))
python
def get_bucket_list(): """ Get list of S3 Buckets """ args = parser.parse_args() for b in s3_conn(args.aws_access_key_id, args.aws_secret_access_key).get_all_buckets(): print(''.join([i if ord(i) < 128 else ' ' for i in b.name]))
[ "def", "get_bucket_list", "(", ")", ":", "args", "=", "parser", ".", "parse_args", "(", ")", "for", "b", "in", "s3_conn", "(", "args", ".", "aws_access_key_id", ",", "args", ".", "aws_secret_access_key", ")", ".", "get_all_buckets", "(", ")", ":", "print",...
Get list of S3 Buckets
[ "Get", "list", "of", "S3", "Buckets" ]
train
https://github.com/fogcitymarathoner/s3_mysql_backup/blob/8a0fb3e51a7b873eb4287d4954548a0dbab0e734/s3_mysql_backup/scripts/get_bucket_list.py#L11-L17
slarse/clanimtk
clanimtk/core.py
_get_back_up_generator
def _get_back_up_generator(frame_function, *args, **kwargs): """Create a generator for the provided animation function that backs up the cursor after a frame. Assumes that the animation function provides a generator that yields strings of constant width and height. Args: frame_function: A funct...
python
def _get_back_up_generator(frame_function, *args, **kwargs): """Create a generator for the provided animation function that backs up the cursor after a frame. Assumes that the animation function provides a generator that yields strings of constant width and height. Args: frame_function: A funct...
[ "def", "_get_back_up_generator", "(", "frame_function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "lines", "=", "next", "(", "frame_function", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", ".", "split", "(", "'\\n'", ")", "width", "...
Create a generator for the provided animation function that backs up the cursor after a frame. Assumes that the animation function provides a generator that yields strings of constant width and height. Args: frame_function: A function that returns a FrameGenerator. args: Arguments for frame...
[ "Create", "a", "generator", "for", "the", "provided", "animation", "function", "that", "backs", "up", "the", "cursor", "after", "a", "frame", ".", "Assumes", "that", "the", "animation", "function", "provides", "a", "generator", "that", "yields", "strings", "of...
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L252-L270
slarse/clanimtk
clanimtk/core.py
_backspaced_single_line_animation
def _backspaced_single_line_animation(animation_, *args, **kwargs): """Turn an animation into an automatically backspaced animation. Args: animation: A function that returns a generator that yields strings for animation frames. args: Arguments for the animation function. kwargs:...
python
def _backspaced_single_line_animation(animation_, *args, **kwargs): """Turn an animation into an automatically backspaced animation. Args: animation: A function that returns a generator that yields strings for animation frames. args: Arguments for the animation function. kwargs:...
[ "def", "_backspaced_single_line_animation", "(", "animation_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "animation_gen", "=", "animation_", "(", "*", "args", ",", "*", "*", "kwargs", ")", "yield", "next", "(", "animation_gen", ")", "# no backing ...
Turn an animation into an automatically backspaced animation. Args: animation: A function that returns a generator that yields strings for animation frames. args: Arguments for the animation function. kwargs: Keyword arguments for the animation function. Returns: the ani...
[ "Turn", "an", "animation", "into", "an", "automatically", "backspaced", "animation", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L273-L288
slarse/clanimtk
clanimtk/core.py
Animate._raise_if_annotated
def _raise_if_annotated(self, func): """Raise TypeError if a function is decorated with Annotate, as such functions cause visual bugs when decorated with Animate. Animate should be wrapped by Annotate instead. Args: func (function): Any callable. Raises: ...
python
def _raise_if_annotated(self, func): """Raise TypeError if a function is decorated with Annotate, as such functions cause visual bugs when decorated with Animate. Animate should be wrapped by Annotate instead. Args: func (function): Any callable. Raises: ...
[ "def", "_raise_if_annotated", "(", "self", ",", "func", ")", ":", "if", "hasattr", "(", "func", ",", "ANNOTATED", ")", "and", "getattr", "(", "func", ",", "ANNOTATED", ")", ":", "msg", "=", "(", "'Functions decorated with {!r} '", "'should not be decorated with ...
Raise TypeError if a function is decorated with Annotate, as such functions cause visual bugs when decorated with Animate. Animate should be wrapped by Annotate instead. Args: func (function): Any callable. Raises: TypeError
[ "Raise", "TypeError", "if", "a", "function", "is", "decorated", "with", "Annotate", "as", "such", "functions", "cause", "visual", "bugs", "when", "decorated", "with", "Animate", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L61-L77
slarse/clanimtk
clanimtk/core.py
Annotate._start_print
def _start_print(self): """Print the start message with or without newline depending on the self._start_no_nl variable. """ if self._start_no_nl: sys.stdout.write(self._start_msg) sys.stdout.flush() else: print(self._start_msg)
python
def _start_print(self): """Print the start message with or without newline depending on the self._start_no_nl variable. """ if self._start_no_nl: sys.stdout.write(self._start_msg) sys.stdout.flush() else: print(self._start_msg)
[ "def", "_start_print", "(", "self", ")", ":", "if", "self", ".", "_start_no_nl", ":", "sys", ".", "stdout", ".", "write", "(", "self", ".", "_start_msg", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "else", ":", "print", "(", "self", ".", "_s...
Print the start message with or without newline depending on the self._start_no_nl variable.
[ "Print", "the", "start", "message", "with", "or", "without", "newline", "depending", "on", "the", "self", ".", "_start_no_nl", "variable", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L125-L133
slarse/clanimtk
clanimtk/core.py
Annotate._sync_call
def _sync_call(self, func): """__call__ function for regular synchronous functions. Args: func: The annotated function. args: Arguments for func. kwargs: Keyword arguments for func. """ @functools.wraps(func) def wrapper(*args, **kwargs): ...
python
def _sync_call(self, func): """__call__ function for regular synchronous functions. Args: func: The annotated function. args: Arguments for func. kwargs: Keyword arguments for func. """ @functools.wraps(func) def wrapper(*args, **kwargs): ...
[ "def", "_sync_call", "(", "self", ",", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_start_msg", ":", "self", ".", "_start_print", "("...
__call__ function for regular synchronous functions. Args: func: The annotated function. args: Arguments for func. kwargs: Keyword arguments for func.
[ "__call__", "function", "for", "regular", "synchronous", "functions", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L146-L165
slarse/clanimtk
clanimtk/core.py
Animation.reset
def reset(self): """Reset the current animation generator.""" animation_gen = self._frame_function(*self._animation_args, **self._animation_kwargs) self._current_generator = itertools.cycle( util.concatechain(animation_gen, self._back_up_g...
python
def reset(self): """Reset the current animation generator.""" animation_gen = self._frame_function(*self._animation_args, **self._animation_kwargs) self._current_generator = itertools.cycle( util.concatechain(animation_gen, self._back_up_g...
[ "def", "reset", "(", "self", ")", ":", "animation_gen", "=", "self", ".", "_frame_function", "(", "*", "self", ".", "_animation_args", ",", "*", "*", "self", ".", "_animation_kwargs", ")", "self", ".", "_current_generator", "=", "itertools", ".", "cycle", ...
Reset the current animation generator.
[ "Reset", "the", "current", "animation", "generator", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L212-L217
slarse/clanimtk
clanimtk/core.py
Animation.get_erase_frame
def get_erase_frame(self): """Return a frame that completely erases the current frame, and then backs up. Assumes that the current frame is of constant width.""" lines = self._current_frame.split('\n') width = len(lines[0]) height = len(lines) line = ' ' * width ...
python
def get_erase_frame(self): """Return a frame that completely erases the current frame, and then backs up. Assumes that the current frame is of constant width.""" lines = self._current_frame.split('\n') width = len(lines[0]) height = len(lines) line = ' ' * width ...
[ "def", "get_erase_frame", "(", "self", ")", ":", "lines", "=", "self", ".", "_current_frame", ".", "split", "(", "'\\n'", ")", "width", "=", "len", "(", "lines", "[", "0", "]", ")", "height", "=", "len", "(", "lines", ")", "line", "=", "' '", "*", ...
Return a frame that completely erases the current frame, and then backs up. Assumes that the current frame is of constant width.
[ "Return", "a", "frame", "that", "completely", "erases", "the", "current", "frame", "and", "then", "backs", "up", "." ]
train
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/core.py#L219-L232
radjkarl/fancyTools
fancytools/pystructure/runAllInDir.py
runAllInDir
def runAllInDir(dir_path, exclude=[], add_args=(), ignoreErrors=True): """ execute all modules as __main__ within a given package path """ print('testing all modules of %s' % dir_path) if type(add_args) in (tuple, list): sys.argv.extend(add_args) else: sys.argv.append(add_args) ...
python
def runAllInDir(dir_path, exclude=[], add_args=(), ignoreErrors=True): """ execute all modules as __main__ within a given package path """ print('testing all modules of %s' % dir_path) if type(add_args) in (tuple, list): sys.argv.extend(add_args) else: sys.argv.append(add_args) ...
[ "def", "runAllInDir", "(", "dir_path", ",", "exclude", "=", "[", "]", ",", "add_args", "=", "(", ")", ",", "ignoreErrors", "=", "True", ")", ":", "print", "(", "'testing all modules of %s'", "%", "dir_path", ")", "if", "type", "(", "add_args", ")", "in",...
execute all modules as __main__ within a given package path
[ "execute", "all", "modules", "as", "__main__", "within", "a", "given", "package", "path" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/pystructure/runAllInDir.py#L21-L62
etcher-be/emiz
emiz/weather/custom_metar/custom_metar.py
CustomMetar.get_metar
def get_metar( metar: typing.Union[str, 'CustomMetar'] ) -> typing.Tuple[typing.Union[str, None], typing.Union['CustomMetar', None]]: """ Builds a CustomMetar object from a CustomMetar object (returns it), an ICAO code or a METAR string Args: metar: CustomMetar objec...
python
def get_metar( metar: typing.Union[str, 'CustomMetar'] ) -> typing.Tuple[typing.Union[str, None], typing.Union['CustomMetar', None]]: """ Builds a CustomMetar object from a CustomMetar object (returns it), an ICAO code or a METAR string Args: metar: CustomMetar objec...
[ "def", "get_metar", "(", "metar", ":", "typing", ".", "Union", "[", "str", ",", "'CustomMetar'", "]", ")", "->", "typing", ".", "Tuple", "[", "typing", ".", "Union", "[", "str", ",", "None", "]", ",", "typing", ".", "Union", "[", "'CustomMetar'", ","...
Builds a CustomMetar object from a CustomMetar object (returns it), an ICAO code or a METAR string Args: metar: CustomMetar object, ICAO string or METAR string Returns: CustomMetar object
[ "Builds", "a", "CustomMetar", "object", "from", "a", "CustomMetar", "object", "(", "returns", "it", ")", "an", "ICAO", "code", "or", "a", "METAR", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/custom_metar/custom_metar.py#L27-L60
etcher-be/emiz
emiz/weather/custom_metar/custom_metar.py
CustomMetar.string
def string(self): # noqa: C901 """ Return a human-readable version of the decoded report. """ lines = ["station: %s" % self.station_id] if self.type: lines.append("type: %s" % self.report_type()) if self.time: lines.append("time: %s" % self.time.c...
python
def string(self): # noqa: C901 """ Return a human-readable version of the decoded report. """ lines = ["station: %s" % self.station_id] if self.type: lines.append("type: %s" % self.report_type()) if self.time: lines.append("time: %s" % self.time.c...
[ "def", "string", "(", "self", ")", ":", "# noqa: C901", "lines", "=", "[", "\"station: %s\"", "%", "self", ".", "station_id", "]", "if", "self", ".", "type", ":", "lines", ".", "append", "(", "\"type: %s\"", "%", "self", ".", "report_type", "(", ")", "...
Return a human-readable version of the decoded report.
[ "Return", "a", "human", "-", "readable", "version", "of", "the", "decoded", "report", "." ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/custom_metar/custom_metar.py#L63-L116
etcher-be/emiz
emiz/weather/custom_metar/custom_metar.py
CustomMetar._handlePressure
def _handlePressure(self, d): """ Parse an altimeter-pressure group. The following attributes are set: press [int] """ press = d['press'] if press != '////': press = float(press.replace('O', '0')) if d['unit']: if d[...
python
def _handlePressure(self, d): """ Parse an altimeter-pressure group. The following attributes are set: press [int] """ press = d['press'] if press != '////': press = float(press.replace('O', '0')) if d['unit']: if d[...
[ "def", "_handlePressure", "(", "self", ",", "d", ")", ":", "press", "=", "d", "[", "'press'", "]", "if", "press", "!=", "'////'", ":", "press", "=", "float", "(", "press", ".", "replace", "(", "'O'", ",", "'0'", ")", ")", "if", "d", "[", "'unit'"...
Parse an altimeter-pressure group. The following attributes are set: press [int]
[ "Parse", "an", "altimeter", "-", "pressure", "group", "." ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/custom_metar/custom_metar.py#L118-L143
etcher-be/emiz
emiz/weather/custom_metar/custom_metar.py
CustomMetar._handleSealvlPressRemark
def _handleSealvlPressRemark(self, d): """ Parse the sea-level pressure remark group. """ value = float(d['press']) / 10.0 if value < 50: value += 1000 else: value += 900 if not self.press: self.press = CustomPressure(value) ...
python
def _handleSealvlPressRemark(self, d): """ Parse the sea-level pressure remark group. """ value = float(d['press']) / 10.0 if value < 50: value += 1000 else: value += 900 if not self.press: self.press = CustomPressure(value) ...
[ "def", "_handleSealvlPressRemark", "(", "self", ",", "d", ")", ":", "value", "=", "float", "(", "d", "[", "'press'", "]", ")", "/", "10.0", "if", "value", "<", "50", ":", "value", "+=", "1000", "else", ":", "value", "+=", "900", "if", "not", "self"...
Parse the sea-level pressure remark group.
[ "Parse", "the", "sea", "-", "level", "pressure", "remark", "group", "." ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/custom_metar/custom_metar.py#L146-L157
scottgigante/tasklogger
tasklogger/api.py
get_tasklogger
def get_tasklogger(name="TaskLogger"): """Get a TaskLogger object Parameters ---------- logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger """ try: return logging.getLogger(name).tasklogger ex...
python
def get_tasklogger(name="TaskLogger"): """Get a TaskLogger object Parameters ---------- logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger """ try: return logging.getLogger(name).tasklogger ex...
[ "def", "get_tasklogger", "(", "name", "=", "\"TaskLogger\"", ")", ":", "try", ":", "return", "logging", ".", "getLogger", "(", "name", ")", ".", "tasklogger", "except", "AttributeError", ":", "return", "logger", ".", "TaskLogger", "(", "name", ")" ]
Get a TaskLogger object Parameters ---------- logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger
[ "Get", "a", "TaskLogger", "object" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L6-L21
scottgigante/tasklogger
tasklogger/api.py
log_start
def log_start(task, logger="TaskLogger"): """Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of the logger to retr...
python
def log_start(task, logger="TaskLogger"): """Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of the logger to retr...
[ "def", "log_start", "(", "task", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "start_task", "(", "task", ")", "return", "tasklogger" ]
Begin logging of a task Convenience function to log a task in the default TaskLogger Parameters ---------- task : str Name of the task to be started logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLo...
[ "Begin", "logging", "of", "a", "task" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L24-L43
scottgigante/tasklogger
tasklogger/api.py
log_debug
def log_debug(msg, logger="TaskLogger"): """Log a DEBUG message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
python
def log_debug(msg, logger="TaskLogger"): """Log a DEBUG message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
[ "def", "log_debug", "(", "msg", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "debug", "(", "msg", ")", "return", "tasklogger" ]
Log a DEBUG message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger
[ "Log", "a", "DEBUG", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L68-L86
scottgigante/tasklogger
tasklogger/api.py
log_info
def log_info(msg, logger="TaskLogger"): """Log an INFO message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
python
def log_info(msg, logger="TaskLogger"): """Log an INFO message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
[ "def", "log_info", "(", "msg", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "info", "(", "msg", ")", "return", "tasklogger" ]
Log an INFO message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger
[ "Log", "an", "INFO", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L89-L107
scottgigante/tasklogger
tasklogger/api.py
log_warning
def log_warning(msg, logger="TaskLogger"): """Log a WARNING message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns...
python
def log_warning(msg, logger="TaskLogger"): """Log a WARNING message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns...
[ "def", "log_warning", "(", "msg", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "warning", "(", "msg", ")", "return", "tasklogger" ]
Log a WARNING message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger
[ "Log", "a", "WARNING", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L110-L128
scottgigante/tasklogger
tasklogger/api.py
log_error
def log_error(msg, logger="TaskLogger"): """Log an ERROR message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
python
def log_error(msg, logger="TaskLogger"): """Log an ERROR message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ...
[ "def", "log_error", "(", "msg", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "error", "(", "msg", ")", "return", "tasklogger" ]
Log an ERROR message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged logger : str, optional (default: "TaskLogger") Unique name of the logger to retrieve Returns ------- logger : TaskLogger
[ "Log", "an", "ERROR", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L131-L149
scottgigante/tasklogger
tasklogger/api.py
log_critical
def log_critical(msg, logger="TaskLogger"): """Log a CRITICAL message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged name : `str`, optional (default: "TaskLogger") Name used to retrieve the unique TaskLogger ...
python
def log_critical(msg, logger="TaskLogger"): """Log a CRITICAL message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged name : `str`, optional (default: "TaskLogger") Name used to retrieve the unique TaskLogger ...
[ "def", "log_critical", "(", "msg", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "critical", "(", "msg", ")", "return", "tasklogger" ]
Log a CRITICAL message Convenience function to log a message to the default Logger Parameters ---------- msg : str Message to be logged name : `str`, optional (default: "TaskLogger") Name used to retrieve the unique TaskLogger Returns ------- logger : TaskLogger
[ "Log", "a", "CRITICAL", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L152-L170
scottgigante/tasklogger
tasklogger/api.py
set_level
def set_level(level=1, logger="TaskLogger"): """Set the logging level Convenience function to set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages....
python
def set_level(level=1, logger="TaskLogger"): """Set the logging level Convenience function to set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages....
[ "def", "set_level", "(", "level", "=", "1", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "set_level", "(", "level", ")", "return", "tasklogger" ]
Set the logging level Convenience function to set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages. If 2 or higher, prints all messages. R...
[ "Set", "the", "logging", "level" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L173-L191
scottgigante/tasklogger
tasklogger/api.py
set_timer
def set_timer(timer='wall', logger="TaskLogger"): """Set the timer function Convenience function to set the task timer Parameters ---------- timer : {'wall', 'cpu', or callable}, optional, default='wall' Timer function used to measure task running times. 'wall' uses `time.t...
python
def set_timer(timer='wall', logger="TaskLogger"): """Set the timer function Convenience function to set the task timer Parameters ---------- timer : {'wall', 'cpu', or callable}, optional, default='wall' Timer function used to measure task running times. 'wall' uses `time.t...
[ "def", "set_timer", "(", "timer", "=", "'wall'", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "set_timer", "(", "timer", ")", "return", "tasklogger" ]
Set the timer function Convenience function to set the task timer Parameters ---------- timer : {'wall', 'cpu', or callable}, optional, default='wall' Timer function used to measure task running times. 'wall' uses `time.time`, 'cpu' uses `time.process_time` Returns ---...
[ "Set", "the", "timer", "function" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L194-L211
scottgigante/tasklogger
tasklogger/api.py
set_indent
def set_indent(indent=2, logger="TaskLogger"): """Set the indent function Convenience function to set the indent size Parameters ---------- indent : int, optional (default: 2) number of spaces by which to indent based on the number of tasks currently running` Returns -----...
python
def set_indent(indent=2, logger="TaskLogger"): """Set the indent function Convenience function to set the indent size Parameters ---------- indent : int, optional (default: 2) number of spaces by which to indent based on the number of tasks currently running` Returns -----...
[ "def", "set_indent", "(", "indent", "=", "2", ",", "logger", "=", "\"TaskLogger\"", ")", ":", "tasklogger", "=", "get_tasklogger", "(", "logger", ")", "tasklogger", ".", "set_indent", "(", "indent", ")", "return", "tasklogger" ]
Set the indent function Convenience function to set the indent size Parameters ---------- indent : int, optional (default: 2) number of spaces by which to indent based on the number of tasks currently running` Returns ------- logger : TaskLogger
[ "Set", "the", "indent", "function" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/api.py#L214-L231
radjkarl/fancyTools
fancytools/math/gridPointsFromEdges.py
gridPointsFromEdges
def gridPointsFromEdges(edges, nCells, dtype=float): """ creates a regular 2d grid from given edge points (4*(x0,y0)) and number of cells in x and y returns horizontal and vertical lines as (x0,y0,x1,y1) """ e = edges sx, sy = nCells[0] + 1, nCells[1] + 1 # horizontal lines x0 = np....
python
def gridPointsFromEdges(edges, nCells, dtype=float): """ creates a regular 2d grid from given edge points (4*(x0,y0)) and number of cells in x and y returns horizontal and vertical lines as (x0,y0,x1,y1) """ e = edges sx, sy = nCells[0] + 1, nCells[1] + 1 # horizontal lines x0 = np....
[ "def", "gridPointsFromEdges", "(", "edges", ",", "nCells", ",", "dtype", "=", "float", ")", ":", "e", "=", "edges", "sx", ",", "sy", "=", "nCells", "[", "0", "]", "+", "1", ",", "nCells", "[", "1", "]", "+", "1", "# horizontal lines", "x0", "=", ...
creates a regular 2d grid from given edge points (4*(x0,y0)) and number of cells in x and y returns horizontal and vertical lines as (x0,y0,x1,y1)
[ "creates", "a", "regular", "2d", "grid", "from", "given", "edge", "points", "(", "4", "*", "(", "x0", "y0", "))", "and", "number", "of", "cells", "in", "x", "and", "y" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/gridPointsFromEdges.py#L5-L29
etcher-be/emiz
emiz/parse_parking_spots.py
main
def main(miz_path): """ Artifact from earlier development """ from emiz.miz import Miz with Miz(miz_path) as m: mis = m.mission result = defaultdict(dict) for unit in mis.units: airport, spot = unit.group_name.split('#') spot = int(spot) # print(airport, int(...
python
def main(miz_path): """ Artifact from earlier development """ from emiz.miz import Miz with Miz(miz_path) as m: mis = m.mission result = defaultdict(dict) for unit in mis.units: airport, spot = unit.group_name.split('#') spot = int(spot) # print(airport, int(...
[ "def", "main", "(", "miz_path", ")", ":", "from", "emiz", ".", "miz", "import", "Miz", "with", "Miz", "(", "miz_path", ")", "as", "m", ":", "mis", "=", "m", ".", "mission", "result", "=", "defaultdict", "(", "dict", ")", "for", "unit", "in", "mis",...
Artifact from earlier development
[ "Artifact", "from", "earlier", "development" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/parse_parking_spots.py#L15-L32
PSU-OIT-ARC/django-local-settings
local_settings/settings.py
DottedAccessMixin._traverse
def _traverse(self, name, create_missing=False, action=None, value=NO_DEFAULT): """Traverse to the item specified by ``name``. To create missing items on the way to the ``name``d item, pass ``create_missing=True``. This will insert an item for each missing segment in ``name``. The type ...
python
def _traverse(self, name, create_missing=False, action=None, value=NO_DEFAULT): """Traverse to the item specified by ``name``. To create missing items on the way to the ``name``d item, pass ``create_missing=True``. This will insert an item for each missing segment in ``name``. The type ...
[ "def", "_traverse", "(", "self", ",", "name", ",", "create_missing", "=", "False", ",", "action", "=", "None", ",", "value", "=", "NO_DEFAULT", ")", ":", "obj", "=", "self", "segments", "=", "self", ".", "_parse_path", "(", "name", ")", "for", "segment...
Traverse to the item specified by ``name``. To create missing items on the way to the ``name``d item, pass ``create_missing=True``. This will insert an item for each missing segment in ``name``. The type and value of item that will be inserted for a missing segment depends on the *next*...
[ "Traverse", "to", "the", "item", "specified", "by", "name", "." ]
train
https://github.com/PSU-OIT-ARC/django-local-settings/blob/758810fbd9411c2046a187afcac6532155cac694/local_settings/settings.py#L73-L109
PSU-OIT-ARC/django-local-settings
local_settings/settings.py
DottedAccessMixin._create_segment
def _create_segment(self, obj, segment, next_segment): """Create ``obj[segment]`` if missing. The default value for a missing segment is based on the *next* segment, unless a ``default`` is explicitly passed. If the next segment is an int, the default will be a list with the in...
python
def _create_segment(self, obj, segment, next_segment): """Create ``obj[segment]`` if missing. The default value for a missing segment is based on the *next* segment, unless a ``default`` is explicitly passed. If the next segment is an int, the default will be a list with the in...
[ "def", "_create_segment", "(", "self", ",", "obj", ",", "segment", ",", "next_segment", ")", ":", "if", "isinstance", "(", "next_segment", ",", "int", ")", ":", "value", "=", "[", "PLACEHOLDER", "]", "*", "(", "next_segment", "+", "1", ")", "else", ":"...
Create ``obj[segment]`` if missing. The default value for a missing segment is based on the *next* segment, unless a ``default`` is explicitly passed. If the next segment is an int, the default will be a list with the indicated number of items. Otherwise the default will be a :...
[ "Create", "obj", "[", "segment", "]", "if", "missing", "." ]
train
https://github.com/PSU-OIT-ARC/django-local-settings/blob/758810fbd9411c2046a187afcac6532155cac694/local_settings/settings.py#L111-L135
PSU-OIT-ARC/django-local-settings
local_settings/settings.py
DottedAccessMixin._parse_path
def _parse_path(self, path): """Parse ``path`` into segments. Paths must start with a WORD (i.e., a top level Django setting name). Path segments are separated by dots. Compound path segments (i.e., a name with a dot in it) can be grouped inside parentheses. Examples:: ...
python
def _parse_path(self, path): """Parse ``path`` into segments. Paths must start with a WORD (i.e., a top level Django setting name). Path segments are separated by dots. Compound path segments (i.e., a name with a dot in it) can be grouped inside parentheses. Examples:: ...
[ "def", "_parse_path", "(", "self", ",", "path", ")", ":", "if", "not", "path", ":", "raise", "ValueError", "(", "'path cannot be empty'", ")", "segments", "=", "[", "]", "path_iter", "=", "zip", "(", "iter", "(", "path", ")", ",", "chain", "(", "path",...
Parse ``path`` into segments. Paths must start with a WORD (i.e., a top level Django setting name). Path segments are separated by dots. Compound path segments (i.e., a name with a dot in it) can be grouped inside parentheses. Examples:: >>> settings = Settings() ...
[ "Parse", "path", "into", "segments", "." ]
train
https://github.com/PSU-OIT-ARC/django-local-settings/blob/758810fbd9411c2046a187afcac6532155cac694/local_settings/settings.py#L137-L249
PSU-OIT-ARC/django-local-settings
local_settings/settings.py
DottedAccessMixin._convert_name
def _convert_name(self, name): """Convert ``name`` to int if it looks like an int. Otherwise, return it as is. """ if re.search('^\d+$', name): if len(name) > 1 and name[0] == '0': # Don't treat strings beginning with "0" as ints return name ...
python
def _convert_name(self, name): """Convert ``name`` to int if it looks like an int. Otherwise, return it as is. """ if re.search('^\d+$', name): if len(name) > 1 and name[0] == '0': # Don't treat strings beginning with "0" as ints return name ...
[ "def", "_convert_name", "(", "self", ",", "name", ")", ":", "if", "re", ".", "search", "(", "'^\\d+$'", ",", "name", ")", ":", "if", "len", "(", "name", ")", ">", "1", "and", "name", "[", "0", "]", "==", "'0'", ":", "# Don't treat strings beginning w...
Convert ``name`` to int if it looks like an int. Otherwise, return it as is.
[ "Convert", "name", "to", "int", "if", "it", "looks", "like", "an", "int", "." ]
train
https://github.com/PSU-OIT-ARC/django-local-settings/blob/758810fbd9411c2046a187afcac6532155cac694/local_settings/settings.py#L251-L262
jucacrispim/asyncamqp
asyncamqp/channel.py
Channel.basic_consume
async def basic_consume(self, queue_name='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, no_wait=False, arguments=None, wait_message=True, timeout=0): """Starts the consumption of message into a queue. ...
python
async def basic_consume(self, queue_name='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, no_wait=False, arguments=None, wait_message=True, timeout=0): """Starts the consumption of message into a queue. ...
[ "async", "def", "basic_consume", "(", "self", ",", "queue_name", "=", "''", ",", "consumer_tag", "=", "''", ",", "no_local", "=", "False", ",", "no_ack", "=", "False", ",", "exclusive", "=", "False", ",", "no_wait", "=", "False", ",", "arguments", "=", ...
Starts the consumption of message into a queue. the callback will be called each time we're receiving a message. Args: queue_name: str, the queue to receive message from consumer_tag: str, optional consumer tag no_local: bool, if set the s...
[ "Starts", "the", "consumption", "of", "message", "into", "a", "queue", ".", "the", "callback", "will", "be", "called", "each", "time", "we", "re", "receiving", "a", "message", "." ]
train
https://github.com/jucacrispim/asyncamqp/blob/fa50541ab528f4e0753cb9562c29b0d89d738889/asyncamqp/channel.py#L48-L106
SergeySatskiy/cdm-gc-plugin
setup.py
getPluginVersion
def getPluginVersion(): """The version must be updated in the .cdmp file""" desc_file = os.path.join('cdmplugins', 'gc', plugin_desc_file) if not os.path.exists(desc_file): print('Cannot find the plugin description file. Expected here: ' + desc_file, file=sys.stderr) sys.exit(1...
python
def getPluginVersion(): """The version must be updated in the .cdmp file""" desc_file = os.path.join('cdmplugins', 'gc', plugin_desc_file) if not os.path.exists(desc_file): print('Cannot find the plugin description file. Expected here: ' + desc_file, file=sys.stderr) sys.exit(1...
[ "def", "getPluginVersion", "(", ")", ":", "desc_file", "=", "os", ".", "path", ".", "join", "(", "'cdmplugins'", ",", "'gc'", ",", "plugin_desc_file", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "desc_file", ")", ":", "print", "(", "'Canno...
The version must be updated in the .cdmp file
[ "The", "version", "must", "be", "updated", "in", "the", ".", "cdmp", "file" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/setup.py#L30-L45
fusionapp/fusion-util
fusion_util/cert.py
chainCerts
def chainCerts(data): """ Matches and returns any certificates found except the first match. Regex code copied from L{twisted.internet.endpoints._parseSSL}. Related ticket: https://twistedmatrix.com/trac/ticket/7732 @type path: L{bytes} @param data: PEM-encoded data containing the certificates...
python
def chainCerts(data): """ Matches and returns any certificates found except the first match. Regex code copied from L{twisted.internet.endpoints._parseSSL}. Related ticket: https://twistedmatrix.com/trac/ticket/7732 @type path: L{bytes} @param data: PEM-encoded data containing the certificates...
[ "def", "chainCerts", "(", "data", ")", ":", "matches", "=", "re", ".", "findall", "(", "r'(-----BEGIN CERTIFICATE-----\\n.+?\\n-----END CERTIFICATE-----)'", ",", "data", ",", "flags", "=", "re", ".", "DOTALL", ")", "chainCertificates", "=", "[", "Certificate", "."...
Matches and returns any certificates found except the first match. Regex code copied from L{twisted.internet.endpoints._parseSSL}. Related ticket: https://twistedmatrix.com/trac/ticket/7732 @type path: L{bytes} @param data: PEM-encoded data containing the certificates. @rtype: L{list} containing ...
[ "Matches", "and", "returns", "any", "certificates", "found", "except", "the", "first", "match", "." ]
train
https://github.com/fusionapp/fusion-util/blob/089c525799926c8b8bf1117ab22ed055dc99c7e6/fusion_util/cert.py#L13-L32
collectiveacuity/labPack
labpack/records/time.py
labDT.new
def new(cls): ''' a method to generate the current datetime as a labDT object :return: labDT object ''' dT = datetime.utcnow().replace(tzinfo=pytz.utc) dt_kwargs = { 'year': dT.year, 'month': dT.month, 'day': dT.day, ...
python
def new(cls): ''' a method to generate the current datetime as a labDT object :return: labDT object ''' dT = datetime.utcnow().replace(tzinfo=pytz.utc) dt_kwargs = { 'year': dT.year, 'month': dT.month, 'day': dT.day, ...
[ "def", "new", "(", "cls", ")", ":", "dT", "=", "datetime", ".", "utcnow", "(", ")", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "utc", ")", "dt_kwargs", "=", "{", "'year'", ":", "dT", ".", "year", ",", "'month'", ":", "dT", ".", "month", "...
a method to generate the current datetime as a labDT object :return: labDT object
[ "a", "method", "to", "generate", "the", "current", "datetime", "as", "a", "labDT", "object", ":", "return", ":", "labDT", "object" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L26-L44
collectiveacuity/labPack
labpack/records/time.py
labDT.zulu
def zulu(self): ''' a method to report ISO UTC datetime string from a labDT object NOTE: for timezone offset string use .isoformat() instead :return: string in ISO UTC format ''' # construct ISO UTC string from labDT utc_dt = self.astimezone(pytz.utc) i...
python
def zulu(self): ''' a method to report ISO UTC datetime string from a labDT object NOTE: for timezone offset string use .isoformat() instead :return: string in ISO UTC format ''' # construct ISO UTC string from labDT utc_dt = self.astimezone(pytz.utc) i...
[ "def", "zulu", "(", "self", ")", ":", "# construct ISO UTC string from labDT\r", "utc_dt", "=", "self", ".", "astimezone", "(", "pytz", ".", "utc", ")", "iso_dt", "=", "utc_dt", ".", "isoformat", "(", ")", "return", "iso_dt", ".", "replace", "(", "'+00:00'",...
a method to report ISO UTC datetime string from a labDT object NOTE: for timezone offset string use .isoformat() instead :return: string in ISO UTC format
[ "a", "method", "to", "report", "ISO", "UTC", "datetime", "string", "from", "a", "labDT", "object", "NOTE", ":", "for", "timezone", "offset", "string", "use", ".", "isoformat", "()", "instead", ":", "return", ":", "string", "in", "ISO", "UTC", "format" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L46-L58
collectiveacuity/labPack
labpack/records/time.py
labDT.epoch
def epoch(self): ''' a method to report posix epoch timestamp from a labDT object :return: float with timestamp ''' # construct epoch timestamp from labDT epoch_dt = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc) delta_time = self - epoch_dt return...
python
def epoch(self): ''' a method to report posix epoch timestamp from a labDT object :return: float with timestamp ''' # construct epoch timestamp from labDT epoch_dt = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc) delta_time = self - epoch_dt return...
[ "def", "epoch", "(", "self", ")", ":", "# construct epoch timestamp from labDT\r", "epoch_dt", "=", "datetime", ".", "utcfromtimestamp", "(", "0", ")", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "utc", ")", "delta_time", "=", "self", "-", "epoch_dt", "...
a method to report posix epoch timestamp from a labDT object :return: float with timestamp
[ "a", "method", "to", "report", "posix", "epoch", "timestamp", "from", "a", "labDT", "object", ":", "return", ":", "float", "with", "timestamp" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L60-L70
collectiveacuity/labPack
labpack/records/time.py
labDT.rfc2822
def rfc2822(self): ''' a method to report a RFC-2822 Compliant Date from a labDT object https://tools.ietf.org/html/rfc2822.html#page-14 :return: string with RFC-2822 compliant date time ''' # define format js_format = '%a, %d %b %Y %H:%M:%S GM...
python
def rfc2822(self): ''' a method to report a RFC-2822 Compliant Date from a labDT object https://tools.ietf.org/html/rfc2822.html#page-14 :return: string with RFC-2822 compliant date time ''' # define format js_format = '%a, %d %b %Y %H:%M:%S GM...
[ "def", "rfc2822", "(", "self", ")", ":", "# define format\r", "js_format", "=", "'%a, %d %b %Y %H:%M:%S GMT'", "utc_time", "=", "self", ".", "astimezone", "(", "pytz", ".", "utc", ")", "return", "format", "(", "utc_time", ",", "js_format", ")" ]
a method to report a RFC-2822 Compliant Date from a labDT object https://tools.ietf.org/html/rfc2822.html#page-14 :return: string with RFC-2822 compliant date time
[ "a", "method", "to", "report", "a", "RFC", "-", "2822", "Compliant", "Date", "from", "a", "labDT", "object", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc2822", ".", "html#page", "-", "14", ":", "return", ":", "string",...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L72-L86
collectiveacuity/labPack
labpack/records/time.py
labDT.pyLocal
def pyLocal(self, time_zone=''): ''' a method to report a python datetime from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs get_tz = get_localzone() title = 'Ti...
python
def pyLocal(self, time_zone=''): ''' a method to report a python datetime from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs get_tz = get_localzone() title = 'Ti...
[ "def", "pyLocal", "(", "self", ",", "time_zone", "=", "''", ")", ":", "# validate inputs\r", "get_tz", "=", "get_localzone", "(", ")", "title", "=", "'Timezone input for labDT.pyLocal'", "if", "time_zone", ":", "# if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'...
a method to report a python datetime from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info
[ "a", "method", "to", "report", "a", "python", "datetime", "from", "a", "labDT", "object", ":", "param", "time_zone", ":", "[", "optional", "]", "string", "with", "timezone", "to", "report", "in", ":", "return", ":", "string", "with", "date", "and", "time...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L88-L119
collectiveacuity/labPack
labpack/records/time.py
labDT.jsLocal
def jsLocal(self, time_zone=''): ''' a method to report a javascript string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs js_format = '%a %b %d %Y %H:%M:%S GMT%z (%Z...
python
def jsLocal(self, time_zone=''): ''' a method to report a javascript string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs js_format = '%a %b %d %Y %H:%M:%S GMT%z (%Z...
[ "def", "jsLocal", "(", "self", ",", "time_zone", "=", "''", ")", ":", "# validate inputs\r", "js_format", "=", "'%a %b %d %Y %H:%M:%S GMT%z (%Z)'", "title", "=", "'Timezone input for labDT.jsLocal'", "get_tz", "=", "get_localzone", "(", ")", "if", "time_zone", ":", ...
a method to report a javascript string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info
[ "a", "method", "to", "report", "a", "javascript", "string", "from", "a", "labDT", "object", ":", "param", "time_zone", ":", "[", "optional", "]", "string", "with", "timezone", "to", "report", "in", ":", "return", ":", "string", "with", "date", "and", "ti...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L121-L143
collectiveacuity/labPack
labpack/records/time.py
labDT.humanFriendly
def humanFriendly(self, time_zone='', include_day=True, include_time=True): ''' a method to report a human friendly string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs ...
python
def humanFriendly(self, time_zone='', include_day=True, include_time=True): ''' a method to report a human friendly string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info ''' # validate inputs ...
[ "def", "humanFriendly", "(", "self", ",", "time_zone", "=", "''", ",", "include_day", "=", "True", ",", "include_time", "=", "True", ")", ":", "# validate inputs\r", "zeroHourPattern", "=", "re", ".", "compile", "(", "'\\s0\\d:'", ")", "title", "=", "'Timezo...
a method to report a human friendly string from a labDT object :param time_zone: [optional] string with timezone to report in :return: string with date and time info
[ "a", "method", "to", "report", "a", "human", "friendly", "string", "from", "a", "labDT", "object", ":", "param", "time_zone", ":", "[", "optional", "]", "string", "with", "timezone", "to", "report", "in", ":", "return", ":", "string", "with", "date", "an...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/time.py#L145-L178