repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder.decode
def decode(self, r, nostrip=False, k=None, erasures_pos=None, only_erasures=False, return_string=True): '''Given a received string or byte array or list r of values between 0 and gf2_charac, attempts to decode it. If it's a valid codeword, or if there are no more than (n-k)/2 errors, the repaire...
python
def decode(self, r, nostrip=False, k=None, erasures_pos=None, only_erasures=False, return_string=True): '''Given a received string or byte array or list r of values between 0 and gf2_charac, attempts to decode it. If it's a valid codeword, or if there are no more than (n-k)/2 errors, the repaire...
[ "def", "decode", "(", "self", ",", "r", ",", "nostrip", "=", "False", ",", "k", "=", "None", ",", "erasures_pos", "=", "None", ",", "only_erasures", "=", "False", ",", "return_string", "=", "True", ")", ":", "n", "=", "self", ".", "n", "if", "not",...
Given a received string or byte array or list r of values between 0 and gf2_charac, attempts to decode it. If it's a valid codeword, or if there are no more than (n-k)/2 errors, the repaired message is returned. A message always has k bytes, if a message contained less it is left padded...
[ "Given", "a", "received", "string", "or", "byte", "array", "or", "list", "r", "of", "values", "between", "0", "and", "gf2_charac", "attempts", "to", "decode", "it", ".", "If", "it", "s", "a", "valid", "codeword", "or", "if", "there", "are", "no", "more...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L248-L371
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._list_lstrip
def _list_lstrip(self, L, val=0): '''Left strip the specified value''' for i in _range(len(L)): if L[i] != val: return L[i:]
python
def _list_lstrip(self, L, val=0): '''Left strip the specified value''' for i in _range(len(L)): if L[i] != val: return L[i:]
[ "def", "_list_lstrip", "(", "self", ",", "L", ",", "val", "=", "0", ")", ":", "for", "i", "in", "_range", "(", "len", "(", "L", ")", ")", ":", "if", "L", "[", "i", "]", "!=", "val", ":", "return", "L", "[", "i", ":", "]" ]
Left strip the specified value
[ "Left", "strip", "the", "specified", "value" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L495-L499
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._list_rjust
def _list_rjust(self, L, width, fillchar=0): '''Left pad with the specified value to obtain a list of the specified width (length)''' length = max(0, width - len(L)) return [fillchar]*length + L
python
def _list_rjust(self, L, width, fillchar=0): '''Left pad with the specified value to obtain a list of the specified width (length)''' length = max(0, width - len(L)) return [fillchar]*length + L
[ "def", "_list_rjust", "(", "self", ",", "L", ",", "width", ",", "fillchar", "=", "0", ")", ":", "length", "=", "max", "(", "0", ",", "width", "-", "len", "(", "L", ")", ")", "return", "[", "fillchar", "]", "*", "length", "+", "L" ]
Left pad with the specified value to obtain a list of the specified width (length)
[ "Left", "pad", "with", "the", "specified", "value", "to", "obtain", "a", "list", "of", "the", "specified", "width", "(", "length", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L501-L504
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._syndromes
def _syndromes(self, r, k=None): '''Given the received codeword r in the form of a Polynomial object, computes the syndromes and returns the syndrome polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse). ''' n = self.n ...
python
def _syndromes(self, r, k=None): '''Given the received codeword r in the form of a Polynomial object, computes the syndromes and returns the syndrome polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse). ''' n = self.n ...
[ "def", "_syndromes", "(", "self", ",", "r", ",", "k", "=", "None", ")", ":", "n", "=", "self", ".", "n", "if", "not", "k", ":", "k", "=", "self", ".", "k", "# Note the + [GF2int(0)] : we add a 0 coefficient for the lowest degree (the constant). This effectively sh...
Given the received codeword r in the form of a Polynomial object, computes the syndromes and returns the syndrome polynomial. Mathematically, it's essentially equivalent to a Fourrier Transform (Chien search being the inverse).
[ "Given", "the", "received", "codeword", "r", "in", "the", "form", "of", "a", "Polynomial", "object", "computes", "the", "syndromes", "and", "returns", "the", "syndrome", "polynomial", ".", "Mathematically", "it", "s", "essentially", "equivalent", "to", "a", "F...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L506-L515
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._find_erasures_locator
def _find_erasures_locator(self, erasures_pos): '''Compute the erasures locator polynomial from the erasures positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here the string positions ar...
python
def _find_erasures_locator(self, erasures_pos): '''Compute the erasures locator polynomial from the erasures positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here the string positions ar...
[ "def", "_find_erasures_locator", "(", "self", ",", "erasures_pos", ")", ":", "# See: http://ocw.usu.edu/Electrical_and_Computer_Engineering/Error_Control_Coding/lecture7.pdf and Blahut, Richard E. \"Transform techniques for error control codes.\" IBM Journal of Research and development 23.3 (1979): ...
Compute the erasures locator polynomial from the erasures positions (the positions must be relative to the x coefficient, eg: "hello worldxxxxxxxxx" is tampered to "h_ll_ worldxxxxxxxxx" with xxxxxxxxx being the ecc of length n-k=9, here the string positions are [1, 4], but the coefficients are reversed since the ecc c...
[ "Compute", "the", "erasures", "locator", "polynomial", "from", "the", "erasures", "positions", "(", "the", "positions", "must", "be", "relative", "to", "the", "x", "coefficient", "eg", ":", "hello", "worldxxxxxxxxx", "is", "tampered", "to", "h_ll_", "worldxxxxxx...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L538-L545
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._berlekamp_massey
def _berlekamp_massey(self, s, k=None, erasures_loc=None, erasures_eval=None, erasures_count=0): '''Computes and returns the errata (errors+erasures) locator polynomial (sigma) and the error evaluator polynomial (omega) at the same time. If the erasures locator is specified, we will return an er...
python
def _berlekamp_massey(self, s, k=None, erasures_loc=None, erasures_eval=None, erasures_count=0): '''Computes and returns the errata (errors+erasures) locator polynomial (sigma) and the error evaluator polynomial (omega) at the same time. If the erasures locator is specified, we will return an er...
[ "def", "_berlekamp_massey", "(", "self", ",", "s", ",", "k", "=", "None", ",", "erasures_loc", "=", "None", ",", "erasures_eval", "=", "None", ",", "erasures_count", "=", "0", ")", ":", "# For errors-and-erasures decoding, see: \"Algebraic Codes for Data Transmission\...
Computes and returns the errata (errors+erasures) locator polynomial (sigma) and the error evaluator polynomial (omega) at the same time. If the erasures locator is specified, we will return an errors-and-erasures locator polynomial and an errors-and-erasures evaluator polynomial, else it will compute o...
[ "Computes", "and", "returns", "the", "errata", "(", "errors", "+", "erasures", ")", "locator", "polynomial", "(", "sigma", ")", "and", "the", "error", "evaluator", "polynomial", "(", "omega", ")", "at", "the", "same", "time", ".", "If", "the", "erasures", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L547-L673
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._berlekamp_massey_fast
def _berlekamp_massey_fast(self, s, k=None, erasures_loc=None, erasures_eval=None, erasures_count=0): '''Faster implementation of errata (errors-and-erasures) Berlekamp-Massey. Returns the error locator polynomial (sigma) and the error evaluator polynomial (omega) with a faster implementation. ...
python
def _berlekamp_massey_fast(self, s, k=None, erasures_loc=None, erasures_eval=None, erasures_count=0): '''Faster implementation of errata (errors-and-erasures) Berlekamp-Massey. Returns the error locator polynomial (sigma) and the error evaluator polynomial (omega) with a faster implementation. ...
[ "def", "_berlekamp_massey_fast", "(", "self", ",", "s", ",", "k", "=", "None", ",", "erasures_loc", "=", "None", ",", "erasures_eval", "=", "None", ",", "erasures_count", "=", "0", ")", ":", "n", "=", "self", ".", "n", "if", "not", "k", ":", "k", "...
Faster implementation of errata (errors-and-erasures) Berlekamp-Massey. Returns the error locator polynomial (sigma) and the error evaluator polynomial (omega) with a faster implementation.
[ "Faster", "implementation", "of", "errata", "(", "errors", "-", "and", "-", "erasures", ")", "Berlekamp", "-", "Massey", ".", "Returns", "the", "error", "locator", "polynomial", "(", "sigma", ")", "and", "the", "error", "evaluator", "polynomial", "(", "omega...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L675-L767
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._find_error_evaluator
def _find_error_evaluator(self, synd, sigma, k=None): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey imple...
python
def _find_error_evaluator(self, synd, sigma, k=None): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey imple...
[ "def", "_find_error_evaluator", "(", "self", ",", "synd", ",", "sigma", ",", "k", "=", "None", ")", ":", "n", "=", "self", ".", "n", "if", "not", "k", ":", "k", "=", "self", ".", "k", "# Omega(x) = [ (1 + Synd(x)) * Error_loc(x) ] mod x^(n-k+1)", "# NOTE: I ...
Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey implemented above, but in case you modify Sigma, you can recompute Ome...
[ "Compute", "the", "error", "(", "or", "erasures", "if", "you", "supply", "sigma", "=", "erasures", "locator", "polynomial", ")", "evaluator", "polynomial", "Omega", "from", "the", "syndrome", "and", "the", "error", "/", "erasures", "/", "errata", "locator", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L769-L778
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._find_error_evaluator_fast
def _find_error_evaluator_fast(self, synd, sigma, k=None): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey ...
python
def _find_error_evaluator_fast(self, synd, sigma, k=None): '''Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey ...
[ "def", "_find_error_evaluator_fast", "(", "self", ",", "synd", ",", "sigma", ",", "k", "=", "None", ")", ":", "n", "=", "self", ".", "n", "if", "not", "k", ":", "k", "=", "self", ".", "k", "# Omega(x) = [ Synd(x) * Error_loc(x) ] mod x^(n-k+1) -- From Blahut, ...
Compute the error (or erasures if you supply sigma=erasures locator polynomial) evaluator polynomial Omega from the syndrome and the error/erasures/errata locator Sigma. Omega is already computed at the same time as Sigma inside the Berlekamp-Massey implemented above, but in case you modify Sigma, you can recompute Ome...
[ "Compute", "the", "error", "(", "or", "erasures", "if", "you", "supply", "sigma", "=", "erasures", "locator", "polynomial", ")", "evaluator", "polynomial", "Omega", "from", "the", "syndrome", "and", "the", "error", "/", "erasures", "/", "errata", "locator", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L780-L786
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._chien_search
def _chien_search(self, sigma): '''Recall the definition of sigma, it has s roots. To find them, this function evaluates sigma at all 2^(c_exp-1) (ie: 255 for GF(2^8)) non-zero points to find the roots The inverse of the roots are X_i, the error locations Returns a list X of error locat...
python
def _chien_search(self, sigma): '''Recall the definition of sigma, it has s roots. To find them, this function evaluates sigma at all 2^(c_exp-1) (ie: 255 for GF(2^8)) non-zero points to find the roots The inverse of the roots are X_i, the error locations Returns a list X of error locat...
[ "def", "_chien_search", "(", "self", ",", "sigma", ")", ":", "# TODO: find a more efficient algorithm, this is the slowest part of the whole decoding process (~2.5 ms, while any other part is only ~400microsec). Could try the Pruned FFT from \"Simple Algorithms for BCH Decoding\", by Jonathan Hong a...
Recall the definition of sigma, it has s roots. To find them, this function evaluates sigma at all 2^(c_exp-1) (ie: 255 for GF(2^8)) non-zero points to find the roots The inverse of the roots are X_i, the error locations Returns a list X of error locations, and a corresponding list j of ...
[ "Recall", "the", "definition", "of", "sigma", "it", "has", "s", "roots", ".", "To", "find", "them", "this", "function", "evaluates", "sigma", "at", "all", "2^", "(", "c_exp", "-", "1", ")", "(", "ie", ":", "255", "for", "GF", "(", "2^8", "))", "non...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L788-L826
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._chien_search_fast
def _chien_search_fast(self, sigma): '''Real chien search, we reuse the previous polynomial evaluation and just multiply by a constant polynomial. This should be faster, but it seems it's just the same speed as the other bruteforce version. However, it should easily be parallelizable.''' # TODO: doesn't...
python
def _chien_search_fast(self, sigma): '''Real chien search, we reuse the previous polynomial evaluation and just multiply by a constant polynomial. This should be faster, but it seems it's just the same speed as the other bruteforce version. However, it should easily be parallelizable.''' # TODO: doesn't...
[ "def", "_chien_search_fast", "(", "self", ",", "sigma", ")", ":", "# TODO: doesn't work when fcr is different than 1 (X values are incorrectly \"shifted\"...)", "# TODO: try to mix this approach with the optimized walk on only interesting values, implemented in _chien_search_faster()", "X", "=...
Real chien search, we reuse the previous polynomial evaluation and just multiply by a constant polynomial. This should be faster, but it seems it's just the same speed as the other bruteforce version. However, it should easily be parallelizable.
[ "Real", "chien", "search", "we", "reuse", "the", "previous", "polynomial", "evaluation", "and", "just", "multiply", "by", "a", "constant", "polynomial", ".", "This", "should", "be", "faster", "but", "it", "seems", "it", "s", "just", "the", "same", "speed", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L828-L860
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._chien_search_faster
def _chien_search_faster(self, sigma): '''Faster chien search, processing only useful coefficients (the ones in the messages) instead of the whole 2^8 range. Besides the speed boost, this also allows to fix a number of issue: correctly decoding when the last ecc byte is corrupted, and accepting messages...
python
def _chien_search_faster(self, sigma): '''Faster chien search, processing only useful coefficients (the ones in the messages) instead of the whole 2^8 range. Besides the speed boost, this also allows to fix a number of issue: correctly decoding when the last ecc byte is corrupted, and accepting messages...
[ "def", "_chien_search_faster", "(", "self", ",", "sigma", ")", ":", "n", "=", "self", ".", "n", "X", "=", "[", "]", "j", "=", "[", "]", "p", "=", "GF2int", "(", "self", ".", "generator", ")", "# Normally we should try all 2^8 possible values, but here we opt...
Faster chien search, processing only useful coefficients (the ones in the messages) instead of the whole 2^8 range. Besides the speed boost, this also allows to fix a number of issue: correctly decoding when the last ecc byte is corrupted, and accepting messages of length n > 2^8.
[ "Faster", "chien", "search", "processing", "only", "useful", "coefficients", "(", "the", "ones", "in", "the", "messages", ")", "instead", "of", "the", "whole", "2^8", "range", ".", "Besides", "the", "speed", "boost", "this", "also", "allows", "to", "fix", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L862-L888
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._old_forney
def _old_forney(self, omega, X, k=None): '''Computes the error magnitudes (only works with errors or erasures under t = floor((n-k)/2), not with erasures above (n-k)//2)''' # XXX Is floor division okay here? Should this be ceiling? if not k: k = self.k t = (self.n - k) // 2 Y = ...
python
def _old_forney(self, omega, X, k=None): '''Computes the error magnitudes (only works with errors or erasures under t = floor((n-k)/2), not with erasures above (n-k)//2)''' # XXX Is floor division okay here? Should this be ceiling? if not k: k = self.k t = (self.n - k) // 2 Y = ...
[ "def", "_old_forney", "(", "self", ",", "omega", ",", "X", ",", "k", "=", "None", ")", ":", "# XXX Is floor division okay here? Should this be ceiling?", "if", "not", "k", ":", "k", "=", "self", ".", "k", "t", "=", "(", "self", ".", "n", "-", "k", ")",...
Computes the error magnitudes (only works with errors or erasures under t = floor((n-k)/2), not with erasures above (n-k)//2)
[ "Computes", "the", "error", "magnitudes", "(", "only", "works", "with", "errors", "or", "erasures", "under", "t", "=", "floor", "((", "n", "-", "k", ")", "/", "2", ")", "not", "with", "erasures", "above", "(", "n", "-", "k", ")", "//", "2", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L890-L918
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/rs.py
RSCoder._forney
def _forney(self, omega, X): '''Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.''' # XXX Is floor division okay here? Should this be ceiling? Y = [...
python
def _forney(self, omega, X): '''Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.''' # XXX Is floor division okay here? Should this be ceiling? Y = [...
[ "def", "_forney", "(", "self", ",", "omega", ",", "X", ")", ":", "# XXX Is floor division okay here? Should this be ceiling?", "Y", "=", "[", "]", "# the final result, the error/erasures polynomial (contain the values that we should minus on the received message to get the repaired mes...
Computes the error magnitudes. Works also with erasures and errors+erasures beyond the (n-k)//2 bound, here the bound is 2*e+v <= (n-k-1) with e the number of errors and v the number of erasures.
[ "Computes", "the", "error", "magnitudes", ".", "Works", "also", "with", "erasures", "and", "errors", "+", "erasures", "beyond", "the", "(", "n", "-", "k", ")", "//", "2", "bound", "here", "the", "bound", "is", "2", "*", "e", "+", "v", "<", "=", "("...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/rs.py#L920-L946
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/process.py
_ProcessMemoryInfoPS.update
def update(self): """ Get virtual and resident size of current process via 'ps'. This should work for MacOS X, Solaris, Linux. Returns true if it was successful. """ try: p = Popen(['/bin/ps', '-p%s' % self.pid, '-o', 'rss,vsz'], stdout=P...
python
def update(self): """ Get virtual and resident size of current process via 'ps'. This should work for MacOS X, Solaris, Linux. Returns true if it was successful. """ try: p = Popen(['/bin/ps', '-p%s' % self.pid, '-o', 'rss,vsz'], stdout=P...
[ "def", "update", "(", "self", ")", ":", "try", ":", "p", "=", "Popen", "(", "[", "'/bin/ps'", ",", "'-p%s'", "%", "self", ".", "pid", ",", "'-o'", ",", "'rss,vsz'", "]", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "except", "OSEr...
Get virtual and resident size of current process via 'ps'. This should work for MacOS X, Solaris, Linux. Returns true if it was successful.
[ "Get", "virtual", "and", "resident", "size", "of", "current", "process", "via", "ps", ".", "This", "should", "work", "for", "MacOS", "X", "Solaris", "Linux", ".", "Returns", "true", "if", "it", "was", "successful", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/process.py#L83-L100
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/process.py
_ProcessMemoryInfoProc.update
def update(self): """ Get virtual size of current process by reading the process' stat file. This should work for Linux. """ try: stat = open('/proc/self/stat') status = open('/proc/self/status') except IOError: # pragma: no cover retur...
python
def update(self): """ Get virtual size of current process by reading the process' stat file. This should work for Linux. """ try: stat = open('/proc/self/stat') status = open('/proc/self/status') except IOError: # pragma: no cover retur...
[ "def", "update", "(", "self", ")", ":", "try", ":", "stat", "=", "open", "(", "'/proc/self/stat'", ")", "status", "=", "open", "(", "'/proc/self/status'", ")", "except", "IOError", ":", "# pragma: no cover", "return", "False", "else", ":", "stats", "=", "s...
Get virtual size of current process by reading the process' stat file. This should work for Linux.
[ "Get", "virtual", "size", "of", "current", "process", "by", "reading", "the", "process", "stat", "file", ".", "This", "should", "work", "for", "Linux", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/process.py#L118-L152
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.CreateControls
def CreateControls(self): """Create our sub-controls""" wx.EVT_LIST_COL_CLICK(self, self.GetId(), self.OnReorder) wx.EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnNodeSelected) wx.EVT_MOTION(self, self.OnMouseMove) wx.EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnNodeAct...
python
def CreateControls(self): """Create our sub-controls""" wx.EVT_LIST_COL_CLICK(self, self.GetId(), self.OnReorder) wx.EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnNodeSelected) wx.EVT_MOTION(self, self.OnMouseMove) wx.EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnNodeAct...
[ "def", "CreateControls", "(", "self", ")", ":", "wx", ".", "EVT_LIST_COL_CLICK", "(", "self", ",", "self", ".", "GetId", "(", ")", ",", "self", ".", "OnReorder", ")", "wx", ".", "EVT_LIST_ITEM_SELECTED", "(", "self", ",", "self", ".", "GetId", "(", ")"...
Create our sub-controls
[ "Create", "our", "sub", "-", "controls" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L90-L96
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.CreateColumns
def CreateColumns( self ): """Create/recreate our column definitions from current self.columns""" self.SetItemCount(0) # clear any current columns... for i in range( self.GetColumnCount())[::-1]: self.DeleteColumn( i ) # now create for i, column in enumerate(s...
python
def CreateColumns( self ): """Create/recreate our column definitions from current self.columns""" self.SetItemCount(0) # clear any current columns... for i in range( self.GetColumnCount())[::-1]: self.DeleteColumn( i ) # now create for i, column in enumerate(s...
[ "def", "CreateColumns", "(", "self", ")", ":", "self", ".", "SetItemCount", "(", "0", ")", "# clear any current columns...", "for", "i", "in", "range", "(", "self", ".", "GetColumnCount", "(", ")", ")", "[", ":", ":", "-", "1", "]", ":", "self", ".", ...
Create/recreate our column definitions from current self.columns
[ "Create", "/", "recreate", "our", "column", "definitions", "from", "current", "self", ".", "columns" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L97-L110
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.SetColumns
def SetColumns( self, columns, sortOrder=None ): """Set columns to a set of values other than the originals and recreates column controls""" self.columns = columns self.sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault] self.CreateColumns()
python
def SetColumns( self, columns, sortOrder=None ): """Set columns to a set of values other than the originals and recreates column controls""" self.columns = columns self.sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault] self.CreateColumns()
[ "def", "SetColumns", "(", "self", ",", "columns", ",", "sortOrder", "=", "None", ")", ":", "self", ".", "columns", "=", "columns", "self", ".", "sortOrder", "=", "[", "(", "x", ".", "defaultOrder", ",", "x", ")", "for", "x", "in", "self", ".", "col...
Set columns to a set of values other than the originals and recreates column controls
[ "Set", "columns", "to", "a", "set", "of", "values", "other", "than", "the", "originals", "and", "recreates", "column", "controls" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L111-L115
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.OnNodeActivated
def OnNodeActivated(self, event): """We have double-clicked for hit enter on a node refocus squaremap to this node""" try: node = self.sorted[event.GetIndex()] except IndexError, err: log.warn(_('Invalid index in node activated: %(index)s'), index=eve...
python
def OnNodeActivated(self, event): """We have double-clicked for hit enter on a node refocus squaremap to this node""" try: node = self.sorted[event.GetIndex()] except IndexError, err: log.warn(_('Invalid index in node activated: %(index)s'), index=eve...
[ "def", "OnNodeActivated", "(", "self", ",", "event", ")", ":", "try", ":", "node", "=", "self", ".", "sorted", "[", "event", ".", "GetIndex", "(", ")", "]", "except", "IndexError", ",", "err", ":", "log", ".", "warn", "(", "_", "(", "'Invalid index i...
We have double-clicked for hit enter on a node refocus squaremap to this node
[ "We", "have", "double", "-", "clicked", "for", "hit", "enter", "on", "a", "node", "refocus", "squaremap", "to", "this", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L117-L129
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.OnNodeSelected
def OnNodeSelected(self, event): """We have selected a node with the list control, tell the world""" try: node = self.sorted[event.GetIndex()] except IndexError, err: log.warn(_('Invalid index in node selected: %(index)s'), index=event.GetIndex()) ...
python
def OnNodeSelected(self, event): """We have selected a node with the list control, tell the world""" try: node = self.sorted[event.GetIndex()] except IndexError, err: log.warn(_('Invalid index in node selected: %(index)s'), index=event.GetIndex()) ...
[ "def", "OnNodeSelected", "(", "self", ",", "event", ")", ":", "try", ":", "node", "=", "self", ".", "sorted", "[", "event", ".", "GetIndex", "(", ")", "]", "except", "IndexError", ",", "err", ":", "log", ".", "warn", "(", "_", "(", "'Invalid index in...
We have selected a node with the list control, tell the world
[ "We", "have", "selected", "a", "node", "with", "the", "list", "control", "tell", "the", "world" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L131-L144
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.SetIndicated
def SetIndicated(self, node): """Set this node to indicated status""" self.indicated_node = node self.indicated = self.NodeToIndex(node) self.Refresh(False) return self.indicated
python
def SetIndicated(self, node): """Set this node to indicated status""" self.indicated_node = node self.indicated = self.NodeToIndex(node) self.Refresh(False) return self.indicated
[ "def", "SetIndicated", "(", "self", ",", "node", ")", ":", "self", ".", "indicated_node", "=", "node", "self", ".", "indicated", "=", "self", ".", "NodeToIndex", "(", "node", ")", "self", ".", "Refresh", "(", "False", ")", "return", "self", ".", "indic...
Set this node to indicated status
[ "Set", "this", "node", "to", "indicated", "status" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L162-L167
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.SetSelected
def SetSelected(self, node): """Set our selected node""" self.selected_node = node index = self.NodeToIndex(node) if index != -1: self.Focus(index) self.Select(index, True) return index
python
def SetSelected(self, node): """Set our selected node""" self.selected_node = node index = self.NodeToIndex(node) if index != -1: self.Focus(index) self.Select(index, True) return index
[ "def", "SetSelected", "(", "self", ",", "node", ")", ":", "self", ".", "selected_node", "=", "node", "index", "=", "self", ".", "NodeToIndex", "(", "node", ")", "if", "index", "!=", "-", "1", ":", "self", ".", "Focus", "(", "index", ")", "self", "....
Set our selected node
[ "Set", "our", "selected", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L169-L176
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.OnReorder
def OnReorder(self, event): """Given a request to reorder, tell us to reorder""" column = self.columns[event.GetColumn()] return self.ReorderByColumn( column )
python
def OnReorder(self, event): """Given a request to reorder, tell us to reorder""" column = self.columns[event.GetColumn()] return self.ReorderByColumn( column )
[ "def", "OnReorder", "(", "self", ",", "event", ")", ":", "column", "=", "self", ".", "columns", "[", "event", ".", "GetColumn", "(", ")", "]", "return", "self", ".", "ReorderByColumn", "(", "column", ")" ]
Given a request to reorder, tell us to reorder
[ "Given", "a", "request", "to", "reorder", "tell", "us", "to", "reorder" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L190-L193
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.ReorderByColumn
def ReorderByColumn( self, column ): """Reorder the set of records by column""" # TODO: store current selection and re-select after sorting... single_column = self.SetNewOrder( column ) self.reorder( single_column = True ) self.Refresh()
python
def ReorderByColumn( self, column ): """Reorder the set of records by column""" # TODO: store current selection and re-select after sorting... single_column = self.SetNewOrder( column ) self.reorder( single_column = True ) self.Refresh()
[ "def", "ReorderByColumn", "(", "self", ",", "column", ")", ":", "# TODO: store current selection and re-select after sorting...", "single_column", "=", "self", ".", "SetNewOrder", "(", "column", ")", "self", ".", "reorder", "(", "single_column", "=", "True", ")", "s...
Reorder the set of records by column
[ "Reorder", "the", "set", "of", "records", "by", "column" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L195-L200
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.SetNewOrder
def SetNewOrder( self, column ): """Set new sorting order based on column, return whether a simple single-column (True) or multiple (False)""" if column.sortOn: # multiple sorts for the click... columns = [self.columnByAttribute(attr) for attr in column.sortOn] diff =...
python
def SetNewOrder( self, column ): """Set new sorting order based on column, return whether a simple single-column (True) or multiple (False)""" if column.sortOn: # multiple sorts for the click... columns = [self.columnByAttribute(attr) for attr in column.sortOn] diff =...
[ "def", "SetNewOrder", "(", "self", ",", "column", ")", ":", "if", "column", ".", "sortOn", ":", "# multiple sorts for the click...", "columns", "=", "[", "self", ".", "columnByAttribute", "(", "attr", ")", "for", "attr", "in", "column", ".", "sortOn", "]", ...
Set new sorting order based on column, return whether a simple single-column (True) or multiple (False)
[ "Set", "new", "sorting", "order", "based", "on", "column", "return", "whether", "a", "simple", "single", "-", "column", "(", "True", ")", "or", "multiple", "(", "False", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L202-L225
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.reorder
def reorder(self, single_column=False): """Force a reorder of the displayed items""" if single_column: columns = self.sortOrder[:1] else: columns = self.sortOrder for ascending,column in columns[::-1]: # Python 2.2+ guarantees stable sort, so sort by e...
python
def reorder(self, single_column=False): """Force a reorder of the displayed items""" if single_column: columns = self.sortOrder[:1] else: columns = self.sortOrder for ascending,column in columns[::-1]: # Python 2.2+ guarantees stable sort, so sort by e...
[ "def", "reorder", "(", "self", ",", "single_column", "=", "False", ")", ":", "if", "single_column", ":", "columns", "=", "self", ".", "sortOrder", "[", ":", "1", "]", "else", ":", "columns", "=", "self", ".", "sortOrder", "for", "ascending", ",", "colu...
Force a reorder of the displayed items
[ "Force", "a", "reorder", "of", "the", "displayed", "items" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L227-L236
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.integrateRecords
def integrateRecords(self, functions): """Integrate records from the loader""" self.SetItemCount(len(functions)) self.sorted = functions[:] self.reorder() self.Refresh()
python
def integrateRecords(self, functions): """Integrate records from the loader""" self.SetItemCount(len(functions)) self.sorted = functions[:] self.reorder() self.Refresh()
[ "def", "integrateRecords", "(", "self", ",", "functions", ")", ":", "self", ".", "SetItemCount", "(", "len", "(", "functions", ")", ")", "self", ".", "sorted", "=", "functions", "[", ":", "]", "self", ".", "reorder", "(", ")", "self", ".", "Refresh", ...
Integrate records from the loader
[ "Integrate", "records", "from", "the", "loader" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L238-L243
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.OnGetItemAttr
def OnGetItemAttr(self, item): """Retrieve ListItemAttr for the given item (index)""" if self.indicated > -1 and item == self.indicated: return self.indicated_attribute return None
python
def OnGetItemAttr(self, item): """Retrieve ListItemAttr for the given item (index)""" if self.indicated > -1 and item == self.indicated: return self.indicated_attribute return None
[ "def", "OnGetItemAttr", "(", "self", ",", "item", ")", ":", "if", "self", ".", "indicated", ">", "-", "1", "and", "item", "==", "self", ".", "indicated", ":", "return", "self", ".", "indicated_attribute", "return", "None" ]
Retrieve ListItemAttr for the given item (index)
[ "Retrieve", "ListItemAttr", "for", "the", "given", "item", "(", "index", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L248-L252
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py
DataView.OnGetItemText
def OnGetItemText(self, item, col): """Retrieve text for the item and column respectively""" # TODO: need to format for rjust and the like... try: column = self.columns[col] value = column.get(self.sorted[item]) except IndexError, err: return None ...
python
def OnGetItemText(self, item, col): """Retrieve text for the item and column respectively""" # TODO: need to format for rjust and the like... try: column = self.columns[col] value = column.get(self.sorted[item]) except IndexError, err: return None ...
[ "def", "OnGetItemText", "(", "self", ",", "item", ",", "col", ")", ":", "# TODO: need to format for rjust and the like...", "try", ":", "column", "=", "self", ".", "columns", "[", "col", "]", "value", "=", "column", ".", "get", "(", "self", ".", "sorted", ...
Retrieve text for the item and column respectively
[ "Retrieve", "text", "for", "the", "item", "and", "column", "respectively" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/listviews.py#L254-L281
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/imageencode.py
encode
def encode(input, output_filename): """Encodes the input data with reed-solomon error correction in 223 byte blocks, and outputs each block along with 32 parity bytes to a new file by the given filename. input is a file-like object The outputted image will be in png format, and will be 255 by x pi...
python
def encode(input, output_filename): """Encodes the input data with reed-solomon error correction in 223 byte blocks, and outputs each block along with 32 parity bytes to a new file by the given filename. input is a file-like object The outputted image will be in png format, and will be 255 by x pi...
[ "def", "encode", "(", "input", ",", "output_filename", ")", ":", "coder", "=", "rs", ".", "RSCoder", "(", "255", ",", "223", ")", "output", "=", "[", "]", "while", "True", ":", "block", "=", "input", ".", "read", "(", "223", ")", "if", "not", "bl...
Encodes the input data with reed-solomon error correction in 223 byte blocks, and outputs each block along with 32 parity bytes to a new file by the given filename. input is a file-like object The outputted image will be in png format, and will be 255 by x pixels with one color channel. X is the n...
[ "Encodes", "the", "input", "data", "with", "reed", "-", "solomon", "error", "correction", "in", "223", "byte", "blocks", "and", "outputs", "each", "block", "along", "with", "32", "parity", "bytes", "to", "a", "new", "file", "by", "the", "given", "filename"...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/imageencode.py#L8-L35
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
redirect
def redirect(url, code=303): """ Aborts execution and causes a 303 redirect """ scriptname = request.environ.get('SCRIPT_NAME', '').rstrip('/') + '/' location = urljoin(request.url, urljoin(scriptname, url)) raise HTTPResponse("", status=code, header=dict(Location=location))
python
def redirect(url, code=303): """ Aborts execution and causes a 303 redirect """ scriptname = request.environ.get('SCRIPT_NAME', '').rstrip('/') + '/' location = urljoin(request.url, urljoin(scriptname, url)) raise HTTPResponse("", status=code, header=dict(Location=location))
[ "def", "redirect", "(", "url", ",", "code", "=", "303", ")", ":", "scriptname", "=", "request", ".", "environ", ".", "get", "(", "'SCRIPT_NAME'", ",", "''", ")", ".", "rstrip", "(", "'/'", ")", "+", "'/'", "location", "=", "urljoin", "(", "request", ...
Aborts execution and causes a 303 redirect
[ "Aborts", "execution", "and", "causes", "a", "303", "redirect" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L916-L920
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
parse_date
def parse_date(ims): """ Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. """ try: ts = email.utils.parsedate_tz(ims) return time.mktime(ts[:8] + (0,)) - (ts[9] or 0) - time.timezone except (TypeError, ValueError, IndexError): return None
python
def parse_date(ims): """ Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. """ try: ts = email.utils.parsedate_tz(ims) return time.mktime(ts[:8] + (0,)) - (ts[9] or 0) - time.timezone except (TypeError, ValueError, IndexError): return None
[ "def", "parse_date", "(", "ims", ")", ":", "try", ":", "ts", "=", "email", ".", "utils", ".", "parsedate_tz", "(", "ims", ")", "return", "time", ".", "mktime", "(", "ts", "[", ":", "8", "]", "+", "(", "0", ",", ")", ")", "-", "(", "ts", "[", ...
Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch.
[ "Parse", "rfc1123", "rfc850", "and", "asctime", "timestamps", "and", "return", "UTC", "epoch", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L986-L992
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
run
def run(app=None, server=WSGIRefServer, host='127.0.0.1', port=8080, interval=1, reloader=False, **kargs): """ Runs bottle as a web server. """ app = app if app else default_app() quiet = bool(kargs.get('quiet', False)) # Instantiate server, if it is a class instead of an instance if isinsta...
python
def run(app=None, server=WSGIRefServer, host='127.0.0.1', port=8080, interval=1, reloader=False, **kargs): """ Runs bottle as a web server. """ app = app if app else default_app() quiet = bool(kargs.get('quiet', False)) # Instantiate server, if it is a class instead of an instance if isinsta...
[ "def", "run", "(", "app", "=", "None", ",", "server", "=", "WSGIRefServer", ",", "host", "=", "'127.0.0.1'", ",", "port", "=", "8080", ",", "interval", "=", "1", ",", "reloader", "=", "False", ",", "*", "*", "kargs", ")", ":", "app", "=", "app", ...
Runs bottle as a web server.
[ "Runs", "bottle", "as", "a", "web", "server", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L1239-L1264
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
template
def template(tpl, template_adapter=SimpleTemplate, **kwargs): ''' Get a rendered template as a string iterator. You can use a name, a filename or a template string as first parameter. ''' if tpl not in TEMPLATES or DEBUG: settings = kwargs.get('template_settings',{}) lookup = kwargs....
python
def template(tpl, template_adapter=SimpleTemplate, **kwargs): ''' Get a rendered template as a string iterator. You can use a name, a filename or a template string as first parameter. ''' if tpl not in TEMPLATES or DEBUG: settings = kwargs.get('template_settings',{}) lookup = kwargs....
[ "def", "template", "(", "tpl", ",", "template_adapter", "=", "SimpleTemplate", ",", "*", "*", "kwargs", ")", ":", "if", "tpl", "not", "in", "TEMPLATES", "or", "DEBUG", ":", "settings", "=", "kwargs", ".", "get", "(", "'template_settings'", ",", "{", "}",...
Get a rendered template as a string iterator. You can use a name, a filename or a template string as first parameter.
[ "Get", "a", "rendered", "template", "as", "a", "string", "iterator", ".", "You", "can", "use", "a", "name", "a", "filename", "or", "a", "template", "string", "as", "first", "parameter", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L1566-L1586
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Route.tokens
def tokens(self): """ Return a list of (type, value) tokens. """ if not self._tokens: self._tokens = list(self.tokenise(self.route)) return self._tokens
python
def tokens(self): """ Return a list of (type, value) tokens. """ if not self._tokens: self._tokens = list(self.tokenise(self.route)) return self._tokens
[ "def", "tokens", "(", "self", ")", ":", "if", "not", "self", ".", "_tokens", ":", "self", ".", "_tokens", "=", "list", "(", "self", ".", "tokenise", "(", "self", ".", "route", ")", ")", "return", "self", ".", "_tokens" ]
Return a list of (type, value) tokens.
[ "Return", "a", "list", "of", "(", "type", "value", ")", "tokens", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L204-L208
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Route.tokenise
def tokenise(cls, route): ''' Split a string into an iterator of (type, value) tokens. ''' match = None for match in cls.syntax.finditer(route): pre, name, rex = match.groups() if pre: yield ('TXT', pre.replace('\\:',':')) if rex and name: yield ('VAR', (rex, ...
python
def tokenise(cls, route): ''' Split a string into an iterator of (type, value) tokens. ''' match = None for match in cls.syntax.finditer(route): pre, name, rex = match.groups() if pre: yield ('TXT', pre.replace('\\:',':')) if rex and name: yield ('VAR', (rex, ...
[ "def", "tokenise", "(", "cls", ",", "route", ")", ":", "match", "=", "None", "for", "match", "in", "cls", ".", "syntax", ".", "finditer", "(", "route", ")", ":", "pre", ",", "name", ",", "rex", "=", "match", ".", "groups", "(", ")", "if", "pre", ...
Split a string into an iterator of (type, value) tokens.
[ "Split", "a", "string", "into", "an", "iterator", "of", "(", "type", "value", ")", "tokens", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L211-L223
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Route.group_re
def group_re(self): ''' Return a regexp pattern with named groups ''' out = '' for token, data in self.tokens(): if token == 'TXT': out += re.escape(data) elif token == 'VAR': out += '(?P<%s>%s)' % (data[1], data[0]) elif token == 'ANON': out += '(?:%s)' %...
python
def group_re(self): ''' Return a regexp pattern with named groups ''' out = '' for token, data in self.tokens(): if token == 'TXT': out += re.escape(data) elif token == 'VAR': out += '(?P<%s>%s)' % (data[1], data[0]) elif token == 'ANON': out += '(?:%s)' %...
[ "def", "group_re", "(", "self", ")", ":", "out", "=", "''", "for", "token", ",", "data", "in", "self", ".", "tokens", "(", ")", ":", "if", "token", "==", "'TXT'", ":", "out", "+=", "re", ".", "escape", "(", "data", ")", "elif", "token", "==", "...
Return a regexp pattern with named groups
[ "Return", "a", "regexp", "pattern", "with", "named", "groups" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L225-L232
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Route.format_str
def format_str(self): ''' Return a format string with named fields. ''' if self.static: return self.route.replace('%','%%') out, i = '', 0 for token, value in self.tokens(): if token == 'TXT': out += value.replace('%','%%') elif token == 'ANON': out +=...
python
def format_str(self): ''' Return a format string with named fields. ''' if self.static: return self.route.replace('%','%%') out, i = '', 0 for token, value in self.tokens(): if token == 'TXT': out += value.replace('%','%%') elif token == 'ANON': out +=...
[ "def", "format_str", "(", "self", ")", ":", "if", "self", ".", "static", ":", "return", "self", ".", "route", ".", "replace", "(", "'%'", ",", "'%%'", ")", "out", ",", "i", "=", "''", ",", "0", "for", "token", ",", "value", "in", "self", ".", "...
Return a format string with named fields.
[ "Return", "a", "format", "string", "with", "named", "fields", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L238-L247
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Route.is_dynamic
def is_dynamic(self): ''' Return true if the route contains dynamic parts ''' if not self._static: for token, value in self.tokens(): if token != 'TXT': return True self._static = True return False
python
def is_dynamic(self): ''' Return true if the route contains dynamic parts ''' if not self._static: for token, value in self.tokens(): if token != 'TXT': return True self._static = True return False
[ "def", "is_dynamic", "(", "self", ")", ":", "if", "not", "self", ".", "_static", ":", "for", "token", ",", "value", "in", "self", ".", "tokens", "(", ")", ":", "if", "token", "!=", "'TXT'", ":", "return", "True", "self", ".", "_static", "=", "True"...
Return true if the route contains dynamic parts
[ "Return", "true", "if", "the", "route", "contains", "dynamic", "parts" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L253-L260
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Router.match
def match(self, uri): ''' Matches an URL and returns a (handler, target) tuple ''' if uri in self.static: return self.static[uri], {} for combined, subroutes in self.dynamic: match = combined.match(uri) if not match: continue target, groups = subro...
python
def match(self, uri): ''' Matches an URL and returns a (handler, target) tuple ''' if uri in self.static: return self.static[uri], {} for combined, subroutes in self.dynamic: match = combined.match(uri) if not match: continue target, groups = subro...
[ "def", "match", "(", "self", ",", "uri", ")", ":", "if", "uri", "in", "self", ".", "static", ":", "return", "self", ".", "static", "[", "uri", "]", ",", "{", "}", "for", "combined", ",", "subroutes", "in", "self", ".", "dynamic", ":", "match", "=...
Matches an URL and returns a (handler, target) tuple
[ "Matches", "an", "URL", "and", "returns", "a", "(", "handler", "target", ")", "tuple" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L308-L318
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Router.build
def build(self, route_name, **args): ''' Builds an URL out of a named route and some parameters.''' try: return self.named[route_name] % args except KeyError: raise RouteBuildError("No route found with name '%s'." % route_name)
python
def build(self, route_name, **args): ''' Builds an URL out of a named route and some parameters.''' try: return self.named[route_name] % args except KeyError: raise RouteBuildError("No route found with name '%s'." % route_name)
[ "def", "build", "(", "self", ",", "route_name", ",", "*", "*", "args", ")", ":", "try", ":", "return", "self", ".", "named", "[", "route_name", "]", "%", "args", "except", "KeyError", ":", "raise", "RouteBuildError", "(", "\"No route found with name '%s'.\""...
Builds an URL out of a named route and some parameters.
[ "Builds", "an", "URL", "out", "of", "a", "named", "route", "and", "some", "parameters", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L320-L325
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Bottle.add_filter
def add_filter(self, ftype, func): ''' Register a new output filter. Whenever bottle hits a handler output matching `ftype`, `func` is applyed to it. ''' if not isinstance(ftype, type): raise TypeError("Expected type object, got %s" % type(ftype)) self.castfilter = [(t, f...
python
def add_filter(self, ftype, func): ''' Register a new output filter. Whenever bottle hits a handler output matching `ftype`, `func` is applyed to it. ''' if not isinstance(ftype, type): raise TypeError("Expected type object, got %s" % type(ftype)) self.castfilter = [(t, f...
[ "def", "add_filter", "(", "self", ",", "ftype", ",", "func", ")", ":", "if", "not", "isinstance", "(", "ftype", ",", "type", ")", ":", "raise", "TypeError", "(", "\"Expected type object, got %s\"", "%", "type", "(", "ftype", ")", ")", "self", ".", "castf...
Register a new output filter. Whenever bottle hits a handler output matching `ftype`, `func` is applyed to it.
[ "Register", "a", "new", "output", "filter", ".", "Whenever", "bottle", "hits", "a", "handler", "output", "matching", "ftype", "func", "is", "applyed", "to", "it", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L371-L378
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Bottle.match_url
def match_url(self, path, method='GET'): """ Find a callback bound to a path and a specific HTTP method. Return (callback, param) tuple or (None, {}). method: HEAD falls back to GET. HEAD and GET fall back to ALL. """ path = path.strip().lstrip('/') handler, param...
python
def match_url(self, path, method='GET'): """ Find a callback bound to a path and a specific HTTP method. Return (callback, param) tuple or (None, {}). method: HEAD falls back to GET. HEAD and GET fall back to ALL. """ path = path.strip().lstrip('/') handler, param...
[ "def", "match_url", "(", "self", ",", "path", ",", "method", "=", "'GET'", ")", ":", "path", "=", "path", ".", "strip", "(", ")", ".", "lstrip", "(", "'/'", ")", "handler", ",", "param", "=", "self", ".", "routes", ".", "match", "(", "method", "+...
Find a callback bound to a path and a specific HTTP method. Return (callback, param) tuple or (None, {}). method: HEAD falls back to GET. HEAD and GET fall back to ALL.
[ "Find", "a", "callback", "bound", "to", "a", "path", "and", "a", "specific", "HTTP", "method", ".", "Return", "(", "callback", "param", ")", "tuple", "or", "(", "None", "{}", ")", ".", "method", ":", "HEAD", "falls", "back", "to", "GET", ".", "HEAD",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L380-L393
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Bottle.get_url
def get_url(self, routename, **kargs): """ Return a string that matches a named route """ return '/' + self.routes.build(routename, **kargs).split(';', 1)[1]
python
def get_url(self, routename, **kargs): """ Return a string that matches a named route """ return '/' + self.routes.build(routename, **kargs).split(';', 1)[1]
[ "def", "get_url", "(", "self", ",", "routename", ",", "*", "*", "kargs", ")", ":", "return", "'/'", "+", "self", ".", "routes", ".", "build", "(", "routename", ",", "*", "*", "kargs", ")", ".", "split", "(", "';'", ",", "1", ")", "[", "1", "]" ...
Return a string that matches a named route
[ "Return", "a", "string", "that", "matches", "a", "named", "route" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L395-L397
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Bottle.route
def route(self, path=None, method='GET', **kargs): """ Decorator: Bind a function to a GET request path. If the path parameter is None, the signature of the decorated function is used to generate the path. See yieldroutes() for details. The method parameter (def...
python
def route(self, path=None, method='GET', **kargs): """ Decorator: Bind a function to a GET request path. If the path parameter is None, the signature of the decorated function is used to generate the path. See yieldroutes() for details. The method parameter (def...
[ "def", "route", "(", "self", ",", "path", "=", "None", ",", "method", "=", "'GET'", ",", "*", "*", "kargs", ")", ":", "if", "isinstance", "(", "method", ",", "str", ")", ":", "#TODO: Test this", "method", "=", "method", ".", "split", "(", "';'", ")...
Decorator: Bind a function to a GET request path. If the path parameter is None, the signature of the decorated function is used to generate the path. See yieldroutes() for details. The method parameter (default: GET) specifies the HTTP request method to lis...
[ "Decorator", ":", "Bind", "a", "function", "to", "a", "GET", "request", "path", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L399-L420
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.bind
def bind(self, environ, app=None): """ Bind a new WSGI enviroment and clear out all previously computed attributes. This is done automatically for the global `bottle.request` instance on every request. """ if isinstance(environ, Request): # Recycl...
python
def bind(self, environ, app=None): """ Bind a new WSGI enviroment and clear out all previously computed attributes. This is done automatically for the global `bottle.request` instance on every request. """ if isinstance(environ, Request): # Recycl...
[ "def", "bind", "(", "self", ",", "environ", ",", "app", "=", "None", ")", ":", "if", "isinstance", "(", "environ", ",", "Request", ")", ":", "# Recycle already parsed content", "for", "key", "in", "self", ".", "__dict__", ":", "#TODO: Test this", "setattr", ...
Bind a new WSGI enviroment and clear out all previously computed attributes. This is done automatically for the global `bottle.request` instance on every request.
[ "Bind", "a", "new", "WSGI", "enviroment", "and", "clear", "out", "all", "previously", "computed", "attributes", ".", "This", "is", "done", "automatically", "for", "the", "global", "bottle", ".", "request", "instance", "on", "every", "request", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L553-L571
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.path_shift
def path_shift(self, count=1): ''' Shift some levels of PATH_INFO into SCRIPT_NAME and return the moved part. count defaults to 1''' #/a/b/ /c/d --> 'a','b' 'c','d' if count == 0: return '' pathlist = self.path.strip('/').split('/') scriptlist = self.environ.get('S...
python
def path_shift(self, count=1): ''' Shift some levels of PATH_INFO into SCRIPT_NAME and return the moved part. count defaults to 1''' #/a/b/ /c/d --> 'a','b' 'c','d' if count == 0: return '' pathlist = self.path.strip('/').split('/') scriptlist = self.environ.get('S...
[ "def", "path_shift", "(", "self", ",", "count", "=", "1", ")", ":", "#/a/b/ /c/d --> 'a','b' 'c','d'", "if", "count", "==", "0", ":", "return", "''", "pathlist", "=", "self", ".", "path", ".", "strip", "(", "'/'", ")", ".", "split", "(", "'/'", ")",...
Shift some levels of PATH_INFO into SCRIPT_NAME and return the moved part. count defaults to 1
[ "Shift", "some", "levels", "of", "PATH_INFO", "into", "SCRIPT_NAME", "and", "return", "the", "moved", "part", ".", "count", "defaults", "to", "1" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L577-L600
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.url
def url(self): """ Full URL as requested by the client (computed). This value is constructed out of different environment variables and includes scheme, host, port, scriptname, path and query string. """ scheme = self.environ.get('wsgi.url_scheme', 'http') host ...
python
def url(self): """ Full URL as requested by the client (computed). This value is constructed out of different environment variables and includes scheme, host, port, scriptname, path and query string. """ scheme = self.environ.get('wsgi.url_scheme', 'http') host ...
[ "def", "url", "(", "self", ")", ":", "scheme", "=", "self", ".", "environ", ".", "get", "(", "'wsgi.url_scheme'", ",", "'http'", ")", "host", "=", "self", ".", "environ", ".", "get", "(", "'HTTP_X_FORWARDED_HOST'", ",", "self", ".", "environ", ".", "ge...
Full URL as requested by the client (computed). This value is constructed out of different environment variables and includes scheme, host, port, scriptname, path and query string.
[ "Full", "URL", "as", "requested", "by", "the", "client", "(", "computed", ")", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L625-L639
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.POST
def POST(self): """ The HTTP POST body parsed into a MultiDict. This supports urlencoded and multipart POST requests. Multipart is commonly used for file uploads and may result in some of the values beeing cgi.FieldStorage objects instead of strings. Multiple va...
python
def POST(self): """ The HTTP POST body parsed into a MultiDict. This supports urlencoded and multipart POST requests. Multipart is commonly used for file uploads and may result in some of the values beeing cgi.FieldStorage objects instead of strings. Multiple va...
[ "def", "POST", "(", "self", ")", ":", "if", "self", ".", "_POST", "is", "None", ":", "save_env", "=", "dict", "(", ")", "# Build a save environment for cgi", "for", "key", "in", "(", "'REQUEST_METHOD'", ",", "'CONTENT_TYPE'", ",", "'CONTENT_LENGTH'", ")", ":...
The HTTP POST body parsed into a MultiDict. This supports urlencoded and multipart POST requests. Multipart is commonly used for file uploads and may result in some of the values beeing cgi.FieldStorage objects instead of strings. Multiple values per key are possible. S...
[ "The", "HTTP", "POST", "body", "parsed", "into", "a", "MultiDict", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L676-L699
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.params
def params(self): """ A combined MultiDict with POST and GET parameters. """ if self._GETPOST is None: self._GETPOST = MultiDict(self.GET) self._GETPOST.update(dict(self.POST)) return self._GETPOST
python
def params(self): """ A combined MultiDict with POST and GET parameters. """ if self._GETPOST is None: self._GETPOST = MultiDict(self.GET) self._GETPOST.update(dict(self.POST)) return self._GETPOST
[ "def", "params", "(", "self", ")", ":", "if", "self", ".", "_GETPOST", "is", "None", ":", "self", ".", "_GETPOST", "=", "MultiDict", "(", "self", ".", "GET", ")", "self", ".", "_GETPOST", ".", "update", "(", "dict", "(", "self", ".", "POST", ")", ...
A combined MultiDict with POST and GET parameters.
[ "A", "combined", "MultiDict", "with", "POST", "and", "GET", "parameters", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L702-L707
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Request.get_cookie
def get_cookie(self, *args): """ Return the (decoded) value of a cookie. """ value = self.COOKIES.get(*args) sec = self.app.config['securecookie.key'] dec = cookie_decode(value, sec) return dec or value
python
def get_cookie(self, *args): """ Return the (decoded) value of a cookie. """ value = self.COOKIES.get(*args) sec = self.app.config['securecookie.key'] dec = cookie_decode(value, sec) return dec or value
[ "def", "get_cookie", "(", "self", ",", "*", "args", ")", ":", "value", "=", "self", ".", "COOKIES", ".", "get", "(", "*", "args", ")", "sec", "=", "self", ".", "app", ".", "config", "[", "'securecookie.key'", "]", "dec", "=", "cookie_decode", "(", ...
Return the (decoded) value of a cookie.
[ "Return", "the", "(", "decoded", ")", "value", "of", "a", "cookie", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L753-L758
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Response.copy
def copy(self): ''' Returns a copy of self ''' copy = Response(self.app) copy.status = self.status copy.headers = self.headers.copy() copy.content_type = self.content_type return copy
python
def copy(self): ''' Returns a copy of self ''' copy = Response(self.app) copy.status = self.status copy.headers = self.headers.copy() copy.content_type = self.content_type return copy
[ "def", "copy", "(", "self", ")", ":", "copy", "=", "Response", "(", "self", ".", "app", ")", "copy", ".", "status", "=", "self", ".", "status", "copy", ".", "headers", "=", "self", ".", "headers", ".", "copy", "(", ")", "copy", ".", "content_type",...
Returns a copy of self
[ "Returns", "a", "copy", "of", "self" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L776-L782
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Response.wsgiheader
def wsgiheader(self): ''' Returns a wsgi conform list of header/value pairs. ''' for c in list(self.COOKIES.values()): if c.OutputString() not in self.headers.getall('Set-Cookie'): self.headers.append('Set-Cookie', c.OutputString()) return list(self.headers.iterallite...
python
def wsgiheader(self): ''' Returns a wsgi conform list of header/value pairs. ''' for c in list(self.COOKIES.values()): if c.OutputString() not in self.headers.getall('Set-Cookie'): self.headers.append('Set-Cookie', c.OutputString()) return list(self.headers.iterallite...
[ "def", "wsgiheader", "(", "self", ")", ":", "for", "c", "in", "list", "(", "self", ".", "COOKIES", ".", "values", "(", ")", ")", ":", "if", "c", ".", "OutputString", "(", ")", "not", "in", "self", ".", "headers", ".", "getall", "(", "'Set-Cookie'",...
Returns a wsgi conform list of header/value pairs.
[ "Returns", "a", "wsgi", "conform", "list", "of", "header", "/", "value", "pairs", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L784-L789
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py
Response.set_cookie
def set_cookie(self, key, value, **kargs): """ Add a new cookie with various options. If the cookie value is not a string, a secure cookie is created. Possible options are: expires, path, comment, domain, max_age, secure, version, httponly See http://de....
python
def set_cookie(self, key, value, **kargs): """ Add a new cookie with various options. If the cookie value is not a string, a secure cookie is created. Possible options are: expires, path, comment, domain, max_age, secure, version, httponly See http://de....
[ "def", "set_cookie", "(", "self", ",", "key", ",", "value", ",", "*", "*", "kargs", ")", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "sec", "=", "self", ".", "app", ".", "config", "[", "'securecookie.key'", "]", "value", "="...
Add a new cookie with various options. If the cookie value is not a string, a secure cookie is created. Possible options are: expires, path, comment, domain, max_age, secure, version, httponly See http://de.wikipedia.org/wiki/HTTP-Cookie#Aufbau for details
[ "Add", "a", "new", "cookie", "with", "various", "options", ".", "If", "the", "cookie", "value", "is", "not", "a", "string", "a", "secure", "cookie", "is", "created", ".", "Possible", "options", "are", ":", "expires", "path", "comment", "domain", "max_age",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/util/bottle3.py#L809-L823
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/python_bindings/source_parser.py
parse_source_file
def parse_source_file(file_name): """ Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add_argument('filename', help="Name of the file ...
python
def parse_source_file(file_name): """ Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add_argument('filename', help="Name of the file ...
[ "def", "parse_source_file", "(", "file_name", ")", ":", "nodes", "=", "ast", ".", "parse", "(", "_openfile", "(", "file_name", ")", ")", "module_imports", "=", "get_nodes_by_instance_type", "(", "nodes", ",", "_ast", ".", "Import", ")", "specific_imports", "="...
Parses the AST of Python file for lines containing references to the argparse module. returns the collection of ast objects found. Example client code: 1. parser = ArgumentParser(desc="My help Message") 2. parser.add_argument('filename', help="Name of the file to load") 3. parser.add_argument('-f',...
[ "Parses", "the", "AST", "of", "Python", "file", "for", "lines", "containing", "references", "to", "the", "argparse", "module", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/python_bindings/source_parser.py#L19-L60
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
memory_usage
def memory_usage(proc=-1, interval=.1, timeout=None, timestamps=False, include_children=False, max_usage=False, retval=False, stream=None): """ Return the memory usage of a process or piece of code Parameters ---------- proc : {int, string, tuple, subprocess.Popen}...
python
def memory_usage(proc=-1, interval=.1, timeout=None, timestamps=False, include_children=False, max_usage=False, retval=False, stream=None): """ Return the memory usage of a process or piece of code Parameters ---------- proc : {int, string, tuple, subprocess.Popen}...
[ "def", "memory_usage", "(", "proc", "=", "-", "1", ",", "interval", "=", ".1", ",", "timeout", "=", "None", ",", "timestamps", "=", "False", ",", "include_children", "=", "False", ",", "max_usage", "=", "False", ",", "retval", "=", "False", ",", "strea...
Return the memory usage of a process or piece of code Parameters ---------- proc : {int, string, tuple, subprocess.Popen}, optional The process to monitor. Can be given by an integer/string representing a PID, by a Popen object or by a tuple representing a Python function. The tuple...
[ "Return", "the", "memory", "usage", "of", "a", "process", "or", "piece", "of", "code" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L144-L290
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
_find_script
def _find_script(script_name): """ Find the script. If the input is not a file, then $PATH will be searched. """ if os.path.isfile(script_name): return script_name path = os.getenv('PATH', os.defpath).split(os.pathsep) for folder in path: if not folder: continue ...
python
def _find_script(script_name): """ Find the script. If the input is not a file, then $PATH will be searched. """ if os.path.isfile(script_name): return script_name path = os.getenv('PATH', os.defpath).split(os.pathsep) for folder in path: if not folder: continue ...
[ "def", "_find_script", "(", "script_name", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "script_name", ")", ":", "return", "script_name", "path", "=", "os", ".", "getenv", "(", "'PATH'", ",", "os", ".", "defpath", ")", ".", "split", "(", "o...
Find the script. If the input is not a file, then $PATH will be searched.
[ "Find", "the", "script", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L296-L312
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
magic_mprun
def magic_mprun(self, parameter_s=''): """ Execute a statement under the line-by-line memory profiler from the memory_profiler module. Usage: %mprun -f func1 -f func2 <statement> The given statement (which doesn't require quote marks) is run via the LineProfiler. Profiling is enabled for the...
python
def magic_mprun(self, parameter_s=''): """ Execute a statement under the line-by-line memory profiler from the memory_profiler module. Usage: %mprun -f func1 -f func2 <statement> The given statement (which doesn't require quote marks) is run via the LineProfiler. Profiling is enabled for the...
[ "def", "magic_mprun", "(", "self", ",", "parameter_s", "=", "''", ")", ":", "try", ":", "from", "StringIO", "import", "StringIO", "except", "ImportError", ":", "# Python 3.x", "from", "io", "import", "StringIO", "# Local imports to avoid hard dependency.", "from", ...
Execute a statement under the line-by-line memory profiler from the memory_profiler module. Usage: %mprun -f func1 -f func2 <statement> The given statement (which doesn't require quote marks) is run via the LineProfiler. Profiling is enabled for the functions specified by the -f options. The...
[ "Execute", "a", "statement", "under", "the", "line", "-", "by", "-", "line", "memory", "profiler", "from", "the", "memory_profiler", "module", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L580-L701
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
magic_memit
def magic_memit(self, line=''): """Measure memory usage of a Python statement Usage, in line mode: %memit [-r<R>t<T>i<I>] statement Options: -r<R>: repeat the loop iteration <R> times and take the best result. Default: 1 -t<T>: timeout after <T> seconds. Default: None -i<I>: Get ti...
python
def magic_memit(self, line=''): """Measure memory usage of a Python statement Usage, in line mode: %memit [-r<R>t<T>i<I>] statement Options: -r<R>: repeat the loop iteration <R> times and take the best result. Default: 1 -t<T>: timeout after <T> seconds. Default: None -i<I>: Get ti...
[ "def", "magic_memit", "(", "self", ",", "line", "=", "''", ")", ":", "opts", ",", "stmt", "=", "self", ".", "parse_options", "(", "line", ",", "'r:t:i:c'", ",", "posix", "=", "False", ",", "strict", "=", "False", ")", "repeat", "=", "int", "(", "ge...
Measure memory usage of a Python statement Usage, in line mode: %memit [-r<R>t<T>i<I>] statement Options: -r<R>: repeat the loop iteration <R> times and take the best result. Default: 1 -t<T>: timeout after <T> seconds. Default: None -i<I>: Get time information at an interval of I time...
[ "Measure", "memory", "usage", "of", "a", "Python", "statement" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L712-L775
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
profile
def profile(func, stream=None): """ Decorator that will run the function and print a line-by-line profile """ def wrapper(*args, **kwargs): prof = LineProfiler() val = prof(func)(*args, **kwargs) show_results(prof, stream=stream) return val return wrapper
python
def profile(func, stream=None): """ Decorator that will run the function and print a line-by-line profile """ def wrapper(*args, **kwargs): prof = LineProfiler() val = prof(func)(*args, **kwargs) show_results(prof, stream=stream) return val return wrapper
[ "def", "profile", "(", "func", ",", "stream", "=", "None", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prof", "=", "LineProfiler", "(", ")", "val", "=", "prof", "(", "func", ")", "(", "*", "args", ",", "*",...
Decorator that will run the function and print a line-by-line profile
[ "Decorator", "that", "will", "run", "the", "function", "and", "print", "a", "line", "-", "by", "-", "line", "profile" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L784-L793
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
TimeStamper.timestamp
def timestamp(self, name="<block>"): """Returns a context manager for timestamping a block of code.""" # Make a fake function func = lambda x: x func.__module__ = "" func.__name__ = name self.add_function(func) timestamps = [] self.functions[func].append(t...
python
def timestamp(self, name="<block>"): """Returns a context manager for timestamping a block of code.""" # Make a fake function func = lambda x: x func.__module__ = "" func.__name__ = name self.add_function(func) timestamps = [] self.functions[func].append(t...
[ "def", "timestamp", "(", "self", ",", "name", "=", "\"<block>\"", ")", ":", "# Make a fake function", "func", "=", "lambda", "x", ":", "x", "func", ".", "__module__", "=", "\"\"", "func", ".", "__name__", "=", "name", "self", ".", "add_function", "(", "f...
Returns a context manager for timestamping a block of code.
[ "Returns", "a", "context", "manager", "for", "timestamping", "a", "block", "of", "code", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L347-L358
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
TimeStamper.wrap_function
def wrap_function(self, func): """ Wrap a function to timestamp it. """ def f(*args, **kwds): # Start time timestamps = [_get_memory(os.getpid(), timestamps=True)] self.functions[func].append(timestamps) try: result = func(*args, **...
python
def wrap_function(self, func): """ Wrap a function to timestamp it. """ def f(*args, **kwds): # Start time timestamps = [_get_memory(os.getpid(), timestamps=True)] self.functions[func].append(timestamps) try: result = func(*args, **...
[ "def", "wrap_function", "(", "self", ",", "func", ")", ":", "def", "f", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "# Start time", "timestamps", "=", "[", "_get_memory", "(", "os", ".", "getpid", "(", ")", ",", "timestamps", "=", "True", ")...
Wrap a function to timestamp it.
[ "Wrap", "a", "function", "to", "timestamp", "it", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L364-L377
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
LineProfiler.add_function
def add_function(self, func): """ Record line profiling information for the given Python function. """ try: # func_code does not exist in Python3 code = func.__code__ except AttributeError: warnings.warn("Could not extract a code object for the object ...
python
def add_function(self, func): """ Record line profiling information for the given Python function. """ try: # func_code does not exist in Python3 code = func.__code__ except AttributeError: warnings.warn("Could not extract a code object for the object ...
[ "def", "add_function", "(", "self", ",", "func", ")", ":", "try", ":", "# func_code does not exist in Python3", "code", "=", "func", ".", "__code__", "except", "AttributeError", ":", "warnings", ".", "warn", "(", "\"Could not extract a code object for the object %r\"", ...
Record line profiling information for the given Python function.
[ "Record", "line", "profiling", "information", "for", "the", "given", "Python", "function", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L416-L426
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
LineProfiler.run
def run(self, cmd): """ Profile a single executable statement in the main namespace. """ # TODO: can this be removed ? import __main__ main_dict = __main__.__dict__ return self.runctx(cmd, main_dict, main_dict)
python
def run(self, cmd): """ Profile a single executable statement in the main namespace. """ # TODO: can this be removed ? import __main__ main_dict = __main__.__dict__ return self.runctx(cmd, main_dict, main_dict)
[ "def", "run", "(", "self", ",", "cmd", ")", ":", "# TODO: can this be removed ?", "import", "__main__", "main_dict", "=", "__main__", ".", "__dict__", "return", "self", ".", "runctx", "(", "cmd", ",", "main_dict", ",", "main_dict", ")" ]
Profile a single executable statement in the main namespace.
[ "Profile", "a", "single", "executable", "statement", "in", "the", "main", "namespace", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L441-L447
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py
LineProfiler.trace_memory_usage
def trace_memory_usage(self, frame, event, arg): """Callback for sys.settrace""" if (event in ('call', 'line', 'return') and frame.f_code in self.code_map): if event != 'call': # "call" event just saves the lineno but not the memory mem = _get_...
python
def trace_memory_usage(self, frame, event, arg): """Callback for sys.settrace""" if (event in ('call', 'line', 'return') and frame.f_code in self.code_map): if event != 'call': # "call" event just saves the lineno but not the memory mem = _get_...
[ "def", "trace_memory_usage", "(", "self", ",", "frame", ",", "event", ",", "arg", ")", ":", "if", "(", "event", "in", "(", "'call'", ",", "'line'", ",", "'return'", ")", "and", "frame", ".", "f_code", "in", "self", ".", "code_map", ")", ":", "if", ...
Callback for sys.settrace
[ "Callback", "for", "sys", ".", "settrace" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/memory_profiler/memory_profiler.py#L475-L490
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatsLoader.get_root
def get_root( self, key ): """Retrieve a given declared root by root-type-key""" if key not in self.roots: function = getattr( self, 'load_%s'%(key,) )() self.roots[key] = function return self.roots[key]
python
def get_root( self, key ): """Retrieve a given declared root by root-type-key""" if key not in self.roots: function = getattr( self, 'load_%s'%(key,) )() self.roots[key] = function return self.roots[key]
[ "def", "get_root", "(", "self", ",", "key", ")", ":", "if", "key", "not", "in", "self", ".", "roots", ":", "function", "=", "getattr", "(", "self", ",", "'load_%s'", "%", "(", "key", ",", ")", ")", "(", ")", "self", ".", "roots", "[", "key", "]...
Retrieve a given declared root by root-type-key
[ "Retrieve", "a", "given", "declared", "root", "by", "root", "-", "type", "-", "key" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L21-L26
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatsLoader.get_rows
def get_rows( self, key ): """Get the set of rows for the type-key""" if key not in self.roots: self.get_root( key ) if key == 'location': return self.location_rows else: return self.rows
python
def get_rows( self, key ): """Get the set of rows for the type-key""" if key not in self.roots: self.get_root( key ) if key == 'location': return self.location_rows else: return self.rows
[ "def", "get_rows", "(", "self", ",", "key", ")", ":", "if", "key", "not", "in", "self", ".", "roots", ":", "self", ".", "get_root", "(", "key", ")", "if", "key", "==", "'location'", ":", "return", "self", ".", "location_rows", "else", ":", "return", ...
Get the set of rows for the type-key
[ "Get", "the", "set", "of", "rows", "for", "the", "type", "-", "key" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L27-L34
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatsLoader.load
def load( self, stats ): """Build a squaremap-compatible model from a pstats class""" rows = self.rows for func, raw in stats.iteritems(): try: rows[func] = row = PStatRow( func,raw ) except ValueError, err: log.info( 'Null row: %s', func )...
python
def load( self, stats ): """Build a squaremap-compatible model from a pstats class""" rows = self.rows for func, raw in stats.iteritems(): try: rows[func] = row = PStatRow( func,raw ) except ValueError, err: log.info( 'Null row: %s', func )...
[ "def", "load", "(", "self", ",", "stats", ")", ":", "rows", "=", "self", ".", "rows", "for", "func", ",", "raw", "in", "stats", ".", "iteritems", "(", ")", ":", "try", ":", "rows", "[", "func", "]", "=", "row", "=", "PStatRow", "(", "func", ","...
Build a squaremap-compatible model from a pstats class
[ "Build", "a", "squaremap", "-", "compatible", "model", "from", "a", "pstats", "class" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L44-L54
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatsLoader.find_root
def find_root( self, rows ): """Attempt to find/create a reasonable root node from list/set of rows rows -- key: PStatRow mapping TODO: still need more robustness here, particularly in the case of threaded programs. Should be tracing back each row to root, breaking cycles by s...
python
def find_root( self, rows ): """Attempt to find/create a reasonable root node from list/set of rows rows -- key: PStatRow mapping TODO: still need more robustness here, particularly in the case of threaded programs. Should be tracing back each row to root, breaking cycles by s...
[ "def", "find_root", "(", "self", ",", "rows", ")", ":", "maxes", "=", "sorted", "(", "rows", ".", "values", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", ".", "cumulative", ")", "if", "not", "maxes", ":", "raise", "RuntimeError", "(", "\"\"\"...
Attempt to find/create a reasonable root node from list/set of rows rows -- key: PStatRow mapping TODO: still need more robustness here, particularly in the case of threaded programs. Should be tracing back each row to root, breaking cycles by sorting on cumulative time, and then coll...
[ "Attempt", "to", "find", "/", "create", "a", "reasonable", "root", "node", "from", "list", "/", "set", "of", "rows" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L61-L91
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatsLoader._load_location
def _load_location( self ): """Build a squaremap-compatible model for location-based hierarchy""" directories = {} files = {} root = PStatLocation( '/', 'PYTHONPATH' ) self.location_rows = self.rows.copy() for child in self.rows.values(): current = directories...
python
def _load_location( self ): """Build a squaremap-compatible model for location-based hierarchy""" directories = {} files = {} root = PStatLocation( '/', 'PYTHONPATH' ) self.location_rows = self.rows.copy() for child in self.rows.values(): current = directories...
[ "def", "_load_location", "(", "self", ")", ":", "directories", "=", "{", "}", "files", "=", "{", "}", "root", "=", "PStatLocation", "(", "'/'", ",", "'PYTHONPATH'", ")", "self", ".", "location_rows", "=", "self", ".", "rows", ".", "copy", "(", ")", "...
Build a squaremap-compatible model for location-based hierarchy
[ "Build", "a", "squaremap", "-", "compatible", "model", "for", "location", "-", "based", "hierarchy" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L97-L142
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatGroup.finalize
def finalize( self, already_done=None ): """Finalize our values (recursively) taken from our children""" if already_done is None: already_done = {} if already_done.has_key( self ): return True already_done[self] = True self.filter_children() childr...
python
def finalize( self, already_done=None ): """Finalize our values (recursively) taken from our children""" if already_done is None: already_done = {} if already_done.has_key( self ): return True already_done[self] = True self.filter_children() childr...
[ "def", "finalize", "(", "self", ",", "already_done", "=", "None", ")", ":", "if", "already_done", "is", "None", ":", "already_done", "=", "{", "}", "if", "already_done", ".", "has_key", "(", "self", ")", ":", "return", "True", "already_done", "[", "self"...
Finalize our values (recursively) taken from our children
[ "Finalize", "our", "values", "(", "recursively", ")", "taken", "from", "our", "children" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L230-L243
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatGroup.calculate_totals
def calculate_totals( self, children, local_children=None ): """Calculate our cumulative totals from children and/or local children""" for field,local_field in (('recursive','calls'),('cumulative','local')): values = [] for child in children: if isinstance( child,...
python
def calculate_totals( self, children, local_children=None ): """Calculate our cumulative totals from children and/or local children""" for field,local_field in (('recursive','calls'),('cumulative','local')): values = [] for child in children: if isinstance( child,...
[ "def", "calculate_totals", "(", "self", ",", "children", ",", "local_children", "=", "None", ")", ":", "for", "field", ",", "local_field", "in", "(", "(", "'recursive'", ",", "'calls'", ")", ",", "(", "'cumulative'", ",", "'local'", ")", ")", ":", "value...
Calculate our cumulative totals from children and/or local children
[ "Calculate", "our", "cumulative", "totals", "from", "children", "and", "/", "or", "local", "children" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L246-L270
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py
PStatLocation.filter_children
def filter_children( self ): """Filter our children into regular and local children sets""" real_children = [] for child in self.children: if child.name == '<module>': self.local_children.append( child ) else: real_children.append( child ) ...
python
def filter_children( self ): """Filter our children into regular and local children sets""" real_children = [] for child in self.children: if child.name == '<module>': self.local_children.append( child ) else: real_children.append( child ) ...
[ "def", "filter_children", "(", "self", ")", ":", "real_children", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "name", "==", "'<module>'", ":", "self", ".", "local_children", ".", "append", "(", "child", ")", "...
Filter our children into regular and local children sets
[ "Filter", "our", "children", "into", "regular", "and", "local", "children", "sets" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/pstatsloader.py#L284-L292
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
split_box
def split_box( fraction, x,y, w,h ): """Return set of two boxes where first is the fraction given""" if w >= h: new_w = int(w*fraction) if new_w: return (x,y,new_w,h),(x+new_w,y,w-new_w,h) else: return None,None else: new_h = int(h*fraction) if...
python
def split_box( fraction, x,y, w,h ): """Return set of two boxes where first is the fraction given""" if w >= h: new_w = int(w*fraction) if new_w: return (x,y,new_w,h),(x+new_w,y,w-new_w,h) else: return None,None else: new_h = int(h*fraction) if...
[ "def", "split_box", "(", "fraction", ",", "x", ",", "y", ",", "w", ",", "h", ")", ":", "if", "w", ">=", "h", ":", "new_w", "=", "int", "(", "w", "*", "fraction", ")", "if", "new_w", ":", "return", "(", "x", ",", "y", ",", "new_w", ",", "h",...
Return set of two boxes where first is the fraction given
[ "Return", "set", "of", "two", "boxes", "where", "first", "is", "the", "fraction", "given" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L418-L431
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
split_by_value
def split_by_value( total, nodes, headdivisor=2.0 ): """Produce, (sum,head),(sum,tail) for nodes to attempt binary partition""" head_sum,tail_sum = 0,0 divider = 0 for node in nodes[::-1]: if head_sum < total/headdivisor: head_sum += node[0] divider -= 1 else: ...
python
def split_by_value( total, nodes, headdivisor=2.0 ): """Produce, (sum,head),(sum,tail) for nodes to attempt binary partition""" head_sum,tail_sum = 0,0 divider = 0 for node in nodes[::-1]: if head_sum < total/headdivisor: head_sum += node[0] divider -= 1 else: ...
[ "def", "split_by_value", "(", "total", ",", "nodes", ",", "headdivisor", "=", "2.0", ")", ":", "head_sum", ",", "tail_sum", "=", "0", ",", "0", "divider", "=", "0", "for", "node", "in", "nodes", "[", ":", ":", "-", "1", "]", ":", "if", "head_sum", ...
Produce, (sum,head),(sum,tail) for nodes to attempt binary partition
[ "Produce", "(", "sum", "head", ")", "(", "sum", "tail", ")", "for", "nodes", "to", "attempt", "binary", "partition" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L433-L443
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
HotMapNavigator.findNode
def findNode(class_, hot_map, targetNode, parentNode=None): ''' Find the target node in the hot_map. ''' for index, (rect, node, children) in enumerate(hot_map): if node == targetNode: return parentNode, hot_map, index result = class_.findNode(children, targetNode...
python
def findNode(class_, hot_map, targetNode, parentNode=None): ''' Find the target node in the hot_map. ''' for index, (rect, node, children) in enumerate(hot_map): if node == targetNode: return parentNode, hot_map, index result = class_.findNode(children, targetNode...
[ "def", "findNode", "(", "class_", ",", "hot_map", ",", "targetNode", ",", "parentNode", "=", "None", ")", ":", "for", "index", ",", "(", "rect", ",", "node", ",", "children", ")", "in", "enumerate", "(", "hot_map", ")", ":", "if", "node", "==", "targ...
Find the target node in the hot_map.
[ "Find", "the", "target", "node", "in", "the", "hot_map", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L16-L24
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
HotMapNavigator.firstChild
def firstChild(hot_map, index): ''' Return the first child of the node indicated by index. ''' children = hot_map[index][2] if children: return children[0][1] else: return hot_map[index][1]
python
def firstChild(hot_map, index): ''' Return the first child of the node indicated by index. ''' children = hot_map[index][2] if children: return children[0][1] else: return hot_map[index][1]
[ "def", "firstChild", "(", "hot_map", ",", "index", ")", ":", "children", "=", "hot_map", "[", "index", "]", "[", "2", "]", "if", "children", ":", "return", "children", "[", "0", "]", "[", "1", "]", "else", ":", "return", "hot_map", "[", "index", "]...
Return the first child of the node indicated by index.
[ "Return", "the", "first", "child", "of", "the", "node", "indicated", "by", "index", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L46-L52
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
HotMapNavigator.nextChild
def nextChild(hotmap, index): ''' Return the next sibling of the node indicated by index. ''' nextChildIndex = min(index + 1, len(hotmap) - 1) return hotmap[nextChildIndex][1]
python
def nextChild(hotmap, index): ''' Return the next sibling of the node indicated by index. ''' nextChildIndex = min(index + 1, len(hotmap) - 1) return hotmap[nextChildIndex][1]
[ "def", "nextChild", "(", "hotmap", ",", "index", ")", ":", "nextChildIndex", "=", "min", "(", "index", "+", "1", ",", "len", "(", "hotmap", ")", "-", "1", ")", "return", "hotmap", "[", "nextChildIndex", "]", "[", "1", "]" ]
Return the next sibling of the node indicated by index.
[ "Return", "the", "next", "sibling", "of", "the", "node", "indicated", "by", "index", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L55-L58
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
HotMapNavigator.lastNode
def lastNode(class_, hot_map): ''' Return the very last node (recursively) in the hot map. ''' children = hot_map[-1][2] if children: return class_.lastNode(children) else: return hot_map[-1][1]
python
def lastNode(class_, hot_map): ''' Return the very last node (recursively) in the hot map. ''' children = hot_map[-1][2] if children: return class_.lastNode(children) else: return hot_map[-1][1]
[ "def", "lastNode", "(", "class_", ",", "hot_map", ")", ":", "children", "=", "hot_map", "[", "-", "1", "]", "[", "2", "]", "if", "children", ":", "return", "class_", ".", "lastNode", "(", "children", ")", "else", ":", "return", "hot_map", "[", "-", ...
Return the very last node (recursively) in the hot map.
[ "Return", "the", "very", "last", "node", "(", "recursively", ")", "in", "the", "hot", "map", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L72-L78
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.OnMouse
def OnMouse( self, event ): """Handle mouse-move event by selecting a given element""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) self.SetHighlight( node, event.GetPosition() )
python
def OnMouse( self, event ): """Handle mouse-move event by selecting a given element""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) self.SetHighlight( node, event.GetPosition() )
[ "def", "OnMouse", "(", "self", ",", "event", ")", ":", "node", "=", "HotMapNavigator", ".", "findNodeAtPosition", "(", "self", ".", "hot_map", ",", "event", ".", "GetPosition", "(", ")", ")", "self", ".", "SetHighlight", "(", "node", ",", "event", ".", ...
Handle mouse-move event by selecting a given element
[ "Handle", "mouse", "-", "move", "event", "by", "selecting", "a", "given", "element" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L137-L140
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.OnClickRelease
def OnClickRelease( self, event ): """Release over a given square in the map""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) self.SetSelected( node, event.GetPosition() )
python
def OnClickRelease( self, event ): """Release over a given square in the map""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) self.SetSelected( node, event.GetPosition() )
[ "def", "OnClickRelease", "(", "self", ",", "event", ")", ":", "node", "=", "HotMapNavigator", ".", "findNodeAtPosition", "(", "self", ".", "hot_map", ",", "event", ".", "GetPosition", "(", ")", ")", "self", ".", "SetSelected", "(", "node", ",", "event", ...
Release over a given square in the map
[ "Release", "over", "a", "given", "square", "in", "the", "map" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L142-L145
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.OnDoubleClick
def OnDoubleClick(self, event): """Double click on a given square in the map""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) if node: wx.PostEvent( self, SquareActivationEvent( node=node, point=event.GetPosition(), map=self ) )
python
def OnDoubleClick(self, event): """Double click on a given square in the map""" node = HotMapNavigator.findNodeAtPosition(self.hot_map, event.GetPosition()) if node: wx.PostEvent( self, SquareActivationEvent( node=node, point=event.GetPosition(), map=self ) )
[ "def", "OnDoubleClick", "(", "self", ",", "event", ")", ":", "node", "=", "HotMapNavigator", ".", "findNodeAtPosition", "(", "self", ".", "hot_map", ",", "event", ".", "GetPosition", "(", ")", ")", "if", "node", ":", "wx", ".", "PostEvent", "(", "self", ...
Double click on a given square in the map
[ "Double", "click", "on", "a", "given", "square", "in", "the", "map" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L147-L151
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.SetSelected
def SetSelected( self, node, point=None, propagate=True ): """Set the given node selected in the square-map""" if node == self.selectedNode: return self.selectedNode = node self.UpdateDrawing() if node: wx.PostEvent( self, SquareSelectionEvent( node=node, ...
python
def SetSelected( self, node, point=None, propagate=True ): """Set the given node selected in the square-map""" if node == self.selectedNode: return self.selectedNode = node self.UpdateDrawing() if node: wx.PostEvent( self, SquareSelectionEvent( node=node, ...
[ "def", "SetSelected", "(", "self", ",", "node", ",", "point", "=", "None", ",", "propagate", "=", "True", ")", ":", "if", "node", "==", "self", ".", "selectedNode", ":", "return", "self", ".", "selectedNode", "=", "node", "self", ".", "UpdateDrawing", ...
Set the given node selected in the square-map
[ "Set", "the", "given", "node", "selected", "in", "the", "square", "-", "map" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L185-L192
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.SetHighlight
def SetHighlight( self, node, point=None, propagate=True ): """Set the currently-highlighted node""" if node == self.highlightedNode: return self.highlightedNode = node # TODO: restrict refresh to the squares for previous node and new node... self.UpdateDrawing() ...
python
def SetHighlight( self, node, point=None, propagate=True ): """Set the currently-highlighted node""" if node == self.highlightedNode: return self.highlightedNode = node # TODO: restrict refresh to the squares for previous node and new node... self.UpdateDrawing() ...
[ "def", "SetHighlight", "(", "self", ",", "node", ",", "point", "=", "None", ",", "propagate", "=", "True", ")", ":", "if", "node", "==", "self", ".", "highlightedNode", ":", "return", "self", ".", "highlightedNode", "=", "node", "# TODO: restrict refresh to ...
Set the currently-highlighted node
[ "Set", "the", "currently", "-", "highlighted", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L194-L202
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.SetModel
def SetModel( self, model, adapter=None ): """Set our model object (root of the tree)""" self.model = model if adapter is not None: self.adapter = adapter self.UpdateDrawing()
python
def SetModel( self, model, adapter=None ): """Set our model object (root of the tree)""" self.model = model if adapter is not None: self.adapter = adapter self.UpdateDrawing()
[ "def", "SetModel", "(", "self", ",", "model", ",", "adapter", "=", "None", ")", ":", "self", ".", "model", "=", "model", "if", "adapter", "is", "not", "None", ":", "self", ".", "adapter", "=", "adapter", "self", ".", "UpdateDrawing", "(", ")" ]
Set our model object (root of the tree)
[ "Set", "our", "model", "object", "(", "root", "of", "the", "tree", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L204-L209
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.Draw
def Draw(self, dc): ''' Draw the tree map on the device context. ''' self.hot_map = [] dc.BeginDrawing() brush = wx.Brush( self.BackgroundColour ) dc.SetBackground( brush ) dc.Clear() if self.model: self.max_depth_seen = 0 font = self.Font...
python
def Draw(self, dc): ''' Draw the tree map on the device context. ''' self.hot_map = [] dc.BeginDrawing() brush = wx.Brush( self.BackgroundColour ) dc.SetBackground( brush ) dc.Clear() if self.model: self.max_depth_seen = 0 font = self.Font...
[ "def", "Draw", "(", "self", ",", "dc", ")", ":", "self", ".", "hot_map", "=", "[", "]", "dc", ".", "BeginDrawing", "(", ")", "brush", "=", "wx", ".", "Brush", "(", "self", ".", "BackgroundColour", ")", "dc", ".", "SetBackground", "(", "brush", ")",...
Draw the tree map on the device context.
[ "Draw", "the", "tree", "map", "on", "the", "device", "context", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L232-L246
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.FontForLabels
def FontForLabels(self, dc): ''' Return the default GUI font, scaled for printing if necessary. ''' font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) scale = dc.GetPPI()[0] / wx.ScreenDC().GetPPI()[0] font.SetPointSize(scale*font.GetPointSize()) return font
python
def FontForLabels(self, dc): ''' Return the default GUI font, scaled for printing if necessary. ''' font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) scale = dc.GetPPI()[0] / wx.ScreenDC().GetPPI()[0] font.SetPointSize(scale*font.GetPointSize()) return font
[ "def", "FontForLabels", "(", "self", ",", "dc", ")", ":", "font", "=", "wx", ".", "SystemSettings_GetFont", "(", "wx", ".", "SYS_DEFAULT_GUI_FONT", ")", "scale", "=", "dc", ".", "GetPPI", "(", ")", "[", "0", "]", "/", "wx", ".", "ScreenDC", "(", ")",...
Return the default GUI font, scaled for printing if necessary.
[ "Return", "the", "default", "GUI", "font", "scaled", "for", "printing", "if", "necessary", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L248-L253
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.BrushForNode
def BrushForNode( self, node, depth=0 ): """Create brush to use to display the given node""" if node == self.selectedNode: color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT) elif node == self.highlightedNode: color = wx.Colour( red=0, green=255, blue=0 ) ...
python
def BrushForNode( self, node, depth=0 ): """Create brush to use to display the given node""" if node == self.selectedNode: color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT) elif node == self.highlightedNode: color = wx.Colour( red=0, green=255, blue=0 ) ...
[ "def", "BrushForNode", "(", "self", ",", "node", ",", "depth", "=", "0", ")", ":", "if", "node", "==", "self", ".", "selectedNode", ":", "color", "=", "wx", ".", "SystemSettings_GetColour", "(", "wx", ".", "SYS_COLOUR_HIGHLIGHT", ")", "elif", "node", "==...
Create brush to use to display the given node
[ "Create", "brush", "to", "use", "to", "display", "the", "given", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L255-L268
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.PenForNode
def PenForNode( self, node, depth=0 ): """Determine the pen to use to display the given node""" if node == self.selectedNode: return self.SELECTED_PEN return self.DEFAULT_PEN
python
def PenForNode( self, node, depth=0 ): """Determine the pen to use to display the given node""" if node == self.selectedNode: return self.SELECTED_PEN return self.DEFAULT_PEN
[ "def", "PenForNode", "(", "self", ",", "node", ",", "depth", "=", "0", ")", ":", "if", "node", "==", "self", ".", "selectedNode", ":", "return", "self", ".", "SELECTED_PEN", "return", "self", ".", "DEFAULT_PEN" ]
Determine the pen to use to display the given node
[ "Determine", "the", "pen", "to", "use", "to", "display", "the", "given", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L270-L274
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.TextForegroundForNode
def TextForegroundForNode(self, node, depth=0): """Determine the text foreground color to use to display the label of the given node""" if node == self.selectedNode: fg_color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT) else: fg_color = self.adapt...
python
def TextForegroundForNode(self, node, depth=0): """Determine the text foreground color to use to display the label of the given node""" if node == self.selectedNode: fg_color = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT) else: fg_color = self.adapt...
[ "def", "TextForegroundForNode", "(", "self", ",", "node", ",", "depth", "=", "0", ")", ":", "if", "node", "==", "self", ".", "selectedNode", ":", "fg_color", "=", "wx", ".", "SystemSettings_GetColour", "(", "wx", ".", "SYS_COLOUR_HIGHLIGHTTEXT", ")", "else",...
Determine the text foreground color to use to display the label of the given node
[ "Determine", "the", "text", "foreground", "color", "to", "use", "to", "display", "the", "label", "of", "the", "given", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L276-L285
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.DrawBox
def DrawBox( self, dc, node, x,y,w,h, hot_map, depth=0 ): """Draw a model-node's box and all children nodes""" log.debug( 'Draw: %s to (%s,%s,%s,%s) depth %s', node, x,y,w,h, depth, ) if self.max_depth and depth > self.max_depth: return self.max_depth_seen...
python
def DrawBox( self, dc, node, x,y,w,h, hot_map, depth=0 ): """Draw a model-node's box and all children nodes""" log.debug( 'Draw: %s to (%s,%s,%s,%s) depth %s', node, x,y,w,h, depth, ) if self.max_depth and depth > self.max_depth: return self.max_depth_seen...
[ "def", "DrawBox", "(", "self", ",", "dc", ",", "node", ",", "x", ",", "y", ",", "w", ",", "h", ",", "hot_map", ",", "depth", "=", "0", ")", ":", "log", ".", "debug", "(", "'Draw: %s to (%s,%s,%s,%s) depth %s'", ",", "node", ",", "x", ",", "y", ",...
Draw a model-node's box and all children nodes
[ "Draw", "a", "model", "-", "node", "s", "box", "and", "all", "children", "nodes" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L287-L340
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.DrawIconAndLabel
def DrawIconAndLabel(self, dc, node, x, y, w, h, depth): ''' Draw the icon, if any, and the label, if any, of the node. ''' if w-2 < self._em_size_//2 or h-2 < self._em_size_ //2: return dc.SetClippingRegion(x+1, y+1, w-2, h-2) # Don't draw outside the box try: ic...
python
def DrawIconAndLabel(self, dc, node, x, y, w, h, depth): ''' Draw the icon, if any, and the label, if any, of the node. ''' if w-2 < self._em_size_//2 or h-2 < self._em_size_ //2: return dc.SetClippingRegion(x+1, y+1, w-2, h-2) # Don't draw outside the box try: ic...
[ "def", "DrawIconAndLabel", "(", "self", ",", "dc", ",", "node", ",", "x", ",", "y", ",", "w", ",", "h", ",", "depth", ")", ":", "if", "w", "-", "2", "<", "self", ".", "_em_size_", "//", "2", "or", "h", "-", "2", "<", "self", ".", "_em_size_",...
Draw the icon, if any, and the label, if any, of the node.
[ "Draw", "the", "icon", "if", "any", "and", "the", "label", "if", "any", "of", "the", "node", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L342-L358
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
SquareMap.LayoutChildren
def LayoutChildren( self, dc, children, parent, x,y,w,h, hot_map, depth=0, node_sum=None ): """Layout the set of children in the given rectangle node_sum -- if provided, we are a recursive call that already has sizes and sorting, so skip those operations """ if node_...
python
def LayoutChildren( self, dc, children, parent, x,y,w,h, hot_map, depth=0, node_sum=None ): """Layout the set of children in the given rectangle node_sum -- if provided, we are a recursive call that already has sizes and sorting, so skip those operations """ if node_...
[ "def", "LayoutChildren", "(", "self", ",", "dc", ",", "children", ",", "parent", ",", "x", ",", "y", ",", "w", ",", "h", ",", "hot_map", ",", "depth", "=", "0", ",", "node_sum", "=", "None", ")", ":", "if", "node_sum", "is", "None", ":", "nodes",...
Layout the set of children in the given rectangle node_sum -- if provided, we are a recursive call that already has sizes and sorting, so skip those operations
[ "Layout", "the", "set", "of", "children", "in", "the", "given", "rectangle", "node_sum", "--", "if", "provided", "we", "are", "a", "recursive", "call", "that", "already", "has", "sizes", "and", "sorting", "so", "skip", "those", "operations" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L359-L411
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
DefaultAdapter.overall
def overall( self, node ): """Calculate overall size of the node including children and empty space""" return sum( [self.value(value,node) for value in self.children(node)] )
python
def overall( self, node ): """Calculate overall size of the node including children and empty space""" return sum( [self.value(value,node) for value in self.children(node)] )
[ "def", "overall", "(", "self", ",", "node", ")", ":", "return", "sum", "(", "[", "self", ".", "value", "(", "value", ",", "node", ")", "for", "value", "in", "self", ".", "children", "(", "node", ")", "]", ")" ]
Calculate overall size of the node including children and empty space
[ "Calculate", "overall", "size", "of", "the", "node", "including", "children", "and", "empty", "space" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L457-L459
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
DefaultAdapter.children_sum
def children_sum( self, children,node ): """Calculate children's total sum""" return sum( [self.value(value,node) for value in children] )
python
def children_sum( self, children,node ): """Calculate children's total sum""" return sum( [self.value(value,node) for value in children] )
[ "def", "children_sum", "(", "self", ",", "children", ",", "node", ")", ":", "return", "sum", "(", "[", "self", ".", "value", "(", "value", ",", "node", ")", "for", "value", "in", "children", "]", ")" ]
Calculate children's total sum
[ "Calculate", "children", "s", "total", "sum" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L460-L462
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py
DefaultAdapter.empty
def empty( self, node ): """Calculate empty space as a fraction of total space""" overall = self.overall( node ) if overall: return (overall - self.children_sum( self.children(node), node))/float(overall) return 0
python
def empty( self, node ): """Calculate empty space as a fraction of total space""" overall = self.overall( node ) if overall: return (overall - self.children_sum( self.children(node), node))/float(overall) return 0
[ "def", "empty", "(", "self", ",", "node", ")", ":", "overall", "=", "self", ".", "overall", "(", "node", ")", "if", "overall", ":", "return", "(", "overall", "-", "self", ".", "children_sum", "(", "self", ".", "children", "(", "node", ")", ",", "no...
Calculate empty space as a fraction of total space
[ "Calculate", "empty", "space", "as", "a", "fraction", "of", "total", "space" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/squaremap/squaremap.py#L463-L468
lrq3000/pyFileFixity
pyFileFixity/lib/tqdm/tqdm.py
format_sizeof
def format_sizeof(num, suffix='bytes'): '''Readable size format, courtesy of Sridhar Ratnakumar''' for unit in ['','K','M','G','T','P','E','Z']: if abs(num) < 1000.0: return "%3.1f%s%s" % (num, unit, suffix) num /= 1000.0 return "%.1f%s%s" % (num, 'Y', suffix)
python
def format_sizeof(num, suffix='bytes'): '''Readable size format, courtesy of Sridhar Ratnakumar''' for unit in ['','K','M','G','T','P','E','Z']: if abs(num) < 1000.0: return "%3.1f%s%s" % (num, unit, suffix) num /= 1000.0 return "%.1f%s%s" % (num, 'Y', suffix)
[ "def", "format_sizeof", "(", "num", ",", "suffix", "=", "'bytes'", ")", ":", "for", "unit", "in", "[", "''", ",", "'K'", ",", "'M'", ",", "'G'", ",", "'T'", ",", "'P'", ",", "'E'", ",", "'Z'", "]", ":", "if", "abs", "(", "num", ")", "<", "100...
Readable size format, courtesy of Sridhar Ratnakumar
[ "Readable", "size", "format", "courtesy", "of", "Sridhar", "Ratnakumar" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/tqdm/tqdm.py#L20-L26
lrq3000/pyFileFixity
pyFileFixity/lib/tqdm/tqdm.py
tqdm.update
def update(self, n=1): """ Manually update the progress bar, useful for streams such as reading files (set init(total=filesize) and then in the reading loop, use update(len(current_buffer)) ) Parameters ---------- n : int Increment to add to the internal counter of ...
python
def update(self, n=1): """ Manually update the progress bar, useful for streams such as reading files (set init(total=filesize) and then in the reading loop, use update(len(current_buffer)) ) Parameters ---------- n : int Increment to add to the internal counter of ...
[ "def", "update", "(", "self", ",", "n", "=", "1", ")", ":", "if", "n", "<", "1", ":", "n", "=", "1", "self", ".", "n", "+=", "n", "delta_it", "=", "self", ".", "n", "-", "self", ".", "last_print_n", "if", "delta", ">=", "self", ".", "miniters...
Manually update the progress bar, useful for streams such as reading files (set init(total=filesize) and then in the reading loop, use update(len(current_buffer)) ) Parameters ---------- n : int Increment to add to the internal counter of iterations.
[ "Manually", "update", "the", "progress", "bar", "useful", "for", "streams", "such", "as", "reading", "files", "(", "set", "init", "(", "total", "=", "filesize", ")", "and", "then", "in", "the", "reading", "loop", "use", "update", "(", "len", "(", "curren...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/tqdm/tqdm.py#L239-L260
lrq3000/pyFileFixity
pyFileFixity/lib/tqdm/tqdm.py
tqdm.close
def close(self): """ Call this method to force print the last progress bar update based on the latest n value """ if self.leave: if self.last_print_n < self.n: cur_t = time.time() self.sp.print_status(format_meter(self.n, self.total, cur_t-self...
python
def close(self): """ Call this method to force print the last progress bar update based on the latest n value """ if self.leave: if self.last_print_n < self.n: cur_t = time.time() self.sp.print_status(format_meter(self.n, self.total, cur_t-self...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "leave", ":", "if", "self", ".", "last_print_n", "<", "self", ".", "n", ":", "cur_t", "=", "time", ".", "time", "(", ")", "self", ".", "sp", ".", "print_status", "(", "format_meter", "(", ...
Call this method to force print the last progress bar update based on the latest n value
[ "Call", "this", "method", "to", "force", "print", "the", "last", "progress", "bar", "update", "based", "on", "the", "latest", "n", "value" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/tqdm/tqdm.py#L262-L273