repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
pauleveritt/kaybee
kaybee/plugins/articles/handlers.py
stamp_excerpt
def stamp_excerpt(kb_app: kb, sphinx_app: Sphinx, doctree: doctree): """ Walk the tree and extract excert into resource.excerpt """ # First, find out which resource this is. Won't be easy. resources = sphinx_app.env.resources confdir = sphinx_app.confdir source =...
python
def stamp_excerpt(kb_app: kb, sphinx_app: Sphinx, doctree: doctree): """ Walk the tree and extract excert into resource.excerpt """ # First, find out which resource this is. Won't be easy. resources = sphinx_app.env.resources confdir = sphinx_app.confdir source =...
[ "def", "stamp_excerpt", "(", "kb_app", ":", "kb", ",", "sphinx_app", ":", "Sphinx", ",", "doctree", ":", "doctree", ")", ":", "# First, find out which resource this is. Won't be easy.", "resources", "=", "sphinx_app", ".", "env", ".", "resources", "confdir", "=", ...
Walk the tree and extract excert into resource.excerpt
[ "Walk", "the", "tree", "and", "extract", "excert", "into", "resource", ".", "excerpt" ]
a00a718aaaa23b2d12db30dfacb6b2b6ec84459c
https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/handlers.py#L114-L140
train
55,800
diamondman/proteusisc
proteusisc/jtagUtils.py
bitfieldify
def bitfieldify(buff, count): """Extract a bitarray out of a bytes array. Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data. This function takes in bytes and the number of bits to extract starting from t...
python
def bitfieldify(buff, count): """Extract a bitarray out of a bytes array. Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data. This function takes in bytes and the number of bits to extract starting from t...
[ "def", "bitfieldify", "(", "buff", ",", "count", ")", ":", "databits", "=", "bitarray", "(", ")", "databits", ".", "frombytes", "(", "buff", ")", "return", "databits", "[", "len", "(", "databits", ")", "-", "count", ":", "]" ]
Extract a bitarray out of a bytes array. Some hardware devices read from the LSB to the MSB, but the bit types available prefer to put pad bits on the LSB side, completely changing the data. This function takes in bytes and the number of bits to extract starting from the LSB, and produces a bitarray of th...
[ "Extract", "a", "bitarray", "out", "of", "a", "bytes", "array", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagUtils.py#L57-L68
train
55,801
diamondman/proteusisc
proteusisc/jtagUtils.py
build_byte_align_buff
def build_byte_align_buff(bits): """Pad the left side of a bitarray with 0s to align its length with byte boundaries. Args: bits: A bitarray to be padded and aligned. Returns: A newly aligned bitarray. """ bitmod = len(bits)%8 if bitmod == 0: rdiff = bitarray() else...
python
def build_byte_align_buff(bits): """Pad the left side of a bitarray with 0s to align its length with byte boundaries. Args: bits: A bitarray to be padded and aligned. Returns: A newly aligned bitarray. """ bitmod = len(bits)%8 if bitmod == 0: rdiff = bitarray() else...
[ "def", "build_byte_align_buff", "(", "bits", ")", ":", "bitmod", "=", "len", "(", "bits", ")", "%", "8", "if", "bitmod", "==", "0", ":", "rdiff", "=", "bitarray", "(", ")", "else", ":", "#KEEP bitarray", "rdiff", "=", "bitarray", "(", "8", "-", "bitm...
Pad the left side of a bitarray with 0s to align its length with byte boundaries. Args: bits: A bitarray to be padded and aligned. Returns: A newly aligned bitarray.
[ "Pad", "the", "left", "side", "of", "a", "bitarray", "with", "0s", "to", "align", "its", "length", "with", "byte", "boundaries", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagUtils.py#L96-L112
train
55,802
HPCC-Cloud-Computing/CAL
calplus/v1/network/client.py
Client.create
def create(self, name, cidr, **kwargs): """This function will create a user network. Within OpenStack, it will create a network and a subnet Within AWS, it will create a VPC and a subnet :param name: string :param cidr: string E.x: "10.0.0.0/24" :param kwargs: dict ...
python
def create(self, name, cidr, **kwargs): """This function will create a user network. Within OpenStack, it will create a network and a subnet Within AWS, it will create a VPC and a subnet :param name: string :param cidr: string E.x: "10.0.0.0/24" :param kwargs: dict ...
[ "def", "create", "(", "self", ",", "name", ",", "cidr", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "driver", ".", "create", "(", "name", ",", "cidr", ",", "*", "*", "kwargs", ")" ]
This function will create a user network. Within OpenStack, it will create a network and a subnet Within AWS, it will create a VPC and a subnet :param name: string :param cidr: string E.x: "10.0.0.0/24" :param kwargs: dict :return: dict
[ "This", "function", "will", "create", "a", "user", "network", ".", "Within", "OpenStack", "it", "will", "create", "a", "network", "and", "a", "subnet", "Within", "AWS", "it", "will", "create", "a", "VPC", "and", "a", "subnet" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/network/client.py#L16-L26
train
55,803
sparknetworks/pgpm
pgpm/lib/utils/misc.py
find_whole_word
def find_whole_word(w): """ Scan through string looking for a location where this word produces a match, and return a corresponding MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the st...
python
def find_whole_word(w): """ Scan through string looking for a location where this word produces a match, and return a corresponding MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the st...
[ "def", "find_whole_word", "(", "w", ")", ":", "return", "re", ".", "compile", "(", "r'\\b({0})\\b'", ".", "format", "(", "w", ")", ",", "flags", "=", "re", ".", "IGNORECASE", ")", ".", "search" ]
Scan through string looking for a location where this word produces a match, and return a corresponding MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
[ "Scan", "through", "string", "looking", "for", "a", "location", "where", "this", "word", "produces", "a", "match", "and", "return", "a", "corresponding", "MatchObject", "instance", ".", "Return", "None", "if", "no", "position", "in", "the", "string", "matches"...
1a060df46a886095181f692ea870a73a32510a2e
https://github.com/sparknetworks/pgpm/blob/1a060df46a886095181f692ea870a73a32510a2e/pgpm/lib/utils/misc.py#L11-L18
train
55,804
davgeo/clear
clear/extract.py
GetCompressedFilesInDir
def GetCompressedFilesInDir(fileDir, fileList, ignoreDirList, supportedFormatList = ['.rar',]): """ Get all supported files from given directory folder. Appends to given file list. Parameters ---------- fileDir : string File directory to search. fileList : list List which any file matches ...
python
def GetCompressedFilesInDir(fileDir, fileList, ignoreDirList, supportedFormatList = ['.rar',]): """ Get all supported files from given directory folder. Appends to given file list. Parameters ---------- fileDir : string File directory to search. fileList : list List which any file matches ...
[ "def", "GetCompressedFilesInDir", "(", "fileDir", ",", "fileList", ",", "ignoreDirList", ",", "supportedFormatList", "=", "[", "'.rar'", ",", "]", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"EXTRACT\"", ",", "\"Parsing file directory: {0}\"", ".", ...
Get all supported files from given directory folder. Appends to given file list. Parameters ---------- fileDir : string File directory to search. fileList : list List which any file matches will be added to. ignoreDirList : list List of directories to ignore in recursive lookup (cur...
[ "Get", "all", "supported", "files", "from", "given", "directory", "folder", ".", "Appends", "to", "given", "file", "list", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L23-L45
train
55,805
davgeo/clear
clear/extract.py
MultipartArchiving
def MultipartArchiving(firstPartExtractList, otherPartSkippedList, archiveDir, otherPartFilePath = None): """ Archive all parts of multi-part compressed file. If file has been extracted (via part1) then move all subsequent parts directly to archive directory. If file has not been extracted then if part >1 add ...
python
def MultipartArchiving(firstPartExtractList, otherPartSkippedList, archiveDir, otherPartFilePath = None): """ Archive all parts of multi-part compressed file. If file has been extracted (via part1) then move all subsequent parts directly to archive directory. If file has not been extracted then if part >1 add ...
[ "def", "MultipartArchiving", "(", "firstPartExtractList", ",", "otherPartSkippedList", ",", "archiveDir", ",", "otherPartFilePath", "=", "None", ")", ":", "if", "otherPartFilePath", "is", "None", ":", "for", "filePath", "in", "list", "(", "otherPartSkippedList", ")"...
Archive all parts of multi-part compressed file. If file has been extracted (via part1) then move all subsequent parts directly to archive directory. If file has not been extracted then if part >1 add to other part skipped list and only archive when the first part is sent for archiving. Parameters ---------...
[ "Archive", "all", "parts", "of", "multi", "-", "part", "compressed", "file", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L50-L83
train
55,806
davgeo/clear
clear/extract.py
DoRarExtraction
def DoRarExtraction(rarArchive, targetFile, dstDir): """ RAR extraction with exception catching Parameters ---------- rarArchive : RarFile object RarFile object to extract. targetFile : string Target file name. dstDir : string Target directory. Returns ---------- boolea...
python
def DoRarExtraction(rarArchive, targetFile, dstDir): """ RAR extraction with exception catching Parameters ---------- rarArchive : RarFile object RarFile object to extract. targetFile : string Target file name. dstDir : string Target directory. Returns ---------- boolea...
[ "def", "DoRarExtraction", "(", "rarArchive", ",", "targetFile", ",", "dstDir", ")", ":", "try", ":", "rarArchive", ".", "extract", "(", "targetFile", ",", "dstDir", ")", "except", "BaseException", "as", "ex", ":", "goodlogging", ".", "Log", ".", "Info", "(...
RAR extraction with exception catching Parameters ---------- rarArchive : RarFile object RarFile object to extract. targetFile : string Target file name. dstDir : string Target directory. Returns ---------- boolean False if rar extraction failed, otherwise True.
[ "RAR", "extraction", "with", "exception", "catching" ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L88-L114
train
55,807
davgeo/clear
clear/extract.py
GetRarPassword
def GetRarPassword(skipUserInput): """ Get password for rar archive from user input. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- string or boolean If no password is given then returns False otherwise returns user response string. """...
python
def GetRarPassword(skipUserInput): """ Get password for rar archive from user input. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- string or boolean If no password is given then returns False otherwise returns user response string. """...
[ "def", "GetRarPassword", "(", "skipUserInput", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"EXTRACT\"", ",", "\"RAR file needs password to extract\"", ")", "if", "skipUserInput", "is", "False", ":", "prompt", "=", "\"Enter password, 'x' to skip this file or...
Get password for rar archive from user input. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- string or boolean If no password is given then returns False otherwise returns user response string.
[ "Get", "password", "for", "rar", "archive", "from", "user", "input", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L119-L148
train
55,808
davgeo/clear
clear/extract.py
CheckPasswordReuse
def CheckPasswordReuse(skipUserInput): """ Check with user for password reuse. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- int Integer from -1 to 2 depending on user response. """ goodlogging.Log.Info("EXTRACT", "RAR files needs password...
python
def CheckPasswordReuse(skipUserInput): """ Check with user for password reuse. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- int Integer from -1 to 2 depending on user response. """ goodlogging.Log.Info("EXTRACT", "RAR files needs password...
[ "def", "CheckPasswordReuse", "(", "skipUserInput", ")", ":", "goodlogging", ".", "Log", ".", "Info", "(", "\"EXTRACT\"", ",", "\"RAR files needs password to extract\"", ")", "if", "skipUserInput", "is", "False", ":", "prompt", "=", "\"Enter 't' to reuse the last passwor...
Check with user for password reuse. Parameters ---------- skipUserInput : boolean Set to skip user input. Returns ---------- int Integer from -1 to 2 depending on user response.
[ "Check", "with", "user", "for", "password", "reuse", "." ]
5ec85d27efd28afddfcd4c3f44df17f0115a77aa
https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/extract.py#L153-L185
train
55,809
steinitzu/giveme
giveme/core.py
Manager.register
def register(self, func, singleton=False, threadlocal=False, name=None): """ Register a dependency function """ func._giveme_singleton = singleton func._giveme_threadlocal = threadlocal if name is None: name = func.__name__ self._registered[name] = fu...
python
def register(self, func, singleton=False, threadlocal=False, name=None): """ Register a dependency function """ func._giveme_singleton = singleton func._giveme_threadlocal = threadlocal if name is None: name = func.__name__ self._registered[name] = fu...
[ "def", "register", "(", "self", ",", "func", ",", "singleton", "=", "False", ",", "threadlocal", "=", "False", ",", "name", "=", "None", ")", ":", "func", ".", "_giveme_singleton", "=", "singleton", "func", ".", "_giveme_threadlocal", "=", "threadlocal", "...
Register a dependency function
[ "Register", "a", "dependency", "function" ]
b250995c59eb7e141d2cd8260e292c417785bbd1
https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/core.py#L21-L31
train
55,810
steinitzu/giveme
giveme/core.py
Manager.get_value
def get_value(self, name): """ Get return value of a dependency factory or a live singleton instance. """ factory = self._registered.get(name) if not factory: raise KeyError('Name not registered') if factory._giveme_singleton: if name in se...
python
def get_value(self, name): """ Get return value of a dependency factory or a live singleton instance. """ factory = self._registered.get(name) if not factory: raise KeyError('Name not registered') if factory._giveme_singleton: if name in se...
[ "def", "get_value", "(", "self", ",", "name", ")", ":", "factory", "=", "self", ".", "_registered", ".", "get", "(", "name", ")", "if", "not", "factory", ":", "raise", "KeyError", "(", "'Name not registered'", ")", "if", "factory", ".", "_giveme_singleton"...
Get return value of a dependency factory or a live singleton instance.
[ "Get", "return", "value", "of", "a", "dependency", "factory", "or", "a", "live", "singleton", "instance", "." ]
b250995c59eb7e141d2cd8260e292c417785bbd1
https://github.com/steinitzu/giveme/blob/b250995c59eb7e141d2cd8260e292c417785bbd1/giveme/core.py#L45-L63
train
55,811
e7dal/bubble3
bubble3/functions.py
trace
def trace(fun, *a, **k): """ define a tracer for a rule function for log and statistic purposes """ @wraps(fun) def tracer(*a, **k): ret = fun(*a, **k) print('trace:fun: %s\n ret=%s\n a=%s\nk%s\n' % (str(fun), str(ret), str(a), str(k))) return ret return tracer
python
def trace(fun, *a, **k): """ define a tracer for a rule function for log and statistic purposes """ @wraps(fun) def tracer(*a, **k): ret = fun(*a, **k) print('trace:fun: %s\n ret=%s\n a=%s\nk%s\n' % (str(fun), str(ret), str(a), str(k))) return ret return tracer
[ "def", "trace", "(", "fun", ",", "*", "a", ",", "*", "*", "k", ")", ":", "@", "wraps", "(", "fun", ")", "def", "tracer", "(", "*", "a", ",", "*", "*", "k", ")", ":", "ret", "=", "fun", "(", "*", "a", ",", "*", "*", "k", ")", "print", ...
define a tracer for a rule function for log and statistic purposes
[ "define", "a", "tracer", "for", "a", "rule", "function", "for", "log", "and", "statistic", "purposes" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L186-L195
train
55,812
e7dal/bubble3
bubble3/functions.py
timer
def timer(fun, *a, **k): """ define a timer for a rule function for log and statistic purposes """ @wraps(fun) def timer(*a, **k): start = arrow.now() ret = fun(*a, **k) end = arrow.now() print('timer:fun: %s\n start:%s,end:%s, took [%s]' % ( str(fun), str(sta...
python
def timer(fun, *a, **k): """ define a timer for a rule function for log and statistic purposes """ @wraps(fun) def timer(*a, **k): start = arrow.now() ret = fun(*a, **k) end = arrow.now() print('timer:fun: %s\n start:%s,end:%s, took [%s]' % ( str(fun), str(sta...
[ "def", "timer", "(", "fun", ",", "*", "a", ",", "*", "*", "k", ")", ":", "@", "wraps", "(", "fun", ")", "def", "timer", "(", "*", "a", ",", "*", "*", "k", ")", ":", "start", "=", "arrow", ".", "now", "(", ")", "ret", "=", "fun", "(", "*...
define a timer for a rule function for log and statistic purposes
[ "define", "a", "timer", "for", "a", "rule", "function", "for", "log", "and", "statistic", "purposes" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L198-L209
train
55,813
e7dal/bubble3
bubble3/functions.py
RuleFunctions.get_function
def get_function(self, fun=None): """get function as RuleFunction or return a NoRuleFunction function""" sfun = str(fun) self.say('get_function:' + sfun, verbosity=100) if not fun: return NoRuleFunction() # dummy to execute via no_fun if sfun in self._rule_function...
python
def get_function(self, fun=None): """get function as RuleFunction or return a NoRuleFunction function""" sfun = str(fun) self.say('get_function:' + sfun, verbosity=100) if not fun: return NoRuleFunction() # dummy to execute via no_fun if sfun in self._rule_function...
[ "def", "get_function", "(", "self", ",", "fun", "=", "None", ")", ":", "sfun", "=", "str", "(", "fun", ")", "self", ".", "say", "(", "'get_function:'", "+", "sfun", ",", "verbosity", "=", "100", ")", "if", "not", "fun", ":", "return", "NoRuleFunction...
get function as RuleFunction or return a NoRuleFunction function
[ "get", "function", "as", "RuleFunction", "or", "return", "a", "NoRuleFunction", "function" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L85-L103
train
55,814
e7dal/bubble3
bubble3/functions.py
RuleFunctions.add_function
def add_function(self, fun=None, name=None, fun_type=FUN_TYPE): """actually replace function""" if not name: if six.PY2: name = fun.func_name else: name = fun.__name__ self.say...
python
def add_function(self, fun=None, name=None, fun_type=FUN_TYPE): """actually replace function""" if not name: if six.PY2: name = fun.func_name else: name = fun.__name__ self.say...
[ "def", "add_function", "(", "self", ",", "fun", "=", "None", ",", "name", "=", "None", ",", "fun_type", "=", "FUN_TYPE", ")", ":", "if", "not", "name", ":", "if", "six", ".", "PY2", ":", "name", "=", "fun", ".", "func_name", "else", ":", "name", ...
actually replace function
[ "actually", "replace", "function" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L113-L132
train
55,815
e7dal/bubble3
bubble3/functions.py
RuleFunctions.function_exists
def function_exists(self, fun): """ get function's existense """ res = fun in self._rule_functions self.say('function exists:' + str(fun) + ':' + str(res), verbosity=10) return res
python
def function_exists(self, fun): """ get function's existense """ res = fun in self._rule_functions self.say('function exists:' + str(fun) + ':' + str(res), verbosity=10) return res
[ "def", "function_exists", "(", "self", ",", "fun", ")", ":", "res", "=", "fun", "in", "self", ".", "_rule_functions", "self", ".", "say", "(", "'function exists:'", "+", "str", "(", "fun", ")", "+", "':'", "+", "str", "(", "res", ")", ",", "verbosity...
get function's existense
[ "get", "function", "s", "existense" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L134-L139
train
55,816
e7dal/bubble3
bubble3/functions.py
RuleFunctions.rule_function_not_found
def rule_function_not_found(self, fun=None): """ any function that does not exist will be added as a dummy function that will gather inputs for easing into the possible future implementation """ sfun = str(fun) self.cry('rule_function_not_found:' + sfun) def not_...
python
def rule_function_not_found(self, fun=None): """ any function that does not exist will be added as a dummy function that will gather inputs for easing into the possible future implementation """ sfun = str(fun) self.cry('rule_function_not_found:' + sfun) def not_...
[ "def", "rule_function_not_found", "(", "self", ",", "fun", "=", "None", ")", ":", "sfun", "=", "str", "(", "fun", ")", "self", ".", "cry", "(", "'rule_function_not_found:'", "+", "sfun", ")", "def", "not_found", "(", "*", "a", ",", "*", "*", "k", ")"...
any function that does not exist will be added as a dummy function that will gather inputs for easing into the possible future implementation
[ "any", "function", "that", "does", "not", "exist", "will", "be", "added", "as", "a", "dummy", "function", "that", "will", "gather", "inputs", "for", "easing", "into", "the", "possible", "future", "implementation" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/functions.py#L145-L155
train
55,817
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
parse_value
def parse_value(val): """ Parse values from html """ val = val.replace("%", " ")\ .replace(" ","")\ .replace(",", ".")\ .replace("st","").strip() missing = ["Ejdeltagit", "N/A"] if val in missing: return val elif val == "": return None return float(v...
python
def parse_value(val): """ Parse values from html """ val = val.replace("%", " ")\ .replace(" ","")\ .replace(",", ".")\ .replace("st","").strip() missing = ["Ejdeltagit", "N/A"] if val in missing: return val elif val == "": return None return float(v...
[ "def", "parse_value", "(", "val", ")", ":", "val", "=", "val", ".", "replace", "(", "\"%\"", ",", "\" \"", ")", ".", "replace", "(", "\" \"", ",", "\"\"", ")", ".", "replace", "(", "\",\"", ",", "\".\"", ")", ".", "replace", "(", "\"st\"", ",", "...
Parse values from html
[ "Parse", "values", "from", "html" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L636-L650
train
55,818
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
VantetiderScraper._get_html
def _get_html(self, url): """ Get html from url """ self.log.info(u"/GET {}".format(url)) r = requests.get(url) if hasattr(r, 'from_cache'): if r.from_cache: self.log.info("(from cache)") if r.status_code != 200: throw_request_err(...
python
def _get_html(self, url): """ Get html from url """ self.log.info(u"/GET {}".format(url)) r = requests.get(url) if hasattr(r, 'from_cache'): if r.from_cache: self.log.info("(from cache)") if r.status_code != 200: throw_request_err(...
[ "def", "_get_html", "(", "self", ",", "url", ")", ":", "self", ".", "log", ".", "info", "(", "u\"/GET {}\"", ".", "format", "(", "url", ")", ")", "r", "=", "requests", ".", "get", "(", "url", ")", "if", "hasattr", "(", "r", ",", "'from_cache'", "...
Get html from url
[ "Get", "html", "from", "url" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L141-L153
train
55,819
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
VantetiderScraper._get_json
def _get_json(self, url): """ Get json from url """ self.log.info(u"/GET " + url) r = requests.get(url) if hasattr(r, 'from_cache'): if r.from_cache: self.log.info("(from cache)") if r.status_code != 200: throw_request_err(r) ...
python
def _get_json(self, url): """ Get json from url """ self.log.info(u"/GET " + url) r = requests.get(url) if hasattr(r, 'from_cache'): if r.from_cache: self.log.info("(from cache)") if r.status_code != 200: throw_request_err(r) ...
[ "def", "_get_json", "(", "self", ",", "url", ")", ":", "self", ".", "log", ".", "info", "(", "u\"/GET \"", "+", "url", ")", "r", "=", "requests", ".", "get", "(", "url", ")", "if", "hasattr", "(", "r", ",", "'from_cache'", ")", ":", "if", "r", ...
Get json from url
[ "Get", "json", "from", "url" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L163-L174
train
55,820
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
VantetiderDataset.regions
def regions(self): """ Get a list of all regions """ regions = [] elem = self.dimensions["region"].elem for option_elem in elem.find_all("option"): region = option_elem.text.strip() regions.append(region) return regions
python
def regions(self): """ Get a list of all regions """ regions = [] elem = self.dimensions["region"].elem for option_elem in elem.find_all("option"): region = option_elem.text.strip() regions.append(region) return regions
[ "def", "regions", "(", "self", ")", ":", "regions", "=", "[", "]", "elem", "=", "self", ".", "dimensions", "[", "\"region\"", "]", ".", "elem", "for", "option_elem", "in", "elem", ".", "find_all", "(", "\"option\"", ")", ":", "region", "=", "option_ele...
Get a list of all regions
[ "Get", "a", "list", "of", "all", "regions" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L203-L212
train
55,821
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
VantetiderDataset._get_region_slug
def _get_region_slug(self, id_or_label): """ Get the regional slug to be used in url "Norrbotten" => "Norrbottens" :param id_or_label: Id or label of region """ #region = self.dimensions["region"].get(id_or_label) region = id_or_label slug = region\ ...
python
def _get_region_slug(self, id_or_label): """ Get the regional slug to be used in url "Norrbotten" => "Norrbottens" :param id_or_label: Id or label of region """ #region = self.dimensions["region"].get(id_or_label) region = id_or_label slug = region\ ...
[ "def", "_get_region_slug", "(", "self", ",", "id_or_label", ")", ":", "#region = self.dimensions[\"region\"].get(id_or_label)", "region", "=", "id_or_label", "slug", "=", "region", ".", "replace", "(", "u\" \"", ",", "\"-\"", ")", ".", "replace", "(", "u\"ö\",", "...
Get the regional slug to be used in url "Norrbotten" => "Norrbottens" :param id_or_label: Id or label of region
[ "Get", "the", "regional", "slug", "to", "be", "used", "in", "url", "Norrbotten", "=", ">", "Norrbottens" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L215-L237
train
55,822
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
VantetiderDimension.default_value
def default_value(self): """ The default category when making a query """ if not hasattr(self, "_default_value"): if self.elem_type == "select": try: # Get option marked "selected" def_value = get_option_value(self.elem.select_o...
python
def default_value(self): """ The default category when making a query """ if not hasattr(self, "_default_value"): if self.elem_type == "select": try: # Get option marked "selected" def_value = get_option_value(self.elem.select_o...
[ "def", "default_value", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"_default_value\"", ")", ":", "if", "self", ".", "elem_type", "==", "\"select\"", ":", "try", ":", "# Get option marked \"selected\"", "def_value", "=", "get_option_value"...
The default category when making a query
[ "The", "default", "category", "when", "making", "a", "query" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L337-L359
train
55,823
jplusplus/statscraper
statscraper/scrapers/VantetiderScraper.py
Datatable._parse_horizontal_scroll_table
def _parse_horizontal_scroll_table(self, table_html): """ Get list of dicts from horizontally scrollable table """ row_labels = [parse_text(x.text) for x in table_html.select(".DTFC_LeftBodyWrapper tbody tr")] row_label_ids = [None] * len(row_labels) cols = [parse_text(x.text) f...
python
def _parse_horizontal_scroll_table(self, table_html): """ Get list of dicts from horizontally scrollable table """ row_labels = [parse_text(x.text) for x in table_html.select(".DTFC_LeftBodyWrapper tbody tr")] row_label_ids = [None] * len(row_labels) cols = [parse_text(x.text) f...
[ "def", "_parse_horizontal_scroll_table", "(", "self", ",", "table_html", ")", ":", "row_labels", "=", "[", "parse_text", "(", "x", ".", "text", ")", "for", "x", "in", "table_html", ".", "select", "(", "\".DTFC_LeftBodyWrapper tbody tr\"", ")", "]", "row_label_id...
Get list of dicts from horizontally scrollable table
[ "Get", "list", "of", "dicts", "from", "horizontally", "scrollable", "table" ]
932ec048b23d15b3dbdaf829facc55fd78ec0109
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/VantetiderScraper.py#L474-L489
train
55,824
Miachol/pycnf
pycnf/configtype.py
is_json_file
def is_json_file(filename, show_warnings = False): """Check configuration file type is JSON Return a boolean indicating wheather the file is JSON format or not """ try: config_dict = load_config(filename, file_type = "json") is_json = True except: is_json = False return(i...
python
def is_json_file(filename, show_warnings = False): """Check configuration file type is JSON Return a boolean indicating wheather the file is JSON format or not """ try: config_dict = load_config(filename, file_type = "json") is_json = True except: is_json = False return(i...
[ "def", "is_json_file", "(", "filename", ",", "show_warnings", "=", "False", ")", ":", "try", ":", "config_dict", "=", "load_config", "(", "filename", ",", "file_type", "=", "\"json\"", ")", "is_json", "=", "True", "except", ":", "is_json", "=", "False", "r...
Check configuration file type is JSON Return a boolean indicating wheather the file is JSON format or not
[ "Check", "configuration", "file", "type", "is", "JSON", "Return", "a", "boolean", "indicating", "wheather", "the", "file", "is", "JSON", "format", "or", "not" ]
8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b
https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L2-L11
train
55,825
Miachol/pycnf
pycnf/configtype.py
is_yaml_file
def is_yaml_file(filename, show_warnings = False): """Check configuration file type is yaml Return a boolean indicating wheather the file is yaml format or not """ if is_json_file(filename): return(False) try: config_dict = load_config(filename, file_type = "yaml") if(type(co...
python
def is_yaml_file(filename, show_warnings = False): """Check configuration file type is yaml Return a boolean indicating wheather the file is yaml format or not """ if is_json_file(filename): return(False) try: config_dict = load_config(filename, file_type = "yaml") if(type(co...
[ "def", "is_yaml_file", "(", "filename", ",", "show_warnings", "=", "False", ")", ":", "if", "is_json_file", "(", "filename", ")", ":", "return", "(", "False", ")", "try", ":", "config_dict", "=", "load_config", "(", "filename", ",", "file_type", "=", "\"ya...
Check configuration file type is yaml Return a boolean indicating wheather the file is yaml format or not
[ "Check", "configuration", "file", "type", "is", "yaml", "Return", "a", "boolean", "indicating", "wheather", "the", "file", "is", "yaml", "format", "or", "not" ]
8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b
https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L13-L27
train
55,826
Miachol/pycnf
pycnf/configtype.py
is_ini_file
def is_ini_file(filename, show_warnings = False): """Check configuration file type is INI Return a boolean indicating wheather the file is INI format or not """ try: config_dict = load_config(filename, file_type = "ini") if config_dict == {}: is_ini = False else: ...
python
def is_ini_file(filename, show_warnings = False): """Check configuration file type is INI Return a boolean indicating wheather the file is INI format or not """ try: config_dict = load_config(filename, file_type = "ini") if config_dict == {}: is_ini = False else: ...
[ "def", "is_ini_file", "(", "filename", ",", "show_warnings", "=", "False", ")", ":", "try", ":", "config_dict", "=", "load_config", "(", "filename", ",", "file_type", "=", "\"ini\"", ")", "if", "config_dict", "==", "{", "}", ":", "is_ini", "=", "False", ...
Check configuration file type is INI Return a boolean indicating wheather the file is INI format or not
[ "Check", "configuration", "file", "type", "is", "INI", "Return", "a", "boolean", "indicating", "wheather", "the", "file", "is", "INI", "format", "or", "not" ]
8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b
https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L29-L41
train
55,827
Miachol/pycnf
pycnf/configtype.py
is_toml_file
def is_toml_file(filename, show_warnings = False): """Check configuration file type is TOML Return a boolean indicating wheather the file is TOML format or not """ if is_yaml_file(filename): return(False) try: config_dict = load_config(filename, file_type = "toml") is_toml = ...
python
def is_toml_file(filename, show_warnings = False): """Check configuration file type is TOML Return a boolean indicating wheather the file is TOML format or not """ if is_yaml_file(filename): return(False) try: config_dict = load_config(filename, file_type = "toml") is_toml = ...
[ "def", "is_toml_file", "(", "filename", ",", "show_warnings", "=", "False", ")", ":", "if", "is_yaml_file", "(", "filename", ")", ":", "return", "(", "False", ")", "try", ":", "config_dict", "=", "load_config", "(", "filename", ",", "file_type", "=", "\"to...
Check configuration file type is TOML Return a boolean indicating wheather the file is TOML format or not
[ "Check", "configuration", "file", "type", "is", "TOML", "Return", "a", "boolean", "indicating", "wheather", "the", "file", "is", "TOML", "format", "or", "not" ]
8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b
https://github.com/Miachol/pycnf/blob/8fc0f25b0d6f9f3a79dbd30027fcb22c981afa4b/pycnf/configtype.py#L43-L54
train
55,828
jrief/django-nodebow
nodebow/management/commands/_base.py
BaseCommand._collect_settings
def _collect_settings(self, apps): """ Iterate over given apps or INSTALLED_APPS and collect the content of each's settings file, which is expected to be in JSON format. """ contents = {} if apps: for app in apps: if app not in settings.INSTALL...
python
def _collect_settings(self, apps): """ Iterate over given apps or INSTALLED_APPS and collect the content of each's settings file, which is expected to be in JSON format. """ contents = {} if apps: for app in apps: if app not in settings.INSTALL...
[ "def", "_collect_settings", "(", "self", ",", "apps", ")", ":", "contents", "=", "{", "}", "if", "apps", ":", "for", "app", "in", "apps", ":", "if", "app", "not", "in", "settings", ".", "INSTALLED_APPS", ":", "raise", "CommandError", "(", "\"Application ...
Iterate over given apps or INSTALLED_APPS and collect the content of each's settings file, which is expected to be in JSON format.
[ "Iterate", "over", "given", "apps", "or", "INSTALLED_APPS", "and", "collect", "the", "content", "of", "each", "s", "settings", "file", "which", "is", "expected", "to", "be", "in", "JSON", "format", "." ]
36053f3e9d156a95376d29533d2ec40f56c70f05
https://github.com/jrief/django-nodebow/blob/36053f3e9d156a95376d29533d2ec40f56c70f05/nodebow/management/commands/_base.py#L31-L50
train
55,829
LeastAuthority/txkube
src/txkube/_model.py
required_unique
def required_unique(objects, key): """ A pyrsistent invariant which requires all objects in the given iterable to have a unique key. :param objects: The objects to check. :param key: A one-argument callable to compute the key of an object. :return: An invariant failure if any two or more objec...
python
def required_unique(objects, key): """ A pyrsistent invariant which requires all objects in the given iterable to have a unique key. :param objects: The objects to check. :param key: A one-argument callable to compute the key of an object. :return: An invariant failure if any two or more objec...
[ "def", "required_unique", "(", "objects", ",", "key", ")", ":", "keys", "=", "{", "}", "duplicate", "=", "set", "(", ")", "for", "k", "in", "map", "(", "key", ",", "objects", ")", ":", "keys", "[", "k", "]", "=", "keys", ".", "get", "(", "k", ...
A pyrsistent invariant which requires all objects in the given iterable to have a unique key. :param objects: The objects to check. :param key: A one-argument callable to compute the key of an object. :return: An invariant failure if any two or more objects have the same key computed. An inva...
[ "A", "pyrsistent", "invariant", "which", "requires", "all", "objects", "in", "the", "given", "iterable", "to", "have", "a", "unique", "key", "." ]
a7e555d00535ff787d4b1204c264780da40cf736
https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_model.py#L236-L255
train
55,830
LeastAuthority/txkube
src/txkube/_model.py
_List.item_by_name
def item_by_name(self, name): """ Find an item in this collection by its name metadata. :param unicode name: The name of the object for which to search. :raise KeyError: If no object matching the given name is found. :return IObject: The object with the matching name. "...
python
def item_by_name(self, name): """ Find an item in this collection by its name metadata. :param unicode name: The name of the object for which to search. :raise KeyError: If no object matching the given name is found. :return IObject: The object with the matching name. "...
[ "def", "item_by_name", "(", "self", ",", "name", ")", ":", "for", "obj", "in", "self", ".", "items", ":", "if", "obj", ".", "metadata", ".", "name", "==", "name", ":", "return", "obj", "raise", "KeyError", "(", "name", ")" ]
Find an item in this collection by its name metadata. :param unicode name: The name of the object for which to search. :raise KeyError: If no object matching the given name is found. :return IObject: The object with the matching name.
[ "Find", "an", "item", "in", "this", "collection", "by", "its", "name", "metadata", "." ]
a7e555d00535ff787d4b1204c264780da40cf736
https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_model.py#L292-L304
train
55,831
chrizzFTD/naming
naming/base.py
_BaseName._init_name_core
def _init_name_core(self, name: str): """Runs whenever a new instance is initialized or `sep` is set.""" self.__regex = re.compile(rf'^{self._pattern}$') self.name = name
python
def _init_name_core(self, name: str): """Runs whenever a new instance is initialized or `sep` is set.""" self.__regex = re.compile(rf'^{self._pattern}$') self.name = name
[ "def", "_init_name_core", "(", "self", ",", "name", ":", "str", ")", ":", "self", ".", "__regex", "=", "re", ".", "compile", "(", "rf'^{self._pattern}$'", ")", "self", ".", "name", "=", "name" ]
Runs whenever a new instance is initialized or `sep` is set.
[ "Runs", "whenever", "a", "new", "instance", "is", "initialized", "or", "sep", "is", "set", "." ]
ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L132-L135
train
55,832
chrizzFTD/naming
naming/base.py
_BaseName.get_name
def get_name(self, **values) -> str: """Get a new name string from this object's name values. :param values: Variable keyword arguments where the **key** should refer to a field on this object that will use the provided **value** to build the new name. """ if not ...
python
def get_name(self, **values) -> str: """Get a new name string from this object's name values. :param values: Variable keyword arguments where the **key** should refer to a field on this object that will use the provided **value** to build the new name. """ if not ...
[ "def", "get_name", "(", "self", ",", "*", "*", "values", ")", "->", "str", ":", "if", "not", "values", "and", "self", ".", "name", ":", "return", "self", ".", "name", "if", "values", ":", "# if values are provided, solve compounds that may be affected", "for",...
Get a new name string from this object's name values. :param values: Variable keyword arguments where the **key** should refer to a field on this object that will use the provided **value** to build the new name.
[ "Get", "a", "new", "name", "string", "from", "this", "object", "s", "name", "values", "." ]
ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L205-L221
train
55,833
chrizzFTD/naming
naming/base.py
_BaseName.cast_config
def cast_config(cls, config: typing.Mapping[str, str]) -> typing.Dict[str, str]: """Cast `config` to grouped regular expressions.""" return {k: cls.cast(v, k) for k, v in config.items()}
python
def cast_config(cls, config: typing.Mapping[str, str]) -> typing.Dict[str, str]: """Cast `config` to grouped regular expressions.""" return {k: cls.cast(v, k) for k, v in config.items()}
[ "def", "cast_config", "(", "cls", ",", "config", ":", "typing", ".", "Mapping", "[", "str", ",", "str", "]", ")", "->", "typing", ".", "Dict", "[", "str", ",", "str", "]", ":", "return", "{", "k", ":", "cls", ".", "cast", "(", "v", ",", "k", ...
Cast `config` to grouped regular expressions.
[ "Cast", "config", "to", "grouped", "regular", "expressions", "." ]
ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c
https://github.com/chrizzFTD/naming/blob/ed0efbd2a3718f977c01cc15b33aeb1aa4fb299c/naming/base.py#L232-L234
train
55,834
diamondman/proteusisc
proteusisc/cabledriver.py
CableDriver._execute_primitives
def _execute_primitives(self, commands): """Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises. Args: commands: A list of Executable Primitives to be run in order. """ for p in commands: if self...
python
def _execute_primitives(self, commands): """Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises. Args: commands: A list of Executable Primitives to be run in order. """ for p in commands: if self...
[ "def", "_execute_primitives", "(", "self", ",", "commands", ")", ":", "for", "p", "in", "commands", ":", "if", "self", ".", "_scanchain", "and", "self", ".", "_scanchain", ".", "_debug", ":", "print", "(", "\" Executing\"", ",", "p", ")", "#pragma: no cov...
Run a list of executable primitives on this controller, and distribute the returned data to the associated TDOPromises. Args: commands: A list of Executable Primitives to be run in order.
[ "Run", "a", "list", "of", "executable", "primitives", "on", "this", "controller", "and", "distribute", "the", "returned", "data", "to", "the", "associated", "TDOPromises", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/cabledriver.py#L53-L63
train
55,835
jic-dtool/dtool-cli
dtool_cli/cli.py
pretty_version_text
def pretty_version_text(): """Return pretty version text listing all plugins.""" version_lines = ["dtool, version {}".format(dtool_version)] version_lines.append("\nBase:") version_lines.append("dtoolcore, version {}".format(dtoolcore.__version__)) version_lines.append("dtool-cli, version {}".format...
python
def pretty_version_text(): """Return pretty version text listing all plugins.""" version_lines = ["dtool, version {}".format(dtool_version)] version_lines.append("\nBase:") version_lines.append("dtoolcore, version {}".format(dtoolcore.__version__)) version_lines.append("dtool-cli, version {}".format...
[ "def", "pretty_version_text", "(", ")", ":", "version_lines", "=", "[", "\"dtool, version {}\"", ".", "format", "(", "dtool_version", ")", "]", "version_lines", ".", "append", "(", "\"\\nBase:\"", ")", "version_lines", ".", "append", "(", "\"dtoolcore, version {}\""...
Return pretty version text listing all plugins.
[ "Return", "pretty", "version", "text", "listing", "all", "plugins", "." ]
010d573d98cfe870cf489844c3feaab4976425ff
https://github.com/jic-dtool/dtool-cli/blob/010d573d98cfe870cf489844c3feaab4976425ff/dtool_cli/cli.py#L89-L120
train
55,836
jic-dtool/dtool-cli
dtool_cli/cli.py
dtool
def dtool(debug): """Tool to work with datasets.""" level = logging.WARNING if debug: level = logging.DEBUG logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=level)
python
def dtool(debug): """Tool to work with datasets.""" level = logging.WARNING if debug: level = logging.DEBUG logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=level)
[ "def", "dtool", "(", "debug", ")", ":", "level", "=", "logging", ".", "WARNING", "if", "debug", ":", "level", "=", "logging", ".", "DEBUG", "logging", ".", "basicConfig", "(", "format", "=", "'%(asctime)s - %(name)s - %(levelname)s - %(message)s'", ",", "level",...
Tool to work with datasets.
[ "Tool", "to", "work", "with", "datasets", "." ]
010d573d98cfe870cf489844c3feaab4976425ff
https://github.com/jic-dtool/dtool-cli/blob/010d573d98cfe870cf489844c3feaab4976425ff/dtool_cli/cli.py#L127-L134
train
55,837
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.add_nic
def add_nic(self, instance_id, net_id): """Add a Network Interface Controller""" #TODO: upgrade with port_id and fixed_ip in future self.client.servers.interface_attach( instance_id, None, net_id, None) return True
python
def add_nic(self, instance_id, net_id): """Add a Network Interface Controller""" #TODO: upgrade with port_id and fixed_ip in future self.client.servers.interface_attach( instance_id, None, net_id, None) return True
[ "def", "add_nic", "(", "self", ",", "instance_id", ",", "net_id", ")", ":", "#TODO: upgrade with port_id and fixed_ip in future", "self", ".", "client", ".", "servers", ".", "interface_attach", "(", "instance_id", ",", "None", ",", "net_id", ",", "None", ")", "r...
Add a Network Interface Controller
[ "Add", "a", "Network", "Interface", "Controller" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L112-L117
train
55,838
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.delete_nic
def delete_nic(self, instance_id, port_id): """Delete a Network Interface Controller""" self.client.servers.interface_detach(instance_id, port_id) return True
python
def delete_nic(self, instance_id, port_id): """Delete a Network Interface Controller""" self.client.servers.interface_detach(instance_id, port_id) return True
[ "def", "delete_nic", "(", "self", ",", "instance_id", ",", "port_id", ")", ":", "self", ".", "client", ".", "servers", ".", "interface_detach", "(", "instance_id", ",", "port_id", ")", "return", "True" ]
Delete a Network Interface Controller
[ "Delete", "a", "Network", "Interface", "Controller" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L119-L122
train
55,839
HPCC-Cloud-Computing/CAL
calplus/v1/compute/drivers/openstack.py
OpenstackDriver.disassociate_public_ip
def disassociate_public_ip(self, public_ip_id): """Disassociate a external IP""" floating_ip = self.client.floating_ips.get(public_ip_id) floating_ip = floating_ip.to_dict() instance_id = floating_ip.get('instance_id') address = floating_ip.get('ip') self.client.servers....
python
def disassociate_public_ip(self, public_ip_id): """Disassociate a external IP""" floating_ip = self.client.floating_ips.get(public_ip_id) floating_ip = floating_ip.to_dict() instance_id = floating_ip.get('instance_id') address = floating_ip.get('ip') self.client.servers....
[ "def", "disassociate_public_ip", "(", "self", ",", "public_ip_id", ")", ":", "floating_ip", "=", "self", ".", "client", ".", "floating_ips", ".", "get", "(", "public_ip_id", ")", "floating_ip", "=", "floating_ip", ".", "to_dict", "(", ")", "instance_id", "=", ...
Disassociate a external IP
[ "Disassociate", "a", "external", "IP" ]
7134b3dfe9ee3a383506a592765c7a12fa4ca1e9
https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/compute/drivers/openstack.py#L149-L158
train
55,840
diamondman/proteusisc
proteusisc/promise.py
TDOPromise.split
def split(self, bitindex): """Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all read...
python
def split(self, bitindex): """Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all read...
[ "def", "split", "(", "self", ",", "bitindex", ")", ":", "if", "bitindex", "<", "0", ":", "raise", "ValueError", "(", "\"bitindex must be larger or equal to 0.\"", ")", "if", "bitindex", ">", "len", "(", "self", ")", ":", "raise", "ValueError", "(", "\"bitind...
Split a promise into two promises at the provided index. A common operation in JTAG is reading/writing to a register. During the operation, the TMS pin must be low, but during the writing of the last bit, the TMS pin must be high. Requiring all reads or writes to have full arbitrary ...
[ "Split", "a", "promise", "into", "two", "promises", "at", "the", "provided", "index", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L105-L149
train
55,841
diamondman/proteusisc
proteusisc/promise.py
TDOPromise._fulfill
def _fulfill(self, bits, ignore_nonpromised_bits=False): """Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data t...
python
def _fulfill(self, bits, ignore_nonpromised_bits=False): """Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data t...
[ "def", "_fulfill", "(", "self", ",", "bits", ",", "ignore_nonpromised_bits", "=", "False", ")", ":", "if", "self", ".", "_allsubsfulfilled", "(", ")", ":", "if", "not", "self", ".", "_components", ":", "if", "ignore_nonpromised_bits", ":", "self", ".", "_v...
Supply the promise with the bits from its associated primitive's execution. The fulfillment process must walk the promise chain backwards until it reaches the original promise and can supply the final value. The data that comes in can either be all a bit read for every bit writ...
[ "Supply", "the", "promise", "with", "the", "bits", "from", "its", "associated", "primitive", "s", "execution", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L151-L182
train
55,842
diamondman/proteusisc
proteusisc/promise.py
TDOPromise.makesubatoffset
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data c...
python
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data c...
[ "def", "makesubatoffset", "(", "self", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "if", "_offsetideal", "is", "None", ":", "_offsetideal", "=", "bitoffset", "if", "bitoffset", "is", "0", ":", "return", "self", "newpromise", "="...
Create a copy of this promise with an offset, and use it as this promise's child. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data coming from the new primitive. Args: bitoffset: An...
[ "Create", "a", "copy", "of", "this", "promise", "with", "an", "offset", "and", "use", "it", "as", "this", "promise", "s", "child", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L193-L222
train
55,843
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.add
def add(self, promise, bitoffset, *, _offsetideal=None): """Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An int...
python
def add(self, promise, bitoffset, *, _offsetideal=None): """Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An int...
[ "def", "add", "(", "self", ",", "promise", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "#This Assumes that things are added in order.", "#Sorting or checking should likely be added.", "if", "_offsetideal", "is", "None", ":", "_offsetideal", ...
Add a promise to the promise collection at an optional offset. Args: promise: A TDOPromise to add to this collection. bitoffset: An integer offset for this new promise in the collection. _offsetideal: An integer offset for this new promise in the collection if the associated...
[ "Add", "a", "promise", "to", "the", "promise", "collection", "at", "an", "optional", "offset", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L239-L257
train
55,844
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.split
def split(self, bitindex): """Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' i...
python
def split(self, bitindex): """Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' i...
[ "def", "split", "(", "self", ",", "bitindex", ")", ":", "if", "bitindex", "<", "0", ":", "raise", "ValueError", "(", "\"bitindex must be larger or equal to 0.\"", ")", "if", "bitindex", "==", "0", ":", "return", "None", ",", "self", "lastend", "=", "0", "s...
Split a promise into two promises. A tail bit, and the 'rest'. Same operation as the one on TDOPromise, except this works with a collection of promises and splits the appropriate one. Returns: The 'Rest' and the 'Tail'. The 'Rest' is TDOPromiseCollection containing the ...
[ "Split", "a", "promise", "into", "two", "promises", ".", "A", "tail", "bit", "and", "the", "rest", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L259-L317
train
55,845
diamondman/proteusisc
proteusisc/promise.py
TDOPromiseCollection.makesubatoffset
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to ke...
python
def makesubatoffset(self, bitoffset, *, _offsetideal=None): """Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to ke...
[ "def", "makesubatoffset", "(", "self", ",", "bitoffset", ",", "*", ",", "_offsetideal", "=", "None", ")", ":", "if", "_offsetideal", "is", "None", ":", "_offsetideal", "=", "bitoffset", "if", "bitoffset", "is", "0", ":", "return", "self", "newpromise", "="...
Create a copy of this PromiseCollection with an offset applied to each contained promise and register each with their parent. If this promise's primitive is being merged with another primitive, a new subpromise may be required to keep track of the new offset of data coming from the new primitiv...
[ "Create", "a", "copy", "of", "this", "PromiseCollection", "with", "an", "offset", "applied", "to", "each", "contained", "promise", "and", "register", "each", "with", "their", "parent", "." ]
7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c
https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/promise.py#L335-L358
train
55,846
e7dal/bubble3
bubble3/commands/cmd_rules.py
cli
def cli(ctx, stage): """Show transformer rules""" if not ctx.bubble: ctx.say_yellow('There is no bubble present, ' + 'will not show any transformer rules') raise click.Abort() path = ctx.home + '/' RULES = None ctx.say('Stage:'+stage, verbosity=10) if stag...
python
def cli(ctx, stage): """Show transformer rules""" if not ctx.bubble: ctx.say_yellow('There is no bubble present, ' + 'will not show any transformer rules') raise click.Abort() path = ctx.home + '/' RULES = None ctx.say('Stage:'+stage, verbosity=10) if stag...
[ "def", "cli", "(", "ctx", ",", "stage", ")", ":", "if", "not", "ctx", ".", "bubble", ":", "ctx", ".", "say_yellow", "(", "'There is no bubble present, '", "+", "'will not show any transformer rules'", ")", "raise", "click", ".", "Abort", "(", ")", "path", "=...
Show transformer rules
[ "Show", "transformer", "rules" ]
59c735281a95b44f6263a25f4d6ce24fca520082
https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_rules.py#L16-L65
train
55,847
sporsh/carnifex
carnifex/ssh/session.py
connectExec
def connectExec(connection, protocol, commandLine): """Connect a Protocol to a ssh exec session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestExec(commandLine) return deferred
python
def connectExec(connection, protocol, commandLine): """Connect a Protocol to a ssh exec session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestExec(commandLine) return deferred
[ "def", "connectExec", "(", "connection", ",", "protocol", ",", "commandLine", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "retur...
Connect a Protocol to a ssh exec session
[ "Connect", "a", "Protocol", "to", "a", "ssh", "exec", "session" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L14-L21
train
55,848
sporsh/carnifex
carnifex/ssh/session.py
connectShell
def connectShell(connection, protocol): """Connect a Protocol to a ssh shell session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestShell() return deferred
python
def connectShell(connection, protocol): """Connect a Protocol to a ssh shell session """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestShell() return deferred
[ "def", "connectShell", "(", "connection", ",", "protocol", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "return", "session", ".",...
Connect a Protocol to a ssh shell session
[ "Connect", "a", "Protocol", "to", "a", "ssh", "shell", "session" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L23-L30
train
55,849
sporsh/carnifex
carnifex/ssh/session.py
connectSubsystem
def connectSubsystem(connection, protocol, subsystem): """Connect a Protocol to a ssh subsystem channel """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestSubsystem(subsystem) return deferred
python
def connectSubsystem(connection, protocol, subsystem): """Connect a Protocol to a ssh subsystem channel """ deferred = connectSession(connection, protocol) @deferred.addCallback def requestSubsystem(session): return session.requestSubsystem(subsystem) return deferred
[ "def", "connectSubsystem", "(", "connection", ",", "protocol", ",", "subsystem", ")", ":", "deferred", "=", "connectSession", "(", "connection", ",", "protocol", ")", "@", "deferred", ".", "addCallback", "def", "requestSubsystem", "(", "session", ")", ":", "re...
Connect a Protocol to a ssh subsystem channel
[ "Connect", "a", "Protocol", "to", "a", "ssh", "subsystem", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L32-L39
train
55,850
sporsh/carnifex
carnifex/ssh/session.py
connectSession
def connectSession(connection, protocol, sessionFactory=None, *args, **kwargs): """Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory ...
python
def connectSession(connection, protocol, sessionFactory=None, *args, **kwargs): """Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory ...
[ "def", "connectSession", "(", "connection", ",", "protocol", ",", "sessionFactory", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "factory", "=", "sessionFactory", "or", "defaultSessionFactory", "session", "=", "factory", "(", "*", "args"...
Open a SSHSession channel and connect a Protocol to it @param connection: the SSH Connection to open the session channel on @param protocol: the Protocol instance to connect to the session @param sessionFactory: factory method to generate a SSHSession instance @note: :args: and :kwargs: are passed to t...
[ "Open", "a", "SSHSession", "channel", "and", "connect", "a", "Protocol", "to", "it" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L41-L64
train
55,851
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestSubsystem
def requestSubsystem(self, subsystem): """Request a subsystem and return a deferred reply. """ data = common.NS(subsystem) return self.sendRequest('subsystem', data, wantReply=True)
python
def requestSubsystem(self, subsystem): """Request a subsystem and return a deferred reply. """ data = common.NS(subsystem) return self.sendRequest('subsystem', data, wantReply=True)
[ "def", "requestSubsystem", "(", "self", ",", "subsystem", ")", ":", "data", "=", "common", ".", "NS", "(", "subsystem", ")", "return", "self", ".", "sendRequest", "(", "'subsystem'", ",", "data", ",", "wantReply", "=", "True", ")" ]
Request a subsystem and return a deferred reply.
[ "Request", "a", "subsystem", "and", "return", "a", "deferred", "reply", "." ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L104-L108
train
55,852
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestPty
def requestPty(self, term=None, rows=0, cols=0, xpixel=0, ypixel=0, modes=''): """Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e....
python
def requestPty(self, term=None, rows=0, cols=0, xpixel=0, ypixel=0, modes=''): """Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e....
[ "def", "requestPty", "(", "self", ",", "term", "=", "None", ",", "rows", "=", "0", ",", "cols", "=", "0", ",", "xpixel", "=", "0", ",", "ypixel", "=", "0", ",", "modes", "=", "''", ")", ":", "#TODO: Needs testing!", "term", "=", "term", "or", "os...
Request allocation of a pseudo-terminal for a channel @param term: TERM environment variable value (e.g., vt100) @param columns: terminal width, characters (e.g., 80) @param rows: terminal height, rows (e.g., 24) @param width: terminal width, pixels (e.g., 640) @param height: te...
[ "Request", "allocation", "of", "a", "pseudo", "-", "terminal", "for", "a", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L110-L128
train
55,853
sporsh/carnifex
carnifex/ssh/session.py
SSHSession.requestEnv
def requestEnv(self, env={}): """Send requests to set the environment variables for the channel """ for variable, value in env.items(): data = common.NS(variable) + common.NS(value) self.sendRequest('env', data)
python
def requestEnv(self, env={}): """Send requests to set the environment variables for the channel """ for variable, value in env.items(): data = common.NS(variable) + common.NS(value) self.sendRequest('env', data)
[ "def", "requestEnv", "(", "self", ",", "env", "=", "{", "}", ")", ":", "for", "variable", ",", "value", "in", "env", ".", "items", "(", ")", ":", "data", "=", "common", ".", "NS", "(", "variable", ")", "+", "common", ".", "NS", "(", "value", ")...
Send requests to set the environment variables for the channel
[ "Send", "requests", "to", "set", "the", "environment", "variables", "for", "the", "channel" ]
82dd3bd2bc134dfb69a78f43171e227f2127060b
https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/session.py#L130-L135
train
55,854
PhracturedBlue/asterisk_mbox
asterisk_mbox/commands.py
commandstr
def commandstr(command): """Convert command into string.""" if command == CMD_MESSAGE_ERROR: msg = "CMD_MESSAGE_ERROR" elif command == CMD_MESSAGE_LIST: msg = "CMD_MESSAGE_LIST" elif command == CMD_MESSAGE_PASSWORD: msg = "CMD_MESSAGE_PASSWORD" elif command == CMD_MESSAGE_MP3...
python
def commandstr(command): """Convert command into string.""" if command == CMD_MESSAGE_ERROR: msg = "CMD_MESSAGE_ERROR" elif command == CMD_MESSAGE_LIST: msg = "CMD_MESSAGE_LIST" elif command == CMD_MESSAGE_PASSWORD: msg = "CMD_MESSAGE_PASSWORD" elif command == CMD_MESSAGE_MP3...
[ "def", "commandstr", "(", "command", ")", ":", "if", "command", "==", "CMD_MESSAGE_ERROR", ":", "msg", "=", "\"CMD_MESSAGE_ERROR\"", "elif", "command", "==", "CMD_MESSAGE_LIST", ":", "msg", "=", "\"CMD_MESSAGE_LIST\"", "elif", "command", "==", "CMD_MESSAGE_PASSWORD"...
Convert command into string.
[ "Convert", "command", "into", "string", "." ]
275de1e71ed05c6acff1a5fa87f754f4d385a372
https://github.com/PhracturedBlue/asterisk_mbox/blob/275de1e71ed05c6acff1a5fa87f754f4d385a372/asterisk_mbox/commands.py#L13-L33
train
55,855
Equitable/trump
docs/diagrams/tsadisplay/reflect.py
run
def run(): """Command for reflection database objects""" parser = OptionParser( version=__version__, description=__doc__, ) parser.add_option( '-u', '--url', dest='url', help='Database URL (connection string)', ) parser.add_option( '-r', '--render', dest='render...
python
def run(): """Command for reflection database objects""" parser = OptionParser( version=__version__, description=__doc__, ) parser.add_option( '-u', '--url', dest='url', help='Database URL (connection string)', ) parser.add_option( '-r', '--render', dest='render...
[ "def", "run", "(", ")", ":", "parser", "=", "OptionParser", "(", "version", "=", "__version__", ",", "description", "=", "__doc__", ",", ")", "parser", ".", "add_option", "(", "'-u'", ",", "'--url'", ",", "dest", "=", "'url'", ",", "help", "=", "'Datab...
Command for reflection database objects
[ "Command", "for", "reflection", "database", "objects" ]
a2802692bc642fa32096374159eea7ceca2947b4
https://github.com/Equitable/trump/blob/a2802692bc642fa32096374159eea7ceca2947b4/docs/diagrams/tsadisplay/reflect.py#L15-L86
train
55,856
EricDalrymple91/strawpy
strawpy/strawpy.py
StrawPoll.refresh
def refresh(self): """ Refresh all class attributes. """ strawpoll_response = requests.get('{api_url}/{poll_id}'.format(api_url=api_url, poll_id=self.id)) raise_status(strawpoll_response) self.status_code = strawpoll_response.status_code self.response_json = strawpoll_re...
python
def refresh(self): """ Refresh all class attributes. """ strawpoll_response = requests.get('{api_url}/{poll_id}'.format(api_url=api_url, poll_id=self.id)) raise_status(strawpoll_response) self.status_code = strawpoll_response.status_code self.response_json = strawpoll_re...
[ "def", "refresh", "(", "self", ")", ":", "strawpoll_response", "=", "requests", ".", "get", "(", "'{api_url}/{poll_id}'", ".", "format", "(", "api_url", "=", "api_url", ",", "poll_id", "=", "self", ".", "id", ")", ")", "raise_status", "(", "strawpoll_respons...
Refresh all class attributes.
[ "Refresh", "all", "class", "attributes", "." ]
0c4294fc2dca250a5c13a97e825ae21587278a91
https://github.com/EricDalrymple91/strawpy/blob/0c4294fc2dca250a5c13a97e825ae21587278a91/strawpy/strawpy.py#L157-L172
train
55,857
iskandr/serializable
serializable/serializable.py
Serializable.write_json_file
def write_json_file(self, path): """ Serialize this VariantCollection to a JSON representation and write it out to a text file. """ with open(path, "w") as f: f.write(self.to_json())
python
def write_json_file(self, path): """ Serialize this VariantCollection to a JSON representation and write it out to a text file. """ with open(path, "w") as f: f.write(self.to_json())
[ "def", "write_json_file", "(", "self", ",", "path", ")", ":", "with", "open", "(", "path", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "self", ".", "to_json", "(", ")", ")" ]
Serialize this VariantCollection to a JSON representation and write it out to a text file.
[ "Serialize", "this", "VariantCollection", "to", "a", "JSON", "representation", "and", "write", "it", "out", "to", "a", "text", "file", "." ]
6807dfd582567b3bda609910806b7429d8d53b44
https://github.com/iskandr/serializable/blob/6807dfd582567b3bda609910806b7429d8d53b44/serializable/serializable.py#L92-L98
train
55,858
iskandr/serializable
serializable/serializable.py
Serializable.read_json_file
def read_json_file(cls, path): """ Construct a VariantCollection from a JSON file. """ with open(path, 'r') as f: json_string = f.read() return cls.from_json(json_string)
python
def read_json_file(cls, path): """ Construct a VariantCollection from a JSON file. """ with open(path, 'r') as f: json_string = f.read() return cls.from_json(json_string)
[ "def", "read_json_file", "(", "cls", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "json_string", "=", "f", ".", "read", "(", ")", "return", "cls", ".", "from_json", "(", "json_string", ")" ]
Construct a VariantCollection from a JSON file.
[ "Construct", "a", "VariantCollection", "from", "a", "JSON", "file", "." ]
6807dfd582567b3bda609910806b7429d8d53b44
https://github.com/iskandr/serializable/blob/6807dfd582567b3bda609910806b7429d8d53b44/serializable/serializable.py#L101-L107
train
55,859
Yipit/ejson
ejson/__init__.py
dumps
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
python
def dumps(data, escape=False, **kwargs): """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json lib...
[ "def", "dumps", "(", "data", ",", "escape", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "'sort_keys'", "not", "in", "kwargs", ":", "kwargs", "[", "'sort_keys'", "]", "=", "True", "converted", "=", "json", ".", "dumps", "(", "data", ",", ...
A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json library can handle.
[ "A", "wrapper", "around", "json", ".", "dumps", "that", "can", "handle", "objects", "that", "json", "module", "is", "not", "aware", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L49-L70
train
55,860
Yipit/ejson
ejson/__init__.py
deserialize
def deserialize(klass, data): """Helper function to access a method that creates objects of a given `klass` with the received `data`. """ handler = DESERIALIZE_REGISTRY.get(klass) if handler: return handler(data) raise TypeError("There is no deserializer registered to handle " ...
python
def deserialize(klass, data): """Helper function to access a method that creates objects of a given `klass` with the received `data`. """ handler = DESERIALIZE_REGISTRY.get(klass) if handler: return handler(data) raise TypeError("There is no deserializer registered to handle " ...
[ "def", "deserialize", "(", "klass", ",", "data", ")", ":", "handler", "=", "DESERIALIZE_REGISTRY", ".", "get", "(", "klass", ")", "if", "handler", ":", "return", "handler", "(", "data", ")", "raise", "TypeError", "(", "\"There is no deserializer registered to ha...
Helper function to access a method that creates objects of a given `klass` with the received `data`.
[ "Helper", "function", "to", "access", "a", "method", "that", "creates", "objects", "of", "a", "given", "klass", "with", "the", "received", "data", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L73-L81
train
55,861
Yipit/ejson
ejson/__init__.py
_convert_from
def _convert_from(data): """Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry. """ try: module, klass_name = data['__class__'].rsplit('.', 1) klass = getattr(import_m...
python
def _convert_from(data): """Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry. """ try: module, klass_name = data['__class__'].rsplit('.', 1) klass = getattr(import_m...
[ "def", "_convert_from", "(", "data", ")", ":", "try", ":", "module", ",", "klass_name", "=", "data", "[", "'__class__'", "]", ".", "rsplit", "(", "'.'", ",", "1", ")", "klass", "=", "getattr", "(", "import_module", "(", "module", ")", ",", "klass_name"...
Internal function that will be hooked to the native `json.loads` Find the right deserializer for a given value, taking into account the internal deserializer registry.
[ "Internal", "function", "that", "will", "be", "hooked", "to", "the", "native", "json", ".", "loads" ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L157-L176
train
55,862
Yipit/ejson
ejson/__init__.py
_converter
def _converter(data): """Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand. """ handler = REGISTRY.get(data.__class__) if handler: full_name =...
python
def _converter(data): """Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand. """ handler = REGISTRY.get(data.__class__) if handler: full_name =...
[ "def", "_converter", "(", "data", ")", ":", "handler", "=", "REGISTRY", ".", "get", "(", "data", ".", "__class__", ")", "if", "handler", ":", "full_name", "=", "'{}.{}'", ".", "format", "(", "data", ".", "__class__", ".", "__module__", ",", "data", "."...
Internal function that will be passed to the native `json.dumps`. This function uses the `REGISTRY` of serializers and try to convert a given instance to an object that json.dumps can understand.
[ "Internal", "function", "that", "will", "be", "passed", "to", "the", "native", "json", ".", "dumps", "." ]
6665703f1534923d1c30849e08339f0ff97d8230
https://github.com/Yipit/ejson/blob/6665703f1534923d1c30849e08339f0ff97d8230/ejson/__init__.py#L179-L194
train
55,863
invinst/ResponseBot
responsebot/responsebot.py
ResponseBot.handle_error
def handle_error(self, error): """ Try to detect repetitive errors and sleep for a while to avoid being marked as spam """ logging.exception("try to sleep if there are repeating errors.") error_desc = str(error) now = datetime.datetime.now() if error_desc not in s...
python
def handle_error(self, error): """ Try to detect repetitive errors and sleep for a while to avoid being marked as spam """ logging.exception("try to sleep if there are repeating errors.") error_desc = str(error) now = datetime.datetime.now() if error_desc not in s...
[ "def", "handle_error", "(", "self", ",", "error", ")", ":", "logging", ".", "exception", "(", "\"try to sleep if there are repeating errors.\"", ")", "error_desc", "=", "str", "(", "error", ")", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ...
Try to detect repetitive errors and sleep for a while to avoid being marked as spam
[ "Try", "to", "detect", "repetitive", "errors", "and", "sleep", "for", "a", "while", "to", "avoid", "being", "marked", "as", "spam" ]
a6b1a431a343007f7ae55a193e432a61af22253f
https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot.py#L66-L87
train
55,864
ScottDuckworth/python-anyvcs
anyvcs/common.py
parse_isodate
def parse_isodate(datestr): """Parse a string that loosely fits ISO 8601 formatted date-time string """ m = isodate_rx.search(datestr) assert m, 'unrecognized date format: ' + datestr year, month, day = m.group('year', 'month', 'day') hour, minute, second, fraction = m.group('hour', 'minute', 's...
python
def parse_isodate(datestr): """Parse a string that loosely fits ISO 8601 formatted date-time string """ m = isodate_rx.search(datestr) assert m, 'unrecognized date format: ' + datestr year, month, day = m.group('year', 'month', 'day') hour, minute, second, fraction = m.group('hour', 'minute', 's...
[ "def", "parse_isodate", "(", "datestr", ")", ":", "m", "=", "isodate_rx", ".", "search", "(", "datestr", ")", "assert", "m", ",", "'unrecognized date format: '", "+", "datestr", "year", ",", "month", ",", "day", "=", "m", ".", "group", "(", "'year'", ","...
Parse a string that loosely fits ISO 8601 formatted date-time string
[ "Parse", "a", "string", "that", "loosely", "fits", "ISO", "8601", "formatted", "date", "-", "time", "string" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L43-L72
train
55,865
ScottDuckworth/python-anyvcs
anyvcs/common.py
VCSRepo.ls
def ls( self, rev, path, recursive=False, recursive_dirs=False, directory=False, report=() ): """List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. ...
python
def ls( self, rev, path, recursive=False, recursive_dirs=False, directory=False, report=() ): """List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. ...
[ "def", "ls", "(", "self", ",", "rev", ",", "path", ",", "recursive", "=", "False", ",", "recursive_dirs", "=", "False", ",", "directory", "=", "False", ",", "report", "=", "(", ")", ")", ":", "raise", "NotImplementedError" ]
List directory or file :param rev: The revision to use. :param path: The path to list. May start with a '/' or not. Directories may end with a '/' or not. :param recursive: Recursively list files in subdirectories. :param recursive_dirs: Used when recursive=True, al...
[ "List", "directory", "or", "file" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L338-L375
train
55,866
ScottDuckworth/python-anyvcs
anyvcs/common.py
VCSRepo.log
def log( self, revrange=None, limit=None, firstparent=False, merges=None, path=None, follow=False ): """Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number...
python
def log( self, revrange=None, limit=None, firstparent=False, merges=None, path=None, follow=False ): """Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number...
[ "def", "log", "(", "self", ",", "revrange", "=", "None", ",", "limit", "=", "None", ",", "firstparent", "=", "False", ",", "merges", "=", "None", ",", "path", "=", "None", ",", "follow", "=", "False", ")", ":", "raise", "NotImplementedError" ]
Get commit logs :param revrange: Either a single revision or a range of revisions as a 2-element list or tuple. :param int limit: Limit the number of log entries. :param bool firstparent: Only follow the first parent of merges. :param bool merges: True means onl...
[ "Get", "commit", "logs" ]
9eb09defbc6b7c99d373fad53cbf8fc81b637923
https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/common.py#L460-L489
train
55,867
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_create
def user_create(self, cloudflare_email, cloudflare_pass, unique_id=None): """ Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type c...
python
def user_create(self, cloudflare_email, cloudflare_pass, unique_id=None): """ Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type c...
[ "def", "user_create", "(", "self", ",", "cloudflare_email", ",", "cloudflare_pass", ",", "unique_id", "=", "None", ")", ":", "params", "=", "{", "'act'", ":", "'user_create'", ",", "'cloudflare_email'", ":", "cloudflare_email", ",", "'cloudflare_pass'", ":", "cl...
Create new cloudflare user with selected email and id. Optionally also select unique_id which can be then used to get user information. :param cloudflare_email: new user cloudflare email :type cloudflare_email: str :param cloudflare_pass: new user cloudflare password ...
[ "Create", "new", "cloudflare", "user", "with", "selected", "email", "and", "id", ".", "Optionally", "also", "select", "unique_id", "which", "can", "be", "then", "used", "to", "get", "user", "information", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L31-L53
train
55,868
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.zone_set
def zone_set(self, user_key, zone_name, resolve_to, subdomains): """ Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: s...
python
def zone_set(self, user_key, zone_name, resolve_to, subdomains): """ Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: s...
[ "def", "zone_set", "(", "self", ",", "user_key", ",", "zone_name", ",", "resolve_to", ",", "subdomains", ")", ":", "params", "=", "{", "'act'", ":", "'zone_set'", ",", "'user_key'", ":", "user_key", ",", "'zone_name'", ":", "zone_name", ",", "'resolve_to'", ...
Create new zone for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: str :param zone_name: The zone you'd like to run CNAMES through CloudFlare...
[ "Create", "new", "zone", "for", "user", "associated", "with", "this", "user_key", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L55-L81
train
55,869
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.full_zone_set
def full_zone_set(self, user_key, zone_name): """ Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_...
python
def full_zone_set(self, user_key, zone_name): """ Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_...
[ "def", "full_zone_set", "(", "self", ",", "user_key", ",", "zone_name", ")", ":", "params", "=", "{", "'act'", ":", "'full_zone_set'", ",", "'user_key'", ":", "user_key", ",", "'zone_name'", ":", "zone_name", ",", "}", "return", "self", ".", "_request", "(...
Create new zone and all subdomains for user associated with this user_key. :param user_key: The unique 3auth string,identifying the user's CloudFlare Account. Generated from a user_create or user_auth :type user_key: str :param zone_name: The zone you'd like to ru...
[ "Create", "new", "zone", "and", "all", "subdomains", "for", "user", "associated", "with", "this", "user_key", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L83-L102
train
55,870
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_lookup
def user_lookup(self, cloudflare_email=None, unique_id=None): """ Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associat...
python
def user_lookup(self, cloudflare_email=None, unique_id=None): """ Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associat...
[ "def", "user_lookup", "(", "self", ",", "cloudflare_email", "=", "None", ",", "unique_id", "=", "None", ")", ":", "if", "not", "cloudflare_email", "and", "not", "unique_id", ":", "raise", "KeyError", "(", "'Either cloudflare_email or unique_id must be present'", ")"...
Lookup user data based on either his cloudflare_email or his unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param unique_id: unique id associated with user :type unique_id: str :returns: :r...
[ "Lookup", "user", "data", "based", "on", "either", "his", "cloudflare_email", "or", "his", "unique_id", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L104-L127
train
55,871
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.user_auth
def user_auth( self, cloudflare_email=None, cloudflare_pass=None, unique_id=None ): """ Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str ...
python
def user_auth( self, cloudflare_email=None, cloudflare_pass=None, unique_id=None ): """ Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str ...
[ "def", "user_auth", "(", "self", ",", "cloudflare_email", "=", "None", ",", "cloudflare_pass", "=", "None", ",", "unique_id", "=", "None", ")", ":", "if", "not", "(", "cloudflare_email", "and", "cloudflare_pass", ")", "and", "not", "unique_id", ":", "raise",...
Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param cloudflare_pass: pass associated with user :type cloudflare_pass: str :param unique_id: unique id asso...
[ "Get", "user_key", "based", "on", "either", "his", "email", "and", "password", "or", "unique_id", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L129-L158
train
55,872
jlinn/pyflare
pyflare/hosting.py
PyflareHosting.zone_list
def zone_list( self, user_key, limit=100, offset=0, zone_name=None, sub_id=None, zone_status='ALL', sub_status='ALL', ): """ List zones for a user. :param user_key: key for authentication of user :type u...
python
def zone_list( self, user_key, limit=100, offset=0, zone_name=None, sub_id=None, zone_status='ALL', sub_status='ALL', ): """ List zones for a user. :param user_key: key for authentication of user :type u...
[ "def", "zone_list", "(", "self", ",", "user_key", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "zone_name", "=", "None", ",", "sub_id", "=", "None", ",", "zone_status", "=", "'ALL'", ",", "sub_status", "=", "'ALL'", ",", ")", ":", "if", ...
List zones for a user. :param user_key: key for authentication of user :type user_key: str :param limit: limit of zones shown :type limit: int :param offset: offset of zones to be shown :type offset: int :param zone_name: name of zone to...
[ "List", "zones", "for", "a", "user", "." ]
1108e82a9622d1aa6d92d4c4797744ff3cf41f68
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L196-L244
train
55,873
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.attr_exists
def attr_exists(self, attr): """Returns True if at least on instance of the attribute is found """ gen = self.attr_gen(attr) n_instances = len(list(gen)) if n_instances > 0: return True else: return False
python
def attr_exists(self, attr): """Returns True if at least on instance of the attribute is found """ gen = self.attr_gen(attr) n_instances = len(list(gen)) if n_instances > 0: return True else: return False
[ "def", "attr_exists", "(", "self", ",", "attr", ")", ":", "gen", "=", "self", ".", "attr_gen", "(", "attr", ")", "n_instances", "=", "len", "(", "list", "(", "gen", ")", ")", "if", "n_instances", ">", "0", ":", "return", "True", "else", ":", "retur...
Returns True if at least on instance of the attribute is found
[ "Returns", "True", "if", "at", "least", "on", "instance", "of", "the", "attribute", "is", "found" ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L49-L57
train
55,874
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.datasets
def datasets(self): """Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data' """ ...
python
def datasets(self): """Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data' """ ...
[ "def", "datasets", "(", "self", ")", ":", "HiisiHDF", ".", "_clear_cache", "(", ")", "self", ".", "visititems", "(", "HiisiHDF", ".", "_is_dataset", ")", "return", "HiisiHDF", ".", "CACHE", "[", "'dataset_paths'", "]" ]
Method returns a list of dataset paths. Examples -------- >>> for dataset in h5f.datasets(): print(dataset) '/dataset1/data1/data' '/dataset1/data2/data' '/dataset2/data1/data' '/dataset2/data2/data'
[ "Method", "returns", "a", "list", "of", "dataset", "paths", "." ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L69-L83
train
55,875
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.create_from_filedict
def create_from_filedict(self, filedict): """ Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-v...
python
def create_from_filedict(self, filedict): """ Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-v...
[ "def", "create_from_filedict", "(", "self", ",", "filedict", ")", ":", "if", "self", ".", "mode", "in", "[", "'r+'", ",", "'w'", ",", "'w-'", ",", "'x'", ",", "'a'", "]", ":", "for", "h5path", ",", "path_content", "in", "filedict", ".", "iteritems", ...
Creates h5 file from dictionary containing the file structure. Filedict is a regular dictinary whose keys are hdf5 paths and whose values are dictinaries containing the metadata and datasets. Metadata is given as normal key-value -pairs and dataset arrays are given using 'DATASE...
[ "Creates", "h5", "file", "from", "dictionary", "containing", "the", "file", "structure", ".", "Filedict", "is", "a", "regular", "dictinary", "whose", "keys", "are", "hdf5", "paths", "and", "whose", "values", "are", "dictinaries", "containing", "the", "metadata",...
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L135-L181
train
55,876
karjaljo/hiisi
hiisi/hiisi.py
HiisiHDF.search
def search(self, attr, value, tolerance=0): """Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- toler...
python
def search(self, attr, value, tolerance=0): """Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- toler...
[ "def", "search", "(", "self", ",", "attr", ",", "value", ",", "tolerance", "=", "0", ")", ":", "found_paths", "=", "[", "]", "gen", "=", "self", ".", "attr_gen", "(", "attr", ")", "for", "path_attr_pair", "in", "gen", ":", "# if attribute is numerical us...
Find paths with a key value match Parameters ---------- attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- tolerance : float tolerance used when searching ...
[ "Find", "paths", "with", "a", "key", "value", "match" ]
de6a64df5dcbcb37d5d3d5468663e65a7794f9a8
https://github.com/karjaljo/hiisi/blob/de6a64df5dcbcb37d5d3d5468663e65a7794f9a8/hiisi/hiisi.py#L183-L238
train
55,877
hollenstein/maspy
maspy/isobar.py
_extractReporterIons
def _extractReporterIons(ionArrays, reporterMz, mzTolerance): """Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of mult...
python
def _extractReporterIons(ionArrays, reporterMz, mzTolerance): """Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of mult...
[ "def", "_extractReporterIons", "(", "ionArrays", ",", "reporterMz", ",", "mzTolerance", ")", ":", "reporterIons", "=", "{", "'mz'", ":", "[", "]", ",", "'i'", ":", "[", "]", "}", "for", "reporterMzValue", "in", "reporterMz", ":", "limHi", "=", "reporterMzV...
Find and a list of reporter ions and return mz and intensity values. Expected reporter mz values are searched in "ionArray['mz']" and reported if the observed relative deviation is less than specified by "mzTolerance". In the case of multiple matches, the one with the minimal deviation is picked. If no...
[ "Find", "and", "a", "list", "of", "reporter", "ions", "and", "return", "mz", "and", "intensity", "values", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L356-L400
train
55,878
hollenstein/maspy
maspy/isobar.py
_correctIsotopeImpurities
def _correctIsotopeImpurities(matrix, intensities): """Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written ...
python
def _correctIsotopeImpurities(matrix, intensities): """Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written ...
[ "def", "_correctIsotopeImpurities", "(", "matrix", ",", "intensities", ")", ":", "correctedIntensities", ",", "_", "=", "scipy", ".", "optimize", ".", "nnls", "(", "matrix", ",", "intensities", ")", "return", "correctedIntensities" ]
Corrects observed reporter ion intensities for isotope impurities. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a COLUMN. Use maspy.isobar._transposeMatrix() if channels are written in rows. :param intensities: numpy array of observed re...
[ "Corrects", "observed", "reporter", "ion", "intensities", "for", "isotope", "impurities", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L403-L414
train
55,879
hollenstein/maspy
maspy/isobar.py
_normalizeImpurityMatrix
def _normalizeImpurityMatrix(matrix): """Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values """ newMatrix = list() ...
python
def _normalizeImpurityMatrix(matrix): """Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values """ newMatrix = list() ...
[ "def", "_normalizeImpurityMatrix", "(", "matrix", ")", ":", "newMatrix", "=", "list", "(", ")", "for", "line", "in", "matrix", ":", "total", "=", "sum", "(", "line", ")", "if", "total", "!=", "0", ":", "newMatrix", ".", "append", "(", "[", "i", "/", ...
Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values
[ "Normalize", "each", "row", "of", "the", "matrix", "that", "the", "sum", "of", "the", "row", "equals", "1", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L464-L478
train
55,880
hollenstein/maspy
maspy/isobar.py
_padImpurityMatrix
def _padImpurityMatrix(matrix, preChannels, postChannels): """Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing number...
python
def _padImpurityMatrix(matrix, preChannels, postChannels): """Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing number...
[ "def", "_padImpurityMatrix", "(", "matrix", ",", "preChannels", ",", "postChannels", ")", ":", "extendedMatrix", "=", "list", "(", ")", "lastMatrixI", "=", "len", "(", "matrix", ")", "-", "1", "for", "i", ",", "line", "in", "enumerate", "(", "matrix", ")...
Align the values of an isotope impurity matrix and fill up with 0. NOTE: The length of the rows in the "matrix" must be the sum of "preChannels" and "postChannels" + 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :pa...
[ "Align", "the", "values", "of", "an", "isotope", "impurity", "matrix", "and", "fill", "up", "with", "0", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L481-L506
train
55,881
hollenstein/maspy
maspy/isobar.py
IsobaricTag._processImpurityMatrix
def _processImpurityMatrix(self): """Process the impurity matrix so that it can be used to correct observed reporter intensities. """ processedMatrix = _normalizeImpurityMatrix(self.impurityMatrix) processedMatrix = _padImpurityMatrix( processedMatrix, self.matrixPreC...
python
def _processImpurityMatrix(self): """Process the impurity matrix so that it can be used to correct observed reporter intensities. """ processedMatrix = _normalizeImpurityMatrix(self.impurityMatrix) processedMatrix = _padImpurityMatrix( processedMatrix, self.matrixPreC...
[ "def", "_processImpurityMatrix", "(", "self", ")", ":", "processedMatrix", "=", "_normalizeImpurityMatrix", "(", "self", ".", "impurityMatrix", ")", "processedMatrix", "=", "_padImpurityMatrix", "(", "processedMatrix", ",", "self", ".", "matrixPreChannels", ",", "self...
Process the impurity matrix so that it can be used to correct observed reporter intensities.
[ "Process", "the", "impurity", "matrix", "so", "that", "it", "can", "be", "used", "to", "correct", "observed", "reporter", "intensities", "." ]
f15fcfd24df306d8420540460d902aa3073ec133
https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/isobar.py#L176-L185
train
55,882
bbelyeu/flask-exceptions
flask_exceptions/extension.py
exception
def exception(message): """Exception method convenience wrapper.""" def decorator(method): """Inner decorator so we can accept arguments.""" @wraps(method) def wrapper(self, *args, **kwargs): """Innermost decorator wrapper - this is confusing.""" if self.message...
python
def exception(message): """Exception method convenience wrapper.""" def decorator(method): """Inner decorator so we can accept arguments.""" @wraps(method) def wrapper(self, *args, **kwargs): """Innermost decorator wrapper - this is confusing.""" if self.message...
[ "def", "exception", "(", "message", ")", ":", "def", "decorator", "(", "method", ")", ":", "\"\"\"Inner decorator so we can accept arguments.\"\"\"", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ...
Exception method convenience wrapper.
[ "Exception", "method", "convenience", "wrapper", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L7-L27
train
55,883
bbelyeu/flask-exceptions
flask_exceptions/extension.py
APIException.to_dict
def to_dict(self): """Convert Exception class to a Python dictionary.""" val = dict(self.payload or ()) if self.message: val['message'] = self.message return val
python
def to_dict(self): """Convert Exception class to a Python dictionary.""" val = dict(self.payload or ()) if self.message: val['message'] = self.message return val
[ "def", "to_dict", "(", "self", ")", ":", "val", "=", "dict", "(", "self", ".", "payload", "or", "(", ")", ")", "if", "self", ".", "message", ":", "val", "[", "'message'", "]", "=", "self", ".", "message", "return", "val" ]
Convert Exception class to a Python dictionary.
[ "Convert", "Exception", "class", "to", "a", "Python", "dictionary", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L43-L48
train
55,884
bbelyeu/flask-exceptions
flask_exceptions/extension.py
AddExceptions.init_app
def init_app(self, app, config=None, statsd=None): """Init Flask Extension.""" if config is not None: self.config = config elif self.config is None: self.config = app.config self.messages = self.config.get('EXCEPTION_MESSAGE', True) self.prefix = self.con...
python
def init_app(self, app, config=None, statsd=None): """Init Flask Extension.""" if config is not None: self.config = config elif self.config is None: self.config = app.config self.messages = self.config.get('EXCEPTION_MESSAGE', True) self.prefix = self.con...
[ "def", "init_app", "(", "self", ",", "app", ",", "config", "=", "None", ",", "statsd", "=", "None", ")", ":", "if", "config", "is", "not", "None", ":", "self", ".", "config", "=", "config", "elif", "self", ".", "config", "is", "None", ":", "self", ...
Init Flask Extension.
[ "Init", "Flask", "Extension", "." ]
1812a2f4620783883a3c884b01c216bd02177dbb
https://github.com/bbelyeu/flask-exceptions/blob/1812a2f4620783883a3c884b01c216bd02177dbb/flask_exceptions/extension.py#L124-L133
train
55,885
BrianHicks/emit
emit/router/celery.py
CeleryRouter.wrap_node
def wrap_node(self, node, options): '''\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute. ''' if 'celery_task' in options: return options['cele...
python
def wrap_node(self, node, options): '''\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute. ''' if 'celery_task' in options: return options['cele...
[ "def", "wrap_node", "(", "self", ",", "node", ",", "options", ")", ":", "if", "'celery_task'", "in", "options", ":", "return", "options", "[", "'celery_task'", "]", "(", "node", ")", "return", "self", ".", "celery_task", "(", "node", ")" ]
\ celery registers tasks by decorating them, and so do we, so the user can pass a celery task and we'll wrap our code with theirs in a nice package celery can execute.
[ "\\", "celery", "registers", "tasks", "by", "decorating", "them", "and", "so", "do", "we", "so", "the", "user", "can", "pass", "a", "celery", "task", "and", "we", "ll", "wrap", "our", "code", "with", "theirs", "in", "a", "nice", "package", "celery", "c...
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/celery.py#L33-L42
train
55,886
mpavan/ediblepickle
ediblepickle.py
checkpoint
def checkpoint(key=0, unpickler=pickle.load, pickler=pickle.dump, work_dir=gettempdir(), refresh=False): """ A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different argument...
python
def checkpoint(key=0, unpickler=pickle.load, pickler=pickle.dump, work_dir=gettempdir(), refresh=False): """ A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different argument...
[ "def", "checkpoint", "(", "key", "=", "0", ",", "unpickler", "=", "pickle", ".", "load", ",", "pickler", "=", "pickle", ".", "dump", ",", "work_dir", "=", "gettempdir", "(", ")", ",", "refresh", "=", "False", ")", ":", "def", "decorator", "(", "func"...
A utility decorator to save intermediate results of a function. It is the caller's responsibility to specify a key naming scheme such that the output of each function call with different arguments is stored in a separate file. :param key: The key to store the computed intermediate output of the decorated f...
[ "A", "utility", "decorator", "to", "save", "intermediate", "results", "of", "a", "function", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "specify", "a", "key", "naming", "scheme", "such", "that", "the", "output", "of", "each", "function", ...
7dca67260caaf8a342ef7197f651c841724d67b0
https://github.com/mpavan/ediblepickle/blob/7dca67260caaf8a342ef7197f651c841724d67b0/ediblepickle.py#L41-L172
train
55,887
chrisbouchard/braillegraph
braillegraph/__main__.py
run
def run(): """Display the arguments as a braille graph on standard output.""" # We override the program name to reflect that this script must be run with # the python executable. parser = argparse.ArgumentParser( prog='python -m braillegraph', description='Print a braille bar graph of t...
python
def run(): """Display the arguments as a braille graph on standard output.""" # We override the program name to reflect that this script must be run with # the python executable. parser = argparse.ArgumentParser( prog='python -m braillegraph', description='Print a braille bar graph of t...
[ "def", "run", "(", ")", ":", "# We override the program name to reflect that this script must be run with", "# the python executable.", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'python -m braillegraph'", ",", "description", "=", "'Print a braille bar...
Display the arguments as a braille graph on standard output.
[ "Display", "the", "arguments", "as", "a", "braille", "graph", "on", "standard", "output", "." ]
744ca8394676579cfb11e5c297c9bd794ab5bd78
https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/__main__.py#L45-L88
train
55,888
MacHu-GWU/rolex-project
rolex/generator.py
_rnd_date
def _rnd_date(start, end): """Internal random date generator. """ return date.fromordinal(random.randint(start.toordinal(), end.toordinal()))
python
def _rnd_date(start, end): """Internal random date generator. """ return date.fromordinal(random.randint(start.toordinal(), end.toordinal()))
[ "def", "_rnd_date", "(", "start", ",", "end", ")", ":", "return", "date", ".", "fromordinal", "(", "random", ".", "randint", "(", "start", ".", "toordinal", "(", ")", ",", "end", ".", "toordinal", "(", ")", ")", ")" ]
Internal random date generator.
[ "Internal", "random", "date", "generator", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L253-L256
train
55,889
MacHu-GWU/rolex-project
rolex/generator.py
rnd_date_list_high_performance
def rnd_date_list_high_performance(size, start=date(1970, 1, 1), end=None, **kwargs): """ Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :par...
python
def rnd_date_list_high_performance(size, start=date(1970, 1, 1), end=None, **kwargs): """ Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :par...
[ "def", "rnd_date_list_high_performance", "(", "size", ",", "start", "=", "date", "(", "1970", ",", "1", ",", "1", ")", ",", "end", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "end", "is", "None", ":", "end", "=", "date", ".", "today", "...
Generate mass random date. :param size: int, number of :param start: date similar object, int / str / date / datetime :param end: date similar object, int / str / date / datetime, default today's date :param kwargs: args placeholder :return: list of datetime.date
[ "Generate", "mass", "random", "date", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L295-L319
train
55,890
MacHu-GWU/rolex-project
rolex/generator.py
day_interval
def day_interval(year, month, day, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.d...
python
def day_interval(year, month, day, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.d...
[ "def", "day_interval", "(", "year", ",", "month", ",", "day", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "...
Return a start datetime and end datetime of a day. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.day_interval(2014, 6, 17) >>> start datetime(2014, 6, 17, 0, 0, 0) ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "day", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L387-L414
train
55,891
MacHu-GWU/rolex-project
rolex/generator.py
month_interval
def month_interval(year, month, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.mo...
python
def month_interval(year, month, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.mo...
[ "def", "month_interval", "(", "year", ",", "month", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "else", ":", ...
Return a start datetime and end datetime of a month. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.month_interval(2000, 2) >>> start datetime(2000, 2, 1, 0, 0, 0) ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "month", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L417-L448
train
55,892
MacHu-GWU/rolex-project
rolex/generator.py
year_interval
def year_interval(year, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interv...
python
def year_interval(year, milliseconds=False, return_string=False): """ Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interv...
[ "def", "year_interval", "(", "year", ",", "milliseconds", "=", "False", ",", "return_string", "=", "False", ")", ":", "if", "milliseconds", ":", "# pragma: no cover", "delta", "=", "timedelta", "(", "milliseconds", "=", "1", ")", "else", ":", "delta", "=", ...
Return a start datetime and end datetime of a year. :param milliseconds: Minimum time resolution. :param return_string: If you want string instead of datetime, set True Usage Example:: >>> start, end = rolex.year_interval(2007) >>> start datetime(2007, 1, 1, 0, 0, 0) >>> ...
[ "Return", "a", "start", "datetime", "and", "end", "datetime", "of", "a", "year", "." ]
a1111b410ed04b4b6eddd81df110fa2dacfa6537
https://github.com/MacHu-GWU/rolex-project/blob/a1111b410ed04b4b6eddd81df110fa2dacfa6537/rolex/generator.py#L451-L478
train
55,893
mgaitan/tisu
tisu/gh.py
GithubManager.get_milestone
def get_milestone(self, title): """ given the title as str, looks for an existing milestone or create a new one, and return the object """ if not title: return GithubObject.NotSet if not hasattr(self, '_milestones'): self._milestones = {m.title: m ...
python
def get_milestone(self, title): """ given the title as str, looks for an existing milestone or create a new one, and return the object """ if not title: return GithubObject.NotSet if not hasattr(self, '_milestones'): self._milestones = {m.title: m ...
[ "def", "get_milestone", "(", "self", ",", "title", ")", ":", "if", "not", "title", ":", "return", "GithubObject", ".", "NotSet", "if", "not", "hasattr", "(", "self", ",", "'_milestones'", ")", ":", "self", ".", "_milestones", "=", "{", "m", ".", "title...
given the title as str, looks for an existing milestone or create a new one, and return the object
[ "given", "the", "title", "as", "str", "looks", "for", "an", "existing", "milestone", "or", "create", "a", "new", "one", "and", "return", "the", "object" ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L30-L43
train
55,894
mgaitan/tisu
tisu/gh.py
GithubManager.get_assignee
def get_assignee(self, login): """ given the user login, looks for a user in assignee list of the repo and return it if was found. """ if not login: return GithubObject.NotSet if not hasattr(self, '_assignees'): self._assignees = {c.login: c for c ...
python
def get_assignee(self, login): """ given the user login, looks for a user in assignee list of the repo and return it if was found. """ if not login: return GithubObject.NotSet if not hasattr(self, '_assignees'): self._assignees = {c.login: c for c ...
[ "def", "get_assignee", "(", "self", ",", "login", ")", ":", "if", "not", "login", ":", "return", "GithubObject", ".", "NotSet", "if", "not", "hasattr", "(", "self", ",", "'_assignees'", ")", ":", "self", ".", "_assignees", "=", "{", "c", ".", "login", ...
given the user login, looks for a user in assignee list of the repo and return it if was found.
[ "given", "the", "user", "login", "looks", "for", "a", "user", "in", "assignee", "list", "of", "the", "repo", "and", "return", "it", "if", "was", "found", "." ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L45-L57
train
55,895
mgaitan/tisu
tisu/gh.py
GithubManager.sender
def sender(self, issues): """ push a list of issues to github """ for issue in issues: state = self.get_state(issue.state) if issue.number: try: gh_issue = self.repo.get_issue(issue.number) original_state = ...
python
def sender(self, issues): """ push a list of issues to github """ for issue in issues: state = self.get_state(issue.state) if issue.number: try: gh_issue = self.repo.get_issue(issue.number) original_state = ...
[ "def", "sender", "(", "self", ",", "issues", ")", ":", "for", "issue", "in", "issues", ":", "state", "=", "self", ".", "get_state", "(", "issue", ".", "state", ")", "if", "issue", ".", "number", ":", "try", ":", "gh_issue", "=", "self", ".", "repo"...
push a list of issues to github
[ "push", "a", "list", "of", "issues", "to", "github" ]
7984e7ae414073ef43bb3984909ab7337471c851
https://github.com/mgaitan/tisu/blob/7984e7ae414073ef43bb3984909ab7337471c851/tisu/gh.py#L67-L102
train
55,896
BrianHicks/emit
emit/router/rq.py
RQRouter.wrap_node
def wrap_node(self, node, options): ''' we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects. ''' job_kwargs = { 'queue': options.get('queue', 'default'), 'connection': options....
python
def wrap_node(self, node, options): ''' we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects. ''' job_kwargs = { 'queue': options.get('queue', 'default'), 'connection': options....
[ "def", "wrap_node", "(", "self", ",", "node", ",", "options", ")", ":", "job_kwargs", "=", "{", "'queue'", ":", "options", ".", "get", "(", "'queue'", ",", "'default'", ")", ",", "'connection'", ":", "options", ".", "get", "(", "'connection'", ",", "se...
we have the option to construct nodes here, so we can use different queues for nodes without having to have different queue objects.
[ "we", "have", "the", "option", "to", "construct", "nodes", "here", "so", "we", "can", "use", "different", "queues", "for", "nodes", "without", "having", "to", "have", "different", "queue", "objects", "." ]
19a86c2392b136c9e857000798ccaa525aa0ed84
https://github.com/BrianHicks/emit/blob/19a86c2392b136c9e857000798ccaa525aa0ed84/emit/router/rq.py#L28-L40
train
55,897
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_albaran_automatic
def create_albaran_automatic(pk, list_lines): """ creamos de forma automatica el albaran """ line_bd = SalesLineAlbaran.objects.filter(line_order__pk__in=list_lines).values_list('line_order__pk') if line_bd.count() == 0 or len(list_lines) != len(line_bd[0]): # solo aq...
python
def create_albaran_automatic(pk, list_lines): """ creamos de forma automatica el albaran """ line_bd = SalesLineAlbaran.objects.filter(line_order__pk__in=list_lines).values_list('line_order__pk') if line_bd.count() == 0 or len(list_lines) != len(line_bd[0]): # solo aq...
[ "def", "create_albaran_automatic", "(", "pk", ",", "list_lines", ")", ":", "line_bd", "=", "SalesLineAlbaran", ".", "objects", ".", "filter", "(", "line_order__pk__in", "=", "list_lines", ")", ".", "values_list", "(", "'line_order__pk'", ")", "if", "line_bd", "....
creamos de forma automatica el albaran
[ "creamos", "de", "forma", "automatica", "el", "albaran" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1009-L1020
train
55,898
codenerix/django-codenerix-invoicing
codenerix_invoicing/models_sales_original.py
GenLineProduct.create_invoice_from_albaran
def create_invoice_from_albaran(pk, list_lines): """ la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineAlbaran.objects.values_list('line_order__pk').filter( ...
python
def create_invoice_from_albaran(pk, list_lines): """ la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos """ context = {} if list_lines: new_list_lines = [x[0] for x in SalesLineAlbaran.objects.values_list('line_order__pk').filter( ...
[ "def", "create_invoice_from_albaran", "(", "pk", ",", "list_lines", ")", ":", "context", "=", "{", "}", "if", "list_lines", ":", "new_list_lines", "=", "[", "x", "[", "0", "]", "for", "x", "in", "SalesLineAlbaran", ".", "objects", ".", "values_list", "(", ...
la pk y list_lines son de albaranes, necesitamos la info de las lineas de pedidos
[ "la", "pk", "y", "list_lines", "son", "de", "albaranes", "necesitamos", "la", "info", "de", "las", "lineas", "de", "pedidos" ]
7db5c62f335f9215a8b308603848625208b48698
https://github.com/codenerix/django-codenerix-invoicing/blob/7db5c62f335f9215a8b308603848625208b48698/codenerix_invoicing/models_sales_original.py#L1201-L1227
train
55,899