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/distance/distance/_simpledists.py
jaccard
def jaccard(seq1, seq2): """Compute the Jaccard distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different. """ set1, set2 = set(seq1), set(seq2) return 1 - len(set1 & set2) / float(len(set1 ...
python
def jaccard(seq1, seq2): """Compute the Jaccard distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different. """ set1, set2 = set(seq1), set(seq2) return 1 - len(set1 & set2) / float(len(set1 ...
[ "def", "jaccard", "(", "seq1", ",", "seq2", ")", ":", "set1", ",", "set2", "=", "set", "(", "seq1", ")", ",", "set", "(", "seq2", ")", "return", "1", "-", "len", "(", "set1", "&", "set2", ")", "/", "float", "(", "len", "(", "set1", "|", "set2...
Compute the Jaccard distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different.
[ "Compute", "the", "Jaccard", "distance", "between", "the", "two", "sequences", "seq1", "and", "seq2", ".", "They", "should", "contain", "hashable", "items", ".", "The", "return", "value", "is", "a", "float", "between", "0", "and", "1", "where", "0", "means...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/distance/distance/_simpledists.py#L27-L34
lrq3000/pyFileFixity
pyFileFixity/lib/distance/distance/_simpledists.py
sorensen
def sorensen(seq1, seq2): """Compute the Sorensen distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different. """ set1, set2 = set(seq1), set(seq2) return 1 - (2 * len(set1 & set2) / float(le...
python
def sorensen(seq1, seq2): """Compute the Sorensen distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different. """ set1, set2 = set(seq1), set(seq2) return 1 - (2 * len(set1 & set2) / float(le...
[ "def", "sorensen", "(", "seq1", ",", "seq2", ")", ":", "set1", ",", "set2", "=", "set", "(", "seq1", ")", ",", "set", "(", "seq2", ")", "return", "1", "-", "(", "2", "*", "len", "(", "set1", "&", "set2", ")", "/", "float", "(", "len", "(", ...
Compute the Sorensen distance between the two sequences `seq1` and `seq2`. They should contain hashable items. The return value is a float between 0 and 1, where 0 means equal, and 1 totally different.
[ "Compute", "the", "Sorensen", "distance", "between", "the", "two", "sequences", "seq1", "and", "seq2", ".", "They", "should", "contain", "hashable", "items", ".", "The", "return", "value", "is", "a", "float", "between", "0", "and", "1", "where", "0", "mean...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/distance/distance/_simpledists.py#L37-L44
lrq3000/pyFileFixity
pyFileFixity/lib/distance/distance/_lcsubstrings.py
lcsubstrings
def lcsubstrings(seq1, seq2, positions=False): """Find the longest common substring(s) in the sequences `seq1` and `seq2`. If positions evaluates to `True` only their positions will be returned, together with their length, in a tuple: (length, [(start pos in seq1, start pos in seq2)..]) Otherwise, the subst...
python
def lcsubstrings(seq1, seq2, positions=False): """Find the longest common substring(s) in the sequences `seq1` and `seq2`. If positions evaluates to `True` only their positions will be returned, together with their length, in a tuple: (length, [(start pos in seq1, start pos in seq2)..]) Otherwise, the subst...
[ "def", "lcsubstrings", "(", "seq1", ",", "seq2", ",", "positions", "=", "False", ")", ":", "L1", ",", "L2", "=", "len", "(", "seq1", ")", ",", "len", "(", "seq2", ")", "ms", "=", "[", "]", "mlen", "=", "last", "=", "0", "if", "L1", "<", "L2",...
Find the longest common substring(s) in the sequences `seq1` and `seq2`. If positions evaluates to `True` only their positions will be returned, together with their length, in a tuple: (length, [(start pos in seq1, start pos in seq2)..]) Otherwise, the substrings themselves will be returned, in a set. Exa...
[ "Find", "the", "longest", "common", "substring", "(", "s", ")", "in", "the", "sequences", "seq1", "and", "seq2", ".", "If", "positions", "evaluates", "to", "True", "only", "their", "positions", "will", "be", "returned", "together", "with", "their", "length",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/distance/distance/_lcsubstrings.py#L6-L51
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/coldshotadapter.py
BaseColdshotAdapter.background_color
def background_color(self, node, depth): """Create a (unique-ish) background color for each node""" if self.color_mapping is None: self.color_mapping = {} color = self.color_mapping.get(node.key) if color is None: depth = len(self.color_mapping) red = ...
python
def background_color(self, node, depth): """Create a (unique-ish) background color for each node""" if self.color_mapping is None: self.color_mapping = {} color = self.color_mapping.get(node.key) if color is None: depth = len(self.color_mapping) red = ...
[ "def", "background_color", "(", "self", ",", "node", ",", "depth", ")", ":", "if", "self", ".", "color_mapping", "is", "None", ":", "self", ".", "color_mapping", "=", "{", "}", "color", "=", "self", ".", "color_mapping", ".", "get", "(", "node", ".", ...
Create a (unique-ish) background color for each node
[ "Create", "a", "(", "unique", "-", "ish", ")", "background", "color", "for", "each", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/coldshotadapter.py#L15-L26
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/coldshotadapter.py
BaseColdshotAdapter.SetPercentage
def SetPercentage(self, percent, total): """Set whether to display percentage values (and total for doing so)""" self.percentageView = percent self.total = total
python
def SetPercentage(self, percent, total): """Set whether to display percentage values (and total for doing so)""" self.percentageView = percent self.total = total
[ "def", "SetPercentage", "(", "self", ",", "percent", ",", "total", ")", ":", "self", ".", "percentageView", "=", "percent", "self", ".", "total", "=", "total" ]
Set whether to display percentage values (and total for doing so)
[ "Set", "whether", "to", "display", "percentage", "values", "(", "and", "total", "for", "doing", "so", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/coldshotadapter.py#L28-L31
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/debug.py
runprofilerandshow
def runprofilerandshow(funcname, profilepath, argv='', *args, **kwargs): ''' Run a functions profiler and show it in a GUI visualisation using RunSnakeRun Note: can also use calibration for more exact results ''' functionprofiler.runprofile(funcname+'(\''+argv+'\')', profilepath, *args, **kwargs) ...
python
def runprofilerandshow(funcname, profilepath, argv='', *args, **kwargs): ''' Run a functions profiler and show it in a GUI visualisation using RunSnakeRun Note: can also use calibration for more exact results ''' functionprofiler.runprofile(funcname+'(\''+argv+'\')', profilepath, *args, **kwargs) ...
[ "def", "runprofilerandshow", "(", "funcname", ",", "profilepath", ",", "argv", "=", "''", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "functionprofiler", ".", "runprofile", "(", "funcname", "+", "'(\\''", "+", "argv", "+", "'\\')'", ",", "profil...
Run a functions profiler and show it in a GUI visualisation using RunSnakeRun Note: can also use calibration for more exact results
[ "Run", "a", "functions", "profiler", "and", "show", "it", "in", "a", "GUI", "visualisation", "using", "RunSnakeRun", "Note", ":", "can", "also", "use", "calibration", "for", "more", "exact", "results" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/debug.py#L35-L42
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/debug.py
callgraph
def callgraph(func): ''' Makes a call graph Note: be sure to install GraphViz prior to printing the dot graph! ''' import pycallgraph @functools.wraps(func) def wrapper(*args, **kwargs): pycallgraph.start_trace() func(*args, **kwargs) pycallgraph.save_dot('callgraph.log')...
python
def callgraph(func): ''' Makes a call graph Note: be sure to install GraphViz prior to printing the dot graph! ''' import pycallgraph @functools.wraps(func) def wrapper(*args, **kwargs): pycallgraph.start_trace() func(*args, **kwargs) pycallgraph.save_dot('callgraph.log')...
[ "def", "callgraph", "(", "func", ")", ":", "import", "pycallgraph", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pycallgraph", ".", "start_trace", "(", ")", "func", "(", "*"...
Makes a call graph Note: be sure to install GraphViz prior to printing the dot graph!
[ "Makes", "a", "call", "graph", "Note", ":", "be", "sure", "to", "install", "GraphViz", "prior", "to", "printing", "the", "dot", "graph!" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/debug.py#L106-L118
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
_long2bytes
def _long2bytes(n, blocksize=0): """Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize. """ # After much testing, this algorithm was deemed to be...
python
def _long2bytes(n, blocksize=0): """Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize. """ # After much testing, this algorithm was deemed to be...
[ "def", "_long2bytes", "(", "n", ",", "blocksize", "=", "0", ")", ":", "# After much testing, this algorithm was deemed to be the fastest.\r", "s", "=", "''", "pack", "=", "struct", ".", "pack", "while", "n", ">", "0", ":", "### CHANGED FROM '>I' TO '<I'. (DCG)\r", "...
Convert a long integer to a byte string. If optional blocksize is given and greater than zero, pad the front of the byte string with binary zeros so that the length is a multiple of blocksize.
[ "Convert", "a", "long", "integer", "to", "a", "byte", "string", ".", "If", "optional", "blocksize", "is", "given", "and", "greater", "than", "zero", "pad", "the", "front", "of", "the", "byte", "string", "with", "binary", "zeros", "so", "that", "the", "le...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L45-L78
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
XX
def XX(func, a, b, c, d, x, s, ac): """Wrapper for call distribution to functions F, G, H and I. This replaces functions FF, GG, HH and II from "Appl. Crypto. Rotation is separate from addition to prevent recomputation (now summed-up in one function). """ res = 0L res = res + a + ...
python
def XX(func, a, b, c, d, x, s, ac): """Wrapper for call distribution to functions F, G, H and I. This replaces functions FF, GG, HH and II from "Appl. Crypto. Rotation is separate from addition to prevent recomputation (now summed-up in one function). """ res = 0L res = res + a + ...
[ "def", "XX", "(", "func", ",", "a", ",", "b", ",", "c", ",", "d", ",", "x", ",", "s", ",", "ac", ")", ":", "res", "=", "0L", "res", "=", "res", "+", "a", "+", "func", "(", "b", ",", "c", ",", "d", ")", "res", "=", "res", "+", "x", "...
Wrapper for call distribution to functions F, G, H and I. This replaces functions FF, GG, HH and II from "Appl. Crypto. Rotation is separate from addition to prevent recomputation (now summed-up in one function).
[ "Wrapper", "for", "call", "distribution", "to", "functions", "F", "G", "H", "and", "I", ".", "This", "replaces", "functions", "FF", "GG", "HH", "and", "II", "from", "Appl", ".", "Crypto", ".", "Rotation", "is", "separate", "from", "addition", "to", "prev...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L129-L146
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
MD5.init
def init(self): "Initialize the message-digest and set all fields to zero." self.length = 0L self.input = [] # Load magic initialization constants. self.A = 0x67452301L self.B = 0xefcdab89L self.C = 0x98badcfeL self.D = 0x10325476L
python
def init(self): "Initialize the message-digest and set all fields to zero." self.length = 0L self.input = [] # Load magic initialization constants. self.A = 0x67452301L self.B = 0xefcdab89L self.C = 0x98badcfeL self.D = 0x10325476L
[ "def", "init", "(", "self", ")", ":", "self", ".", "length", "=", "0L", "self", ".", "input", "=", "[", "]", "# Load magic initialization constants.\r", "self", ".", "A", "=", "0x67452301L", "self", ".", "B", "=", "0xefcdab89L", "self", ".", "C", "=", ...
Initialize the message-digest and set all fields to zero.
[ "Initialize", "the", "message", "-", "digest", "and", "set", "all", "fields", "to", "zero", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L179-L189
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
MD5._transform
def _transform(self, inp): """Basic MD5 step transforming the digest based on the input. Note that if the Mysterious Constants are arranged backwards in little-endian order and decrypted with the DES they produce OCCULT MESSAGES! """ a, b, c, d = A, B, C, D = se...
python
def _transform(self, inp): """Basic MD5 step transforming the digest based on the input. Note that if the Mysterious Constants are arranged backwards in little-endian order and decrypted with the DES they produce OCCULT MESSAGES! """ a, b, c, d = A, B, C, D = se...
[ "def", "_transform", "(", "self", ",", "inp", ")", ":", "a", ",", "b", ",", "c", ",", "d", "=", "A", ",", "B", ",", "C", ",", "D", "=", "self", ".", "A", ",", "self", ".", "B", ",", "self", ".", "C", ",", "self", ".", "D", "# Round 1.\r",...
Basic MD5 step transforming the digest based on the input. Note that if the Mysterious Constants are arranged backwards in little-endian order and decrypted with the DES they produce OCCULT MESSAGES!
[ "Basic", "MD5", "step", "transforming", "the", "digest", "based", "on", "the", "input", ".", "Note", "that", "if", "the", "Mysterious", "Constants", "are", "arranged", "backwards", "in", "little", "-", "endian", "order", "and", "decrypted", "with", "the", "D...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L192-L291
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
MD5.update
def update(self, inBuf): """Add to the current message. Update the md5 object with the string arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments, i.e. m.update(a); m.update(b) is equivalent to m.update(a+b). """ ...
python
def update(self, inBuf): """Add to the current message. Update the md5 object with the string arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments, i.e. m.update(a); m.update(b) is equivalent to m.update(a+b). """ ...
[ "def", "update", "(", "self", ",", "inBuf", ")", ":", "leninBuf", "=", "long", "(", "len", "(", "inBuf", ")", ")", "# Compute number of bytes mod 64.\r", "index", "=", "(", "self", ".", "count", "[", "0", "]", ">>", "3", ")", "&", "0x3FL", "# Update nu...
Add to the current message. Update the md5 object with the string arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments, i.e. m.update(a); m.update(b) is equivalent to m.update(a+b).
[ "Add", "to", "the", "current", "message", ".", "Update", "the", "md5", "object", "with", "the", "string", "arg", ".", "Repeated", "calls", "are", "equivalent", "to", "a", "single", "call", "with", "the", "concatenation", "of", "all", "the", "arguments", "i...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L297-L329
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
MD5.digest
def digest(self): """Terminate the message-digest computation and return digest. Return the digest of the strings passed to the update() method so far. This is a 16-byte string which may contain non-ASCII characters, including null bytes. """ A = self.A ...
python
def digest(self): """Terminate the message-digest computation and return digest. Return the digest of the strings passed to the update() method so far. This is a 16-byte string which may contain non-ASCII characters, including null bytes. """ A = self.A ...
[ "def", "digest", "(", "self", ")", ":", "A", "=", "self", ".", "A", "B", "=", "self", ".", "B", "C", "=", "self", ".", "C", "D", "=", "self", ".", "D", "input", "=", "[", "]", "+", "self", ".", "input", "count", "=", "[", "]", "+", "self"...
Terminate the message-digest computation and return digest. Return the digest of the strings passed to the update() method so far. This is a 16-byte string which may contain non-ASCII characters, including null bytes.
[ "Terminate", "the", "message", "-", "digest", "computation", "and", "return", "digest", ".", "Return", "the", "digest", "of", "the", "strings", "passed", "to", "the", "update", "()", "method", "so", "far", ".", "This", "is", "a", "16", "-", "byte", "stri...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L332-L375
lrq3000/pyFileFixity
pyFileFixity/lib/md5py.py
MD5.hexdigest
def hexdigest(self): """Terminate and return digest in HEX form. Like digest() except the digest is returned as a string of length 32, containing only hexadecimal digits. This may be used to exchange the value safely in email or other non- binary environments. """...
python
def hexdigest(self): """Terminate and return digest in HEX form. Like digest() except the digest is returned as a string of length 32, containing only hexadecimal digits. This may be used to exchange the value safely in email or other non- binary environments. """...
[ "def", "hexdigest", "(", "self", ")", ":", "d", "=", "map", "(", "None", ",", "self", ".", "digest", "(", ")", ")", "d", "=", "map", "(", "ord", ",", "d", ")", "d", "=", "map", "(", "lambda", "x", ":", "\"%02x\"", "%", "x", ",", "d", ")", ...
Terminate and return digest in HEX form. Like digest() except the digest is returned as a string of length 32, containing only hexadecimal digits. This may be used to exchange the value safely in email or other non- binary environments.
[ "Terminate", "and", "return", "digest", "in", "HEX", "form", ".", "Like", "digest", "()", "except", "the", "digest", "is", "returned", "as", "a", "string", "of", "length", "32", "containing", "only", "hexadecimal", "digits", ".", "This", "may", "be", "used...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/md5py.py#L378-L392
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py
MeliaeAdapter.value
def value( self, node, parent=None ): """Return value used to compare size of this node""" # this is the *weighted* size/contribution of the node try: return node['contribution'] except KeyError, err: contribution = int(node.get('totsize',0)/float( len(node.get('...
python
def value( self, node, parent=None ): """Return value used to compare size of this node""" # this is the *weighted* size/contribution of the node try: return node['contribution'] except KeyError, err: contribution = int(node.get('totsize',0)/float( len(node.get('...
[ "def", "value", "(", "self", ",", "node", ",", "parent", "=", "None", ")", ":", "# this is the *weighted* size/contribution of the node ", "try", ":", "return", "node", "[", "'contribution'", "]", "except", "KeyError", ",", "err", ":", "contribution", "=", "int"...
Return value used to compare size of this node
[ "Return", "value", "used", "to", "compare", "size", "of", "this", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py#L51-L59
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py
MeliaeAdapter.label
def label( self, node ): """Return textual description of this node""" result = [] if node.get('type'): result.append( node['type'] ) if node.get('name' ): result.append( node['name'] ) elif node.get('value') is not None: result.append( unicode...
python
def label( self, node ): """Return textual description of this node""" result = [] if node.get('type'): result.append( node['type'] ) if node.get('name' ): result.append( node['name'] ) elif node.get('value') is not None: result.append( unicode...
[ "def", "label", "(", "self", ",", "node", ")", ":", "result", "=", "[", "]", "if", "node", ".", "get", "(", "'type'", ")", ":", "result", ".", "append", "(", "node", "[", "'type'", "]", ")", "if", "node", ".", "get", "(", "'name'", ")", ":", ...
Return textual description of this node
[ "Return", "textual", "description", "of", "this", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py#L60-L78
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py
MeliaeAdapter.parents
def parents( self, node ): """Retrieve/calculate the set of parents for the given node""" if 'index' in node: index = node['index']() parents = list(meliaeloader.children( node, index, 'parents' )) return parents return []
python
def parents( self, node ): """Retrieve/calculate the set of parents for the given node""" if 'index' in node: index = node['index']() parents = list(meliaeloader.children( node, index, 'parents' )) return parents return []
[ "def", "parents", "(", "self", ",", "node", ")", ":", "if", "'index'", "in", "node", ":", "index", "=", "node", "[", "'index'", "]", "(", ")", "parents", "=", "list", "(", "meliaeloader", ".", "children", "(", "node", ",", "index", ",", "'parents'", ...
Retrieve/calculate the set of parents for the given node
[ "Retrieve", "/", "calculate", "the", "set", "of", "parents", "for", "the", "given", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py#L86-L92
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py
MeliaeAdapter.best_parent
def best_parent( self, node, tree_type=None ): """Choose the best parent for a given node""" parents = self.parents(node) selected_parent = None if node['type'] == 'type': module = ".".join( node['name'].split( '.' )[:-1] ) if module: for mod in pa...
python
def best_parent( self, node, tree_type=None ): """Choose the best parent for a given node""" parents = self.parents(node) selected_parent = None if node['type'] == 'type': module = ".".join( node['name'].split( '.' )[:-1] ) if module: for mod in pa...
[ "def", "best_parent", "(", "self", ",", "node", ",", "tree_type", "=", "None", ")", ":", "parents", "=", "self", ".", "parents", "(", "node", ")", "selected_parent", "=", "None", "if", "node", "[", "'type'", "]", "==", "'type'", ":", "module", "=", "...
Choose the best parent for a given node
[ "Choose", "the", "best", "parent", "for", "a", "given", "node" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/meliaeadapter.py#L93-L106
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/python_bindings/gooey_decorator.py
Gooey
def Gooey(f=None, advanced=True, language='english', show_config=True, program_name=None, program_description=None, default_size=(610, 530), required_cols=2, optional_cols=2, dump_build_config=False, monospace_display=Fa...
python
def Gooey(f=None, advanced=True, language='english', show_config=True, program_name=None, program_description=None, default_size=(610, 530), required_cols=2, optional_cols=2, dump_build_config=False, monospace_display=Fa...
[ "def", "Gooey", "(", "f", "=", "None", ",", "advanced", "=", "True", ",", "language", "=", "'english'", ",", "show_config", "=", "True", ",", "program_name", "=", "None", ",", "program_description", "=", "None", ",", "default_size", "=", "(", "610", ",",...
Decorator for client code's main function. Serializes argparse data to JSON for use with the Gooey front end
[ "Decorator", "for", "client", "code", "s", "main", "function", ".", "Serializes", "argparse", "data", "to", "JSON", "for", "use", "with", "the", "Gooey", "front", "end" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/python_bindings/gooey_decorator.py#L25-L74
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/gui/component_builder.py
build_components
def build_components(widget_list): ''' :param widget_list: list of dicts containing widget info (name, type, etc..) :return: ComponentList Converts the Json widget information into concrete wx Widget types ''' required_args, optional_args = partition(widget_list, is_required) checkbox_args, general_args...
python
def build_components(widget_list): ''' :param widget_list: list of dicts containing widget info (name, type, etc..) :return: ComponentList Converts the Json widget information into concrete wx Widget types ''' required_args, optional_args = partition(widget_list, is_required) checkbox_args, general_args...
[ "def", "build_components", "(", "widget_list", ")", ":", "required_args", ",", "optional_args", "=", "partition", "(", "widget_list", ",", "is_required", ")", "checkbox_args", ",", "general_args", "=", "partition", "(", "map", "(", "build_widget", ",", "optional_a...
:param widget_list: list of dicts containing widget info (name, type, etc..) :return: ComponentList Converts the Json widget information into concrete wx Widget types
[ ":", "param", "widget_list", ":", "list", "of", "dicts", "containing", "widget", "info", "(", "name", "type", "etc", "..", ")", ":", "return", ":", "ComponentList" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/component_builder.py#L10-L23
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
_merge_asized
def _merge_asized(base, other, level=0): """ Merge **Asized** instances `base` and `other` into `base`. """ ref2key = lambda ref: ref.name.split(':')[0] base.size += other.size base.flat += other.flat if level > 0: base.name = ref2key(base) # Add refs from other to base. Any new ...
python
def _merge_asized(base, other, level=0): """ Merge **Asized** instances `base` and `other` into `base`. """ ref2key = lambda ref: ref.name.split(':')[0] base.size += other.size base.flat += other.flat if level > 0: base.name = ref2key(base) # Add refs from other to base. Any new ...
[ "def", "_merge_asized", "(", "base", ",", "other", ",", "level", "=", "0", ")", ":", "ref2key", "=", "lambda", "ref", ":", "ref", ".", "name", ".", "split", "(", "':'", ")", "[", "0", "]", "base", ".", "size", "+=", "other", ".", "size", "base", ...
Merge **Asized** instances `base` and `other` into `base`.
[ "Merge", "**", "Asized", "**", "instances", "base", "and", "other", "into", "base", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L17-L38
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
_merge_objects
def _merge_objects(tref, merged, obj): """ Merge the snapshot size information of multiple tracked objects. The tracked object `obj` is scanned for size information at time `tref`. The sizes are merged into **Asized** instance `merged`. """ size = None for (timestamp, tsize) in obj.snapshot...
python
def _merge_objects(tref, merged, obj): """ Merge the snapshot size information of multiple tracked objects. The tracked object `obj` is scanned for size information at time `tref`. The sizes are merged into **Asized** instance `merged`. """ size = None for (timestamp, tsize) in obj.snapshot...
[ "def", "_merge_objects", "(", "tref", ",", "merged", ",", "obj", ")", ":", "size", "=", "None", "for", "(", "timestamp", ",", "tsize", ")", "in", "obj", ".", "snapshots", ":", "if", "timestamp", "==", "tref", ":", "size", "=", "tsize", "if", "size", ...
Merge the snapshot size information of multiple tracked objects. The tracked object `obj` is scanned for size information at time `tref`. The sizes are merged into **Asized** instance `merged`.
[ "Merge", "the", "snapshot", "size", "information", "of", "multiple", "tracked", "objects", ".", "The", "tracked", "object", "obj", "is", "scanned", "for", "size", "information", "at", "time", "tref", ".", "The", "sizes", "are", "merged", "into", "**", "Asize...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L41-L52
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
_format_trace
def _format_trace(trace): """ Convert the (stripped) stack-trace to a nice readable format. The stack trace `trace` is a list of frame records as returned by **inspect.stack** but without the frame objects. Returns a string. """ lines = [] for fname, lineno, func, src, _ in trace: ...
python
def _format_trace(trace): """ Convert the (stripped) stack-trace to a nice readable format. The stack trace `trace` is a list of frame records as returned by **inspect.stack** but without the frame objects. Returns a string. """ lines = [] for fname, lineno, func, src, _ in trace: ...
[ "def", "_format_trace", "(", "trace", ")", ":", "lines", "=", "[", "]", "for", "fname", ",", "lineno", ",", "func", ",", "src", ",", "_", "in", "trace", ":", "if", "src", ":", "for", "line", "in", "src", ":", "lines", ".", "append", "(", "' '"...
Convert the (stripped) stack-trace to a nice readable format. The stack trace `trace` is a list of frame records as returned by **inspect.stack** but without the frame objects. Returns a string.
[ "Convert", "the", "(", "stripped", ")", "stack", "-", "trace", "to", "a", "nice", "readable", "format", ".", "The", "stack", "trace", "trace", "is", "a", "list", "of", "frame", "records", "as", "returned", "by", "**", "inspect", ".", "stack", "**", "bu...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L55-L68
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
Stats.load_stats
def load_stats(self, fdump): """ Load the data from a dump file. The argument `fdump` can be either a filename or an open file object that requires read access. """ if isinstance(fdump, type('')): fdump = open(fdump, 'rb') self.index = pickle.load(fdum...
python
def load_stats(self, fdump): """ Load the data from a dump file. The argument `fdump` can be either a filename or an open file object that requires read access. """ if isinstance(fdump, type('')): fdump = open(fdump, 'rb') self.index = pickle.load(fdum...
[ "def", "load_stats", "(", "self", ",", "fdump", ")", ":", "if", "isinstance", "(", "fdump", ",", "type", "(", "''", ")", ")", ":", "fdump", "=", "open", "(", "fdump", ",", "'rb'", ")", "self", ".", "index", "=", "pickle", ".", "load", "(", "fdump...
Load the data from a dump file. The argument `fdump` can be either a filename or an open file object that requires read access.
[ "Load", "the", "data", "from", "a", "dump", "file", ".", "The", "argument", "fdump", "can", "be", "either", "a", "filename", "or", "an", "open", "file", "object", "that", "requires", "read", "access", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L102-L112
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
Stats.dump_stats
def dump_stats(self, fdump, close=True): """ Dump the logged data to a file. The argument `file` can be either a filename or an open file object that requires write access. `close` controls if the file is closed before leaving this method (the default behaviour). """ ...
python
def dump_stats(self, fdump, close=True): """ Dump the logged data to a file. The argument `file` can be either a filename or an open file object that requires write access. `close` controls if the file is closed before leaving this method (the default behaviour). """ ...
[ "def", "dump_stats", "(", "self", ",", "fdump", ",", "close", "=", "True", ")", ":", "if", "self", ".", "tracker", ":", "self", ".", "tracker", ".", "stop_periodic_snapshots", "(", ")", "if", "isinstance", "(", "fdump", ",", "type", "(", "''", ")", "...
Dump the logged data to a file. The argument `file` can be either a filename or an open file object that requires write access. `close` controls if the file is closed before leaving this method (the default behaviour).
[ "Dump", "the", "logged", "data", "to", "a", "file", ".", "The", "argument", "file", "can", "be", "either", "a", "filename", "or", "an", "open", "file", "object", "that", "requires", "write", "access", ".", "close", "controls", "if", "the", "file", "is", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L115-L130
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
Stats._init_sort
def _init_sort(self): """ Prepare the data to be sorted. If not yet sorted, import all tracked objects from the tracked index. Extend the tracking information by implicit information to make sorting easier (DSU pattern). """ if not self.sorted: # Ident...
python
def _init_sort(self): """ Prepare the data to be sorted. If not yet sorted, import all tracked objects from the tracked index. Extend the tracking information by implicit information to make sorting easier (DSU pattern). """ if not self.sorted: # Ident...
[ "def", "_init_sort", "(", "self", ")", ":", "if", "not", "self", ".", "sorted", ":", "# Identify the snapshot that tracked the largest amount of memory.", "tmax", "=", "None", "maxsize", "=", "0", "for", "snapshot", "in", "self", ".", "snapshots", ":", "if", "sn...
Prepare the data to be sorted. If not yet sorted, import all tracked objects from the tracked index. Extend the tracking information by implicit information to make sorting easier (DSU pattern).
[ "Prepare", "the", "data", "to", "be", "sorted", ".", "If", "not", "yet", "sorted", "import", "all", "tracked", "objects", "from", "the", "tracked", "index", ".", "Extend", "the", "tracking", "information", "by", "implicit", "information", "to", "make", "sort...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L133-L152
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
Stats.sort_stats
def sort_stats(self, *args): """ Sort the tracked objects according to the supplied criteria. The argument is a string identifying the basis of a sort (example: 'size' or 'classname'). When more than one key is provided, then additional keys are used as secondary criteria when th...
python
def sort_stats(self, *args): """ Sort the tracked objects according to the supplied criteria. The argument is a string identifying the basis of a sort (example: 'size' or 'classname'). When more than one key is provided, then additional keys are used as secondary criteria when th...
[ "def", "sort_stats", "(", "self", ",", "*", "args", ")", ":", "criteria", "=", "(", "'classname'", ",", "'tsize'", ",", "'birth'", ",", "'death'", ",", "'name'", ",", "'repr'", ",", "'size'", ")", "if", "not", "set", "(", "criteria", ")", ".", "issup...
Sort the tracked objects according to the supplied criteria. The argument is a string identifying the basis of a sort (example: 'size' or 'classname'). When more than one key is provided, then additional keys are used as secondary criteria when there is equality in all keys selected befo...
[ "Sort", "the", "tracked", "objects", "according", "to", "the", "supplied", "criteria", ".", "The", "argument", "is", "a", "string", "identifying", "the", "basis", "of", "a", "sort", "(", "example", ":", "size", "or", "classname", ")", ".", "When", "more", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L155-L213
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
Stats.annotate_snapshot
def annotate_snapshot(self, snapshot): """ Store additional statistical data in snapshot. """ if hasattr(snapshot, 'classes'): return snapshot.classes = {} for classname in list(self.index.keys()): total = 0 active = 0 mer...
python
def annotate_snapshot(self, snapshot): """ Store additional statistical data in snapshot. """ if hasattr(snapshot, 'classes'): return snapshot.classes = {} for classname in list(self.index.keys()): total = 0 active = 0 mer...
[ "def", "annotate_snapshot", "(", "self", ",", "snapshot", ")", ":", "if", "hasattr", "(", "snapshot", ",", "'classes'", ")", ":", "return", "snapshot", ".", "classes", "=", "{", "}", "for", "classname", "in", "list", "(", "self", ".", "index", ".", "ke...
Store additional statistical data in snapshot.
[ "Store", "additional", "statistical", "data", "in", "snapshot", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L233-L266
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
ConsoleStats._print_refs
def _print_refs(self, refs, total, prefix=' ', level=1, minsize=0, minpct=0.1): """ Print individual referents recursively. """ lrefs = list(refs) lrefs.sort(key=lambda x: x.size) lrefs.reverse() for ref in lrefs: if ref.size > m...
python
def _print_refs(self, refs, total, prefix=' ', level=1, minsize=0, minpct=0.1): """ Print individual referents recursively. """ lrefs = list(refs) lrefs.sort(key=lambda x: x.size) lrefs.reverse() for ref in lrefs: if ref.size > m...
[ "def", "_print_refs", "(", "self", ",", "refs", ",", "total", ",", "prefix", "=", "' '", ",", "level", "=", "1", ",", "minsize", "=", "0", ",", "minpct", "=", "0.1", ")", ":", "lrefs", "=", "list", "(", "refs", ")", "lrefs", ".", "sort", "(", ...
Print individual referents recursively.
[ "Print", "individual", "referents", "recursively", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L280-L297
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
ConsoleStats.print_object
def print_object(self, tobj): """ Print the gathered information of object `tobj` in human-readable format. """ if tobj.death: self.stream.write('%-32s ( free ) %-35s\n' % ( trunc(tobj.name, 32, left=1), trunc(tobj.repr, 35))) else: self....
python
def print_object(self, tobj): """ Print the gathered information of object `tobj` in human-readable format. """ if tobj.death: self.stream.write('%-32s ( free ) %-35s\n' % ( trunc(tobj.name, 32, left=1), trunc(tobj.repr, 35))) else: self....
[ "def", "print_object", "(", "self", ",", "tobj", ")", ":", "if", "tobj", ".", "death", ":", "self", ".", "stream", ".", "write", "(", "'%-32s ( free ) %-35s\\n'", "%", "(", "trunc", "(", "tobj", ".", "name", ",", "32", ",", "left", "=", "1", ")", ...
Print the gathered information of object `tobj` in human-readable format.
[ "Print", "the", "gathered", "information", "of", "object", "tobj", "in", "human", "-", "readable", "format", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L300-L323
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
ConsoleStats.print_stats
def print_stats(self, clsname=None, limit=1.0): """ Write tracked objects to stdout. The output can be filtered and pruned. Only objects are printed whose classname contain the substring supplied by the `clsname` argument. The output can be pruned by passing a `limit` value. ...
python
def print_stats(self, clsname=None, limit=1.0): """ Write tracked objects to stdout. The output can be filtered and pruned. Only objects are printed whose classname contain the substring supplied by the `clsname` argument. The output can be pruned by passing a `limit` value. ...
[ "def", "print_stats", "(", "self", ",", "clsname", "=", "None", ",", "limit", "=", "1.0", ")", ":", "if", "self", ".", "tracker", ":", "self", ".", "tracker", ".", "stop_periodic_snapshots", "(", ")", "if", "not", "self", ".", "sorted", ":", "self", ...
Write tracked objects to stdout. The output can be filtered and pruned. Only objects are printed whose classname contain the substring supplied by the `clsname` argument. The output can be pruned by passing a `limit` value. :param clsname: Only print objects whose classname contain t...
[ "Write", "tracked", "objects", "to", "stdout", ".", "The", "output", "can", "be", "filtered", "and", "pruned", ".", "Only", "objects", "are", "printed", "whose", "classname", "contain", "the", "substring", "supplied", "by", "the", "clsname", "argument", ".", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L326-L357
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
ConsoleStats.print_summary
def print_summary(self): """ Print per-class summary for each snapshot. """ # Emit class summaries for each snapshot classlist = self.tracked_classes fobj = self.stream fobj.write('---- SUMMARY '+'-'*66+'\n') for snapshot in self.snapshots: s...
python
def print_summary(self): """ Print per-class summary for each snapshot. """ # Emit class summaries for each snapshot classlist = self.tracked_classes fobj = self.stream fobj.write('---- SUMMARY '+'-'*66+'\n') for snapshot in self.snapshots: s...
[ "def", "print_summary", "(", "self", ")", ":", "# Emit class summaries for each snapshot", "classlist", "=", "self", ".", "tracked_classes", "fobj", "=", "self", ".", "stream", "fobj", ".", "write", "(", "'---- SUMMARY '", "+", "'-'", "*", "66", "+", "'\\n'", ...
Print per-class summary for each snapshot.
[ "Print", "per", "-", "class", "summary", "for", "each", "snapshot", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L360-L388
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats._print_refs
def _print_refs(self, fobj, refs, total, level=1, minsize=0, minpct=0.1): """ Print individual referents recursively. """ lrefs = list(refs) lrefs.sort(key=lambda x: x.size) lrefs.reverse() if level == 1: fobj.write('<table>\n') for ref in lref...
python
def _print_refs(self, fobj, refs, total, level=1, minsize=0, minpct=0.1): """ Print individual referents recursively. """ lrefs = list(refs) lrefs.sort(key=lambda x: x.size) lrefs.reverse() if level == 1: fobj.write('<table>\n') for ref in lref...
[ "def", "_print_refs", "(", "self", ",", "fobj", ",", "refs", ",", "total", ",", "level", "=", "1", ",", "minsize", "=", "0", ",", "minpct", "=", "0.1", ")", ":", "lrefs", "=", "list", "(", "refs", ")", "lrefs", ".", "sort", "(", "key", "=", "la...
Print individual referents recursively.
[ "Print", "individual", "referents", "recursively", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L434-L452
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.print_class_details
def print_class_details(self, fname, classname): """ Print detailed statistics and instances for the class `classname`. All data will be written to the file `fname`. """ fobj = open(fname, "w") fobj.write(self.header % (classname, self.style)) fobj.write("<h1>%s<...
python
def print_class_details(self, fname, classname): """ Print detailed statistics and instances for the class `classname`. All data will be written to the file `fname`. """ fobj = open(fname, "w") fobj.write(self.header % (classname, self.style)) fobj.write("<h1>%s<...
[ "def", "print_class_details", "(", "self", ",", "fname", ",", "classname", ")", ":", "fobj", "=", "open", "(", "fname", ",", "\"w\"", ")", "fobj", ".", "write", "(", "self", ".", "header", "%", "(", "classname", ",", "self", ".", "style", ")", ")", ...
Print detailed statistics and instances for the class `classname`. All data will be written to the file `fname`.
[ "Print", "detailed", "statistics", "and", "instances", "for", "the", "class", "classname", ".", "All", "data", "will", "be", "written", "to", "the", "file", "fname", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L460-L515
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.relative_path
def relative_path(self, filepath, basepath=None): """ Convert the filepath path to a relative path against basepath. By default basepath is self.basedir. """ if basepath is None: basepath = self.basedir if not basepath: return filepath if f...
python
def relative_path(self, filepath, basepath=None): """ Convert the filepath path to a relative path against basepath. By default basepath is self.basedir. """ if basepath is None: basepath = self.basedir if not basepath: return filepath if f...
[ "def", "relative_path", "(", "self", ",", "filepath", ",", "basepath", "=", "None", ")", ":", "if", "basepath", "is", "None", ":", "basepath", "=", "self", ".", "basedir", "if", "not", "basepath", ":", "return", "filepath", "if", "filepath", ".", "starts...
Convert the filepath path to a relative path against basepath. By default basepath is self.basedir.
[ "Convert", "the", "filepath", "path", "to", "a", "relative", "path", "against", "basepath", ".", "By", "default", "basepath", "is", "self", ".", "basedir", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L537-L550
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.create_title_page
def create_title_page(self, filename, title=''): """ Output the title page. """ fobj = open(filename, "w") fobj.write(self.header % (title, self.style)) fobj.write("<h1>%s</h1>\n" % title) fobj.write("<h2>Memory distribution over time</h2>\n") fobj.write(...
python
def create_title_page(self, filename, title=''): """ Output the title page. """ fobj = open(filename, "w") fobj.write(self.header % (title, self.style)) fobj.write("<h1>%s</h1>\n" % title) fobj.write("<h2>Memory distribution over time</h2>\n") fobj.write(...
[ "def", "create_title_page", "(", "self", ",", "filename", ",", "title", "=", "''", ")", ":", "fobj", "=", "open", "(", "filename", ",", "\"w\"", ")", "fobj", ".", "write", "(", "self", ".", "header", "%", "(", "title", ",", "self", ".", "style", ")...
Output the title page.
[ "Output", "the", "title", "page", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L552-L601
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.create_lifetime_chart
def create_lifetime_chart(self, classname, filename=''): """ Create chart that depicts the lifetime of the instance registered with `classname`. The output is written to `filename`. """ try: from pylab import figure, title, xlabel, ylabel, plot, savefig except...
python
def create_lifetime_chart(self, classname, filename=''): """ Create chart that depicts the lifetime of the instance registered with `classname`. The output is written to `filename`. """ try: from pylab import figure, title, xlabel, ylabel, plot, savefig except...
[ "def", "create_lifetime_chart", "(", "self", ",", "classname", ",", "filename", "=", "''", ")", ":", "try", ":", "from", "pylab", "import", "figure", ",", "title", ",", "xlabel", ",", "ylabel", ",", "plot", ",", "savefig", "except", "ImportError", ":", "...
Create chart that depicts the lifetime of the instance registered with `classname`. The output is written to `filename`.
[ "Create", "chart", "that", "depicts", "the", "lifetime", "of", "the", "instance", "registered", "with", "classname", ".", "The", "output", "is", "written", "to", "filename", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L603-L634
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.create_snapshot_chart
def create_snapshot_chart(self, filename=''): """ Create chart that depicts the memory allocation over time apportioned to the tracked classes. """ try: from pylab import figure, title, xlabel, ylabel, plot, fill, legend, savefig import matplotlib.mlab as ...
python
def create_snapshot_chart(self, filename=''): """ Create chart that depicts the memory allocation over time apportioned to the tracked classes. """ try: from pylab import figure, title, xlabel, ylabel, plot, fill, legend, savefig import matplotlib.mlab as ...
[ "def", "create_snapshot_chart", "(", "self", ",", "filename", "=", "''", ")", ":", "try", ":", "from", "pylab", "import", "figure", ",", "title", ",", "xlabel", ",", "ylabel", ",", "plot", ",", "fill", ",", "legend", ",", "savefig", "import", "matplotlib...
Create chart that depicts the memory allocation over time apportioned to the tracked classes.
[ "Create", "chart", "that", "depicts", "the", "memory", "allocation", "over", "time", "apportioned", "to", "the", "tracked", "classes", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L636-L678
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.create_pie_chart
def create_pie_chart(self, snapshot, filename=''): """ Create a pie chart that depicts the distribution of the allocated memory for a given `snapshot`. The chart is saved to `filename`. """ try: from pylab import figure, title, pie, axes, savefig from pyla...
python
def create_pie_chart(self, snapshot, filename=''): """ Create a pie chart that depicts the distribution of the allocated memory for a given `snapshot`. The chart is saved to `filename`. """ try: from pylab import figure, title, pie, axes, savefig from pyla...
[ "def", "create_pie_chart", "(", "self", ",", "snapshot", ",", "filename", "=", "''", ")", ":", "try", ":", "from", "pylab", "import", "figure", ",", "title", ",", "pie", ",", "axes", ",", "savefig", "from", "pylab", "import", "sum", "as", "pylab_sum", ...
Create a pie chart that depicts the distribution of the allocated memory for a given `snapshot`. The chart is saved to `filename`.
[ "Create", "a", "pie", "chart", "that", "depicts", "the", "distribution", "of", "the", "allocated", "memory", "for", "a", "given", "snapshot", ".", "The", "chart", "is", "saved", "to", "filename", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L680-L711
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py
HtmlStats.create_html
def create_html(self, fname, title="ClassTracker Statistics"): """ Create HTML page `fname` and additional files in a directory derived from `fname`. """ # Create a folder to store the charts and additional HTML files. self.basedir = os.path.dirname(os.path.abspath(fname)...
python
def create_html(self, fname, title="ClassTracker Statistics"): """ Create HTML page `fname` and additional files in a directory derived from `fname`. """ # Create a folder to store the charts and additional HTML files. self.basedir = os.path.dirname(os.path.abspath(fname)...
[ "def", "create_html", "(", "self", ",", "fname", ",", "title", "=", "\"ClassTracker Statistics\"", ")", ":", "# Create a folder to store the charts and additional HTML files.", "self", ".", "basedir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ...
Create HTML page `fname` and additional files in a directory derived from `fname`.
[ "Create", "HTML", "page", "fname", "and", "additional", "files", "in", "a", "directory", "derived", "from", "fname", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/classtracker_stats.py#L713-L750
lrq3000/pyFileFixity
pyFileFixity/lib/pathlib2.py
_Selector.select_from
def select_from(self, parent_path): """Iterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.""" path_cls = type(parent_path) is_dir = path_cls.is_dir exists = path_cls.exists listdir = parent_path._accessor.listdir ...
python
def select_from(self, parent_path): """Iterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.""" path_cls = type(parent_path) is_dir = path_cls.is_dir exists = path_cls.exists listdir = parent_path._accessor.listdir ...
[ "def", "select_from", "(", "self", ",", "parent_path", ")", ":", "path_cls", "=", "type", "(", "parent_path", ")", "is_dir", "=", "path_cls", ".", "is_dir", "exists", "=", "path_cls", ".", "exists", "listdir", "=", "parent_path", ".", "_accessor", ".", "li...
Iterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.
[ "Iterate", "over", "all", "child", "paths", "of", "parent_path", "matched", "by", "this", "selector", ".", "This", "can", "contain", "parent_path", "itself", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/pathlib2.py#L595-L602
lrq3000/pyFileFixity
pyFileFixity/lib/pathlib2.py
PurePath.relative_to
def relative_to(self, *other): """Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError. """ # For the purpose of this method, drive and root are considere...
python
def relative_to(self, *other): """Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError. """ # For the purpose of this method, drive and root are considere...
[ "def", "relative_to", "(", "self", ",", "*", "other", ")", ":", "# For the purpose of this method, drive and root are considered", "# separate parts, i.e.:", "# Path('c:/').relative_to('c:') gives Path('/')", "# Path('c:/').relative_to('/') raise ValueError", "if", "not", "other...
Return the relative path to another path identified by the passed arguments. If the operation is not possible (because this is not a subpath of the other path), raise ValueError.
[ "Return", "the", "relative", "path", "to", "another", "path", "identified", "by", "the", "passed", "arguments", ".", "If", "the", "operation", "is", "not", "possible", "(", "because", "this", "is", "not", "a", "subpath", "of", "the", "other", "path", ")", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/pathlib2.py#L958-L988
lrq3000/pyFileFixity
pyFileFixity/lib/pathlib2.py
Path.glob
def glob(self, pattern): """Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern. """ pattern = self._flavour.casefold(pattern) drv, root, pattern_parts = self._flavour.parse_parts((pattern,)) if drv or roo...
python
def glob(self, pattern): """Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern. """ pattern = self._flavour.casefold(pattern) drv, root, pattern_parts = self._flavour.parse_parts((pattern,)) if drv or roo...
[ "def", "glob", "(", "self", ",", "pattern", ")", ":", "pattern", "=", "self", ".", "_flavour", ".", "casefold", "(", "pattern", ")", "drv", ",", "root", ",", "pattern_parts", "=", "self", ".", "_flavour", ".", "parse_parts", "(", "(", "pattern", ",", ...
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern.
[ "Iterate", "over", "this", "subtree", "and", "yield", "all", "existing", "files", "(", "of", "any", "kind", "including", "directories", ")", "matching", "the", "given", "pattern", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/pathlib2.py#L1190-L1200
lrq3000/pyFileFixity
pyFileFixity/lib/pathlib2.py
Path.write_bytes
def write_bytes(self, data): """ Open the file in bytes mode, write to it, and close the file. """ if not isinstance(data, six.binary_type): raise TypeError( 'data must be %s, not %s' % (six.binary_type.__class__.__name__, data.__class__.__name...
python
def write_bytes(self, data): """ Open the file in bytes mode, write to it, and close the file. """ if not isinstance(data, six.binary_type): raise TypeError( 'data must be %s, not %s' % (six.binary_type.__class__.__name__, data.__class__.__name...
[ "def", "write_bytes", "(", "self", ",", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "six", ".", "binary_type", ")", ":", "raise", "TypeError", "(", "'data must be %s, not %s'", "%", "(", "six", ".", "binary_type", ".", "__class__", ".", ...
Open the file in bytes mode, write to it, and close the file.
[ "Open", "the", "file", "in", "bytes", "mode", "write", "to", "it", "and", "close", "the", "file", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/pathlib2.py#L1303-L1312
lrq3000/pyFileFixity
pyFileFixity/lib/pathlib2.py
Path.write_text
def write_text(self, data, encoding=None, errors=None): """ Open the file in text mode, write to it, and close the file. """ if not isinstance(data, six.text_type): raise TypeError( 'data must be %s, not %s' % (six.text_type.__class__.__name__,...
python
def write_text(self, data, encoding=None, errors=None): """ Open the file in text mode, write to it, and close the file. """ if not isinstance(data, six.text_type): raise TypeError( 'data must be %s, not %s' % (six.text_type.__class__.__name__,...
[ "def", "write_text", "(", "self", ",", "data", ",", "encoding", "=", "None", ",", "errors", "=", "None", ")", ":", "if", "not", "isinstance", "(", "data", ",", "six", ".", "text_type", ")", ":", "raise", "TypeError", "(", "'data must be %s, not %s'", "%"...
Open the file in text mode, write to it, and close the file.
[ "Open", "the", "file", "in", "text", "mode", "write", "to", "it", "and", "close", "the", "file", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/pathlib2.py#L1314-L1323
lrq3000/pyFileFixity
pyFileFixity/replication_repair.py
relpath_posix
def relpath_posix(recwalk_result, pardir, fromwinpath=False): ''' Helper function to convert all paths to relative posix like paths (to ease comparison) ''' return recwalk_result[0], path2unix(os.path.join(os.path.relpath(recwalk_result[0], pardir),recwalk_result[1]), nojoin=True, fromwinpath=fromwinpath)
python
def relpath_posix(recwalk_result, pardir, fromwinpath=False): ''' Helper function to convert all paths to relative posix like paths (to ease comparison) ''' return recwalk_result[0], path2unix(os.path.join(os.path.relpath(recwalk_result[0], pardir),recwalk_result[1]), nojoin=True, fromwinpath=fromwinpath)
[ "def", "relpath_posix", "(", "recwalk_result", ",", "pardir", ",", "fromwinpath", "=", "False", ")", ":", "return", "recwalk_result", "[", "0", "]", ",", "path2unix", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "relpath", "(", "re...
Helper function to convert all paths to relative posix like paths (to ease comparison)
[ "Helper", "function", "to", "convert", "all", "paths", "to", "relative", "posix", "like", "paths", "(", "to", "ease", "comparison", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L62-L64
lrq3000/pyFileFixity
pyFileFixity/replication_repair.py
sort_dict_of_paths
def sort_dict_of_paths(d): """ Sort a dict containing paths parts (ie, paths divided in parts and stored as a list). Top paths will be given precedence over deeper paths. """ # Find the path that is the deepest, and count the number of parts max_rec = max(len(x) if x else 0 for x in d.values()) # Pad ot...
python
def sort_dict_of_paths(d): """ Sort a dict containing paths parts (ie, paths divided in parts and stored as a list). Top paths will be given precedence over deeper paths. """ # Find the path that is the deepest, and count the number of parts max_rec = max(len(x) if x else 0 for x in d.values()) # Pad ot...
[ "def", "sort_dict_of_paths", "(", "d", ")", ":", "# Find the path that is the deepest, and count the number of parts", "max_rec", "=", "max", "(", "len", "(", "x", ")", "if", "x", "else", "0", "for", "x", "in", "d", ".", "values", "(", ")", ")", "# Pad other p...
Sort a dict containing paths parts (ie, paths divided in parts and stored as a list). Top paths will be given precedence over deeper paths.
[ "Sort", "a", "dict", "containing", "paths", "parts", "(", "ie", "paths", "divided", "in", "parts", "and", "stored", "as", "a", "list", ")", ".", "Top", "paths", "will", "be", "given", "precedence", "over", "deeper", "paths", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L69-L79
lrq3000/pyFileFixity
pyFileFixity/replication_repair.py
sort_group
def sort_group(d, return_only_first=False): ''' Sort a dictionary of relative paths and cluster equal paths together at the same time ''' # First, sort the paths in order (this must be a couple: (parent_dir, filename), so that there's no ambiguity because else a file at root will be considered as being after a ...
python
def sort_group(d, return_only_first=False): ''' Sort a dictionary of relative paths and cluster equal paths together at the same time ''' # First, sort the paths in order (this must be a couple: (parent_dir, filename), so that there's no ambiguity because else a file at root will be considered as being after a ...
[ "def", "sort_group", "(", "d", ",", "return_only_first", "=", "False", ")", ":", "# First, sort the paths in order (this must be a couple: (parent_dir, filename), so that there's no ambiguity because else a file at root will be considered as being after a folder/file since the ordering is done a...
Sort a dictionary of relative paths and cluster equal paths together at the same time
[ "Sort", "a", "dictionary", "of", "relative", "paths", "and", "cluster", "equal", "paths", "together", "at", "the", "same", "time" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L81-L110
lrq3000/pyFileFixity
pyFileFixity/replication_repair.py
majority_vote_byte_scan
def majority_vote_byte_scan(relfilepath, fileslist, outpath, blocksize=65535, default_char_null=False): '''Takes a list of files in string format representing the same data, and disambiguate by majority vote: for position in string, if the character is not the same accross all entries, we keep the major one. If non...
python
def majority_vote_byte_scan(relfilepath, fileslist, outpath, blocksize=65535, default_char_null=False): '''Takes a list of files in string format representing the same data, and disambiguate by majority vote: for position in string, if the character is not the same accross all entries, we keep the major one. If non...
[ "def", "majority_vote_byte_scan", "(", "relfilepath", ",", "fileslist", ",", "outpath", ",", "blocksize", "=", "65535", ",", "default_char_null", "=", "False", ")", ":", "# The idea of replication combined with ECC was a bit inspired by this paper: Friedman, Roy, Yoav Kantor, and...
Takes a list of files in string format representing the same data, and disambiguate by majority vote: for position in string, if the character is not the same accross all entries, we keep the major one. If none, it will be replaced by a null byte (because we can't know if any of the entries are correct about this chara...
[ "Takes", "a", "list", "of", "files", "in", "string", "format", "representing", "the", "same", "data", "and", "disambiguate", "by", "majority", "vote", ":", "for", "position", "in", "string", "if", "the", "character", "is", "not", "the", "same", "accross", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L112-L230
lrq3000/pyFileFixity
pyFileFixity/replication_repair.py
synchronize_files
def synchronize_files(inputpaths, outpath, database=None, tqdm_bar=None, report_file=None, ptee=None, verbose=False): ''' Main function to synchronize files contents by majority vote The main job of this function is to walk through the input folders and align the files, so that we can compare every files across...
python
def synchronize_files(inputpaths, outpath, database=None, tqdm_bar=None, report_file=None, ptee=None, verbose=False): ''' Main function to synchronize files contents by majority vote The main job of this function is to walk through the input folders and align the files, so that we can compare every files across...
[ "def", "synchronize_files", "(", "inputpaths", ",", "outpath", ",", "database", "=", "None", ",", "tqdm_bar", "=", "None", ",", "report_file", "=", "None", ",", "ptee", "=", "None", ",", "verbose", "=", "False", ")", ":", "# (Generator) Files Synchronization A...
Main function to synchronize files contents by majority vote The main job of this function is to walk through the input folders and align the files, so that we can compare every files across every folders, one by one. The whole trick here is to align files, so that we don't need to memorize all the files in mem...
[ "Main", "function", "to", "synchronize", "files", "contents", "by", "majority", "vote", "The", "main", "job", "of", "this", "function", "is", "to", "walk", "through", "the", "input", "folders", "and", "align", "the", "files", "so", "that", "we", "can", "co...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/replication_repair.py#L232-L394
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
RefBrowser.get_tree
def get_tree(self): """Get a tree of referrers of the root object.""" self.ignore.append(inspect.currentframe()) return self._get_tree(self.root, self.maxdepth)
python
def get_tree(self): """Get a tree of referrers of the root object.""" self.ignore.append(inspect.currentframe()) return self._get_tree(self.root, self.maxdepth)
[ "def", "get_tree", "(", "self", ")", ":", "self", ".", "ignore", ".", "append", "(", "inspect", ".", "currentframe", "(", ")", ")", "return", "self", ".", "_get_tree", "(", "self", ".", "root", ",", "self", ".", "maxdepth", ")" ]
Get a tree of referrers of the root object.
[ "Get", "a", "tree", "of", "referrers", "of", "the", "root", "object", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L86-L89
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
RefBrowser._get_tree
def _get_tree(self, root, maxdepth): """Workhorse of the get_tree implementation. This is an recursive method which is why we have a wrapper method. root is the current root object of the tree which should be returned. Note that root is not of the type _Node. maxdepth defines ho...
python
def _get_tree(self, root, maxdepth): """Workhorse of the get_tree implementation. This is an recursive method which is why we have a wrapper method. root is the current root object of the tree which should be returned. Note that root is not of the type _Node. maxdepth defines ho...
[ "def", "_get_tree", "(", "self", ",", "root", ",", "maxdepth", ")", ":", "self", ".", "ignore", ".", "append", "(", "inspect", ".", "currentframe", "(", ")", ")", "res", "=", "_Node", "(", "root", ",", "self", ".", "str_func", ")", "#PYCHOK use root pa...
Workhorse of the get_tree implementation. This is an recursive method which is why we have a wrapper method. root is the current root object of the tree which should be returned. Note that root is not of the type _Node. maxdepth defines how much further down the from the root the tree ...
[ "Workhorse", "of", "the", "get_tree", "implementation", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L91-L122
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
StreamBrowser.print_tree
def print_tree(self, tree=None): """ Print referrers tree to console. keyword arguments tree -- if not None, the passed tree will be printed. Otherwise it is based on the rootobject. """ if tree is None: self._print(self.root, '', '') else: ...
python
def print_tree(self, tree=None): """ Print referrers tree to console. keyword arguments tree -- if not None, the passed tree will be printed. Otherwise it is based on the rootobject. """ if tree is None: self._print(self.root, '', '') else: ...
[ "def", "print_tree", "(", "self", ",", "tree", "=", "None", ")", ":", "if", "tree", "is", "None", ":", "self", ".", "_print", "(", "self", ".", "root", ",", "''", ",", "''", ")", "else", ":", "self", ".", "_print", "(", "tree", ",", "''", ",", ...
Print referrers tree to console. keyword arguments tree -- if not None, the passed tree will be printed. Otherwise it is based on the rootobject.
[ "Print", "referrers", "tree", "to", "console", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L138-L149
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
StreamBrowser._print
def _print(self, tree, prefix, carryon): """Compute and print a new line of the tree. This is a recursive function. arguments tree -- tree to print prefix -- prefix to the current line to print carryon -- prefix which is used to carry on the vertical lines """ ...
python
def _print(self, tree, prefix, carryon): """Compute and print a new line of the tree. This is a recursive function. arguments tree -- tree to print prefix -- prefix to the current line to print carryon -- prefix which is used to carry on the vertical lines """ ...
[ "def", "_print", "(", "self", ",", "tree", ",", "prefix", ",", "carryon", ")", ":", "level", "=", "prefix", ".", "count", "(", "self", ".", "cross", ")", "+", "prefix", ".", "count", "(", "self", ".", "vline", ")", "len_children", "=", "0", "if", ...
Compute and print a new line of the tree. This is a recursive function. arguments tree -- tree to print prefix -- prefix to the current line to print carryon -- prefix which is used to carry on the vertical lines
[ "Compute", "and", "print", "a", "new", "line", "of", "the", "tree", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L151-L200
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
FileBrowser.print_tree
def print_tree(self, filename, tree=None): """ Print referrers tree to file (in text format). keyword arguments tree -- if not None, the passed tree will be printed. """ old_stream = self.stream self.stream = open(filename, 'w') try: super(FileBrowse...
python
def print_tree(self, filename, tree=None): """ Print referrers tree to file (in text format). keyword arguments tree -- if not None, the passed tree will be printed. """ old_stream = self.stream self.stream = open(filename, 'w') try: super(FileBrowse...
[ "def", "print_tree", "(", "self", ",", "filename", ",", "tree", "=", "None", ")", ":", "old_stream", "=", "self", ".", "stream", "self", ".", "stream", "=", "open", "(", "filename", ",", "'w'", ")", "try", ":", "super", "(", "FileBrowser", ",", "self...
Print referrers tree to file (in text format). keyword arguments tree -- if not None, the passed tree will be printed.
[ "Print", "referrers", "tree", "to", "file", "(", "in", "text", "format", ")", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L215-L228
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/pympler/refbrowser.py
InteractiveBrowser.main
def main(self, standalone=False): """Create interactive browser window. keyword arguments standalone -- Set to true, if the browser is not attached to other windows """ window = _Tkinter.Tk() sc = _TreeWidget.ScrolledCanvas(window, bg="white",\ ...
python
def main(self, standalone=False): """Create interactive browser window. keyword arguments standalone -- Set to true, if the browser is not attached to other windows """ window = _Tkinter.Tk() sc = _TreeWidget.ScrolledCanvas(window, bg="white",\ ...
[ "def", "main", "(", "self", ",", "standalone", "=", "False", ")", ":", "window", "=", "_Tkinter", ".", "Tk", "(", ")", "sc", "=", "_TreeWidget", ".", "ScrolledCanvas", "(", "window", ",", "bg", "=", "\"white\"", ",", "highlightthickness", "=", "0", ","...
Create interactive browser window. keyword arguments standalone -- Set to true, if the browser is not attached to other windows
[ "Create", "interactive", "browser", "window", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/pympler/refbrowser.py#L392-L408
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/gui/widgets/widget_pack.py
CounterPayload.getValue
def getValue(self): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' dropdown_value = self.widget.GetValue() if not str(dropdown_value).isdigit(): return '' arg = str(self.option_string).replace('-', '') repeated_args = arg * int(dropdown_value) ret...
python
def getValue(self): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' dropdown_value = self.widget.GetValue() if not str(dropdown_value).isdigit(): return '' arg = str(self.option_string).replace('-', '') repeated_args = arg * int(dropdown_value) ret...
[ "def", "getValue", "(", "self", ")", ":", "dropdown_value", "=", "self", ".", "widget", ".", "GetValue", "(", ")", "if", "not", "str", "(", "dropdown_value", ")", ".", "isdigit", "(", ")", ":", "return", "''", "arg", "=", "str", "(", "self", ".", "...
Returns str(option_string * DropDown Value) e.g. -vvvvv
[ "Returns", "str", "(", "option_string", "*", "DropDown", "Value", ")", "e", ".", "g", ".", "-", "vvvvv" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/widgets/widget_pack.py#L199-L211
lrq3000/pyFileFixity
pyFileFixity/lib/tqdm/_tqdm.py
format_meter
def format_meter(n, total, elapsed, ncols=None, prefix='', unit=None, unit_scale=False, ascii=False): """ Return a string-based progress bar given some parameters Parameters ---------- n : int Number of finished iterations. total : int The expected total number of ite...
python
def format_meter(n, total, elapsed, ncols=None, prefix='', unit=None, unit_scale=False, ascii=False): """ Return a string-based progress bar given some parameters Parameters ---------- n : int Number of finished iterations. total : int The expected total number of ite...
[ "def", "format_meter", "(", "n", ",", "total", ",", "elapsed", ",", "ncols", "=", "None", ",", "prefix", "=", "''", ",", "unit", "=", "None", ",", "unit_scale", "=", "False", ",", "ascii", "=", "False", ")", ":", "# in case the total is wrong (n is above t...
Return a string-based progress bar given some parameters Parameters ---------- n : int Number of finished iterations. total : int The expected total number of iterations. If None, only basic progress statistics are displayed (no ETA). elapsed : float Number of sec...
[ "Return", "a", "string", "-", "based", "progress", "bar", "given", "some", "parameters" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/tqdm/_tqdm.py#L44-L151
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
getIcon
def getIcon( data ): """Return the data from the resource as a wxIcon""" import cStringIO stream = cStringIO.StringIO(data) image = wx.ImageFromStream(stream) icon = wx.EmptyIcon() icon.CopyFromBitmap(wx.BitmapFromImage(image)) return icon
python
def getIcon( data ): """Return the data from the resource as a wxIcon""" import cStringIO stream = cStringIO.StringIO(data) image = wx.ImageFromStream(stream) icon = wx.EmptyIcon() icon.CopyFromBitmap(wx.BitmapFromImage(image)) return icon
[ "def", "getIcon", "(", "data", ")", ":", "import", "cStringIO", "stream", "=", "cStringIO", ".", "StringIO", "(", "data", ")", "image", "=", "wx", ".", "ImageFromStream", "(", "stream", ")", "icon", "=", "wx", ".", "EmptyIcon", "(", ")", "icon", ".", ...
Return the data from the resource as a wxIcon
[ "Return", "the", "data", "from", "the", "resource", "as", "a", "wxIcon" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L841-L848
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
main
def main(): """Mainloop for the application""" logging.basicConfig(level=logging.INFO) app = RunSnakeRunApp(0) app.MainLoop()
python
def main(): """Mainloop for the application""" logging.basicConfig(level=logging.INFO) app = RunSnakeRunApp(0) app.MainLoop()
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ")", "app", "=", "RunSnakeRunApp", "(", "0", ")", "app", ".", "MainLoop", "(", ")" ]
Mainloop for the application
[ "Mainloop", "for", "the", "application" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L873-L877
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.CreateControls
def CreateControls(self, config_parser): """Create our sub-controls""" self.CreateMenuBar() self.SetupToolBar() self.CreateStatusBar() self.leftSplitter = wx.SplitterWindow( self ) self.rightSplitter = wx.SplitterWindow( self.leftSplitter ...
python
def CreateControls(self, config_parser): """Create our sub-controls""" self.CreateMenuBar() self.SetupToolBar() self.CreateStatusBar() self.leftSplitter = wx.SplitterWindow( self ) self.rightSplitter = wx.SplitterWindow( self.leftSplitter ...
[ "def", "CreateControls", "(", "self", ",", "config_parser", ")", ":", "self", ".", "CreateMenuBar", "(", ")", "self", ".", "SetupToolBar", "(", ")", "self", ".", "CreateStatusBar", "(", ")", "self", ".", "leftSplitter", "=", "wx", ".", "SplitterWindow", "(...
Create our sub-controls
[ "Create", "our", "sub", "-", "controls" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L229-L311
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.CreateMenuBar
def CreateMenuBar(self): """Create our menu-bar for triggering operations""" menubar = wx.MenuBar() menu = wx.Menu() menu.Append(ID_OPEN, _('&Open Profile'), _('Open a cProfile file')) menu.Append(ID_OPEN_MEMORY, _('Open &Memory'), _('Open a Meliae memory-dump file')) men...
python
def CreateMenuBar(self): """Create our menu-bar for triggering operations""" menubar = wx.MenuBar() menu = wx.Menu() menu.Append(ID_OPEN, _('&Open Profile'), _('Open a cProfile file')) menu.Append(ID_OPEN_MEMORY, _('Open &Memory'), _('Open a Meliae memory-dump file')) men...
[ "def", "CreateMenuBar", "(", "self", ")", ":", "menubar", "=", "wx", ".", "MenuBar", "(", ")", "menu", "=", "wx", ".", "Menu", "(", ")", "menu", ".", "Append", "(", "ID_OPEN", ",", "_", "(", "'&Open Profile'", ")", ",", "_", "(", "'Open a cProfile fi...
Create our menu-bar for triggering operations
[ "Create", "our", "menu", "-", "bar", "for", "triggering", "operations" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L313-L373
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.CreateSourceWindow
def CreateSourceWindow(self, tabs): """Create our source-view window for tabs""" if editor and self.sourceCodeControl is None: self.sourceCodeControl = wx.py.editwindow.EditWindow( self.tabs, -1 ) self.sourceCodeControl.SetText(u"") self.so...
python
def CreateSourceWindow(self, tabs): """Create our source-view window for tabs""" if editor and self.sourceCodeControl is None: self.sourceCodeControl = wx.py.editwindow.EditWindow( self.tabs, -1 ) self.sourceCodeControl.SetText(u"") self.so...
[ "def", "CreateSourceWindow", "(", "self", ",", "tabs", ")", ":", "if", "editor", "and", "self", ".", "sourceCodeControl", "is", "None", ":", "self", ".", "sourceCodeControl", "=", "wx", ".", "py", ".", "editwindow", ".", "EditWindow", "(", "self", ".", "...
Create our source-view window for tabs
[ "Create", "our", "source", "-", "view", "window", "for", "tabs" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L383-L391
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SetupToolBar
def SetupToolBar(self): """Create the toolbar for common actions""" tb = self.CreateToolBar(self.TBFLAGS) tsize = (24, 24) tb.ToolBitmapSize = tsize open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) tb...
python
def SetupToolBar(self): """Create the toolbar for common actions""" tb = self.CreateToolBar(self.TBFLAGS) tsize = (24, 24) tb.ToolBitmapSize = tsize open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) tb...
[ "def", "SetupToolBar", "(", "self", ")", ":", "tb", "=", "self", ".", "CreateToolBar", "(", "self", ".", "TBFLAGS", ")", "tsize", "=", "(", "24", ",", "24", ")", "tb", ".", "ToolBitmapSize", "=", "tsize", "open_bmp", "=", "wx", ".", "ArtProvider", "....
Create the toolbar for common actions
[ "Create", "the", "toolbar", "for", "common", "actions" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L393-L435
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnViewTypeTool
def OnViewTypeTool( self, event ): """When the user changes the selection, make that our selection""" new = self.viewTypeTool.GetStringSelection() if new != self.viewType: self.viewType = new self.OnRootView( event )
python
def OnViewTypeTool( self, event ): """When the user changes the selection, make that our selection""" new = self.viewTypeTool.GetStringSelection() if new != self.viewType: self.viewType = new self.OnRootView( event )
[ "def", "OnViewTypeTool", "(", "self", ",", "event", ")", ":", "new", "=", "self", ".", "viewTypeTool", ".", "GetStringSelection", "(", ")", "if", "new", "!=", "self", ".", "viewType", ":", "self", ".", "viewType", "=", "new", "self", ".", "OnRootView", ...
When the user changes the selection, make that our selection
[ "When", "the", "user", "changes", "the", "selection", "make", "that", "our", "selection" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L437-L442
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.ConfigureViewTypeChoices
def ConfigureViewTypeChoices( self, event=None ): """Configure the set of View types in the toolbar (and menus)""" self.viewTypeTool.SetItems( getattr( self.loader, 'ROOTS', [] )) if self.loader and self.viewType in self.loader.ROOTS: self.viewTypeTool.SetSelection( self.loader.ROOTS...
python
def ConfigureViewTypeChoices( self, event=None ): """Configure the set of View types in the toolbar (and menus)""" self.viewTypeTool.SetItems( getattr( self.loader, 'ROOTS', [] )) if self.loader and self.viewType in self.loader.ROOTS: self.viewTypeTool.SetSelection( self.loader.ROOTS...
[ "def", "ConfigureViewTypeChoices", "(", "self", ",", "event", "=", "None", ")", ":", "self", ".", "viewTypeTool", ".", "SetItems", "(", "getattr", "(", "self", ".", "loader", ",", "'ROOTS'", ",", "[", "]", ")", ")", "if", "self", ".", "loader", "and", ...
Configure the set of View types in the toolbar (and menus)
[ "Configure", "the", "set", "of", "View", "types", "in", "the", "toolbar", "(", "and", "menus", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L444-L472
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnOpenFile
def OnOpenFile(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN|wx.FD_MULTIPLE) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() if self.loader: # we've already got a displayed data-set, open new...
python
def OnOpenFile(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN|wx.FD_MULTIPLE) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() if self.loader: # we've already got a displayed data-set, open new...
[ "def", "OnOpenFile", "(", "self", ",", "event", ")", ":", "dialog", "=", "wx", ".", "FileDialog", "(", "self", ",", "style", "=", "wx", ".", "OPEN", "|", "wx", ".", "FD_MULTIPLE", ")", "if", "dialog", ".", "ShowModal", "(", ")", "==", "wx", ".", ...
Request to open a new profile file
[ "Request", "to", "open", "a", "new", "profile", "file" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L474-L485
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnOpenMemory
def OnOpenMemory(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() if self.loader: # we've already got a displayed data-set, open new window... ...
python
def OnOpenMemory(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() if self.loader: # we've already got a displayed data-set, open new window... ...
[ "def", "OnOpenMemory", "(", "self", ",", "event", ")", ":", "dialog", "=", "wx", ".", "FileDialog", "(", "self", ",", "style", "=", "wx", ".", "OPEN", ")", "if", "dialog", ".", "ShowModal", "(", ")", "==", "wx", ".", "ID_OK", ":", "path", "=", "d...
Request to open a new profile file
[ "Request", "to", "open", "a", "new", "profile", "file" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L486-L497
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SetPackageView
def SetPackageView(self, directoryView): """Set whether to use directory/package based view""" self.directoryView = not self.directoryView self.packageMenuItem.Check(self.directoryView) self.packageViewTool.SetValue(self.directoryView) if self.loader: self.SetModel(se...
python
def SetPackageView(self, directoryView): """Set whether to use directory/package based view""" self.directoryView = not self.directoryView self.packageMenuItem.Check(self.directoryView) self.packageViewTool.SetValue(self.directoryView) if self.loader: self.SetModel(se...
[ "def", "SetPackageView", "(", "self", ",", "directoryView", ")", ":", "self", ".", "directoryView", "=", "not", "self", ".", "directoryView", "self", ".", "packageMenuItem", ".", "Check", "(", "self", ".", "directoryView", ")", "self", ".", "packageViewTool", ...
Set whether to use directory/package based view
[ "Set", "whether", "to", "use", "directory", "/", "package", "based", "view" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L519-L526
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SetPercentageView
def SetPercentageView(self, percentageView): """Set whether to display percentage or absolute values""" self.percentageView = percentageView self.percentageMenuItem.Check(self.percentageView) self.percentageViewTool.SetValue(self.percentageView) total = self.adapter.value( self.l...
python
def SetPercentageView(self, percentageView): """Set whether to display percentage or absolute values""" self.percentageView = percentageView self.percentageMenuItem.Check(self.percentageView) self.percentageViewTool.SetValue(self.percentageView) total = self.adapter.value( self.l...
[ "def", "SetPercentageView", "(", "self", ",", "percentageView", ")", ":", "self", ".", "percentageView", "=", "percentageView", "self", ".", "percentageMenuItem", ".", "Check", "(", "self", ".", "percentageView", ")", "self", ".", "percentageViewTool", ".", "Set...
Set whether to display percentage or absolute values
[ "Set", "whether", "to", "display", "percentage", "or", "absolute", "values" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L532-L540
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnUpView
def OnUpView(self, event): """Request to move up the hierarchy to highest-weight parent""" node = self.activated_node parents = [] selected_parent = None if node: if hasattr( self.adapter, 'best_parent' ): selected_parent = self.adapter.best_p...
python
def OnUpView(self, event): """Request to move up the hierarchy to highest-weight parent""" node = self.activated_node parents = [] selected_parent = None if node: if hasattr( self.adapter, 'best_parent' ): selected_parent = self.adapter.best_p...
[ "def", "OnUpView", "(", "self", ",", "event", ")", ":", "node", "=", "self", ".", "activated_node", "parents", "=", "[", "]", "selected_parent", "=", "None", "if", "node", ":", "if", "hasattr", "(", "self", ".", "adapter", ",", "'best_parent'", ")", ":...
Request to move up the hierarchy to highest-weight parent
[ "Request", "to", "move", "up", "the", "hierarchy", "to", "highest", "-", "weight", "parent" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L542-L564
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnBackView
def OnBackView(self, event): """Request to move backward in the history""" self.historyIndex -= 1 try: self.RestoreHistory(self.history[self.historyIndex]) except IndexError, err: self.SetStatusText(_('No further history available'))
python
def OnBackView(self, event): """Request to move backward in the history""" self.historyIndex -= 1 try: self.RestoreHistory(self.history[self.historyIndex]) except IndexError, err: self.SetStatusText(_('No further history available'))
[ "def", "OnBackView", "(", "self", ",", "event", ")", ":", "self", ".", "historyIndex", "-=", "1", "try", ":", "self", ".", "RestoreHistory", "(", "self", ".", "history", "[", "self", ".", "historyIndex", "]", ")", "except", "IndexError", ",", "err", ":...
Request to move backward in the history
[ "Request", "to", "move", "backward", "in", "the", "history" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L566-L572
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnRootView
def OnRootView(self, event): """Reset view to the root of the tree""" self.adapter, tree, rows = self.RootNode() self.squareMap.SetModel(tree, self.adapter) self.RecordHistory() self.ConfigureViewTypeChoices()
python
def OnRootView(self, event): """Reset view to the root of the tree""" self.adapter, tree, rows = self.RootNode() self.squareMap.SetModel(tree, self.adapter) self.RecordHistory() self.ConfigureViewTypeChoices()
[ "def", "OnRootView", "(", "self", ",", "event", ")", ":", "self", ".", "adapter", ",", "tree", ",", "rows", "=", "self", ".", "RootNode", "(", ")", "self", ".", "squareMap", ".", "SetModel", "(", "tree", ",", "self", ".", "adapter", ")", "self", "....
Reset view to the root of the tree
[ "Reset", "view", "to", "the", "root", "of", "the", "tree" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L574-L579
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnNodeActivated
def OnNodeActivated(self, event): """Double-click or enter on a node in some control...""" self.activated_node = self.selected_node = event.node self.squareMap.SetModel(event.node, self.adapter) self.squareMap.SetSelected( event.node ) if editor: if self.SourceShowFil...
python
def OnNodeActivated(self, event): """Double-click or enter on a node in some control...""" self.activated_node = self.selected_node = event.node self.squareMap.SetModel(event.node, self.adapter) self.squareMap.SetSelected( event.node ) if editor: if self.SourceShowFil...
[ "def", "OnNodeActivated", "(", "self", ",", "event", ")", ":", "self", ".", "activated_node", "=", "self", ".", "selected_node", "=", "event", ".", "node", "self", ".", "squareMap", ".", "SetModel", "(", "event", ".", "node", ",", "self", ".", "adapter",...
Double-click or enter on a node in some control...
[ "Double", "-", "click", "or", "enter", "on", "a", "node", "in", "some", "control", "..." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L581-L590
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SourceShowFile
def SourceShowFile(self, node): """Show the given file in the source-code view (attempt it anyway)""" filename = self.adapter.filename( node ) if filename and self.sourceFileShown != filename: try: data = open(filename).read() except Exception, err: ...
python
def SourceShowFile(self, node): """Show the given file in the source-code view (attempt it anyway)""" filename = self.adapter.filename( node ) if filename and self.sourceFileShown != filename: try: data = open(filename).read() except Exception, err: ...
[ "def", "SourceShowFile", "(", "self", ",", "node", ")", ":", "filename", "=", "self", ".", "adapter", ".", "filename", "(", "node", ")", "if", "filename", "and", "self", ".", "sourceFileShown", "!=", "filename", ":", "try", ":", "data", "=", "open", "(...
Show the given file in the source-code view (attempt it anyway)
[ "Show", "the", "given", "file", "in", "the", "source", "-", "code", "view", "(", "attempt", "it", "anyway", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L592-L605
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnSquareSelected
def OnSquareSelected(self, event): """Update all views to show selection children/parents""" self.selected_node = event.node self.calleeListControl.integrateRecords(self.adapter.children( event.node) ) self.callerListControl.integrateRecords(self.adapter.parents( event.node) )
python
def OnSquareSelected(self, event): """Update all views to show selection children/parents""" self.selected_node = event.node self.calleeListControl.integrateRecords(self.adapter.children( event.node) ) self.callerListControl.integrateRecords(self.adapter.parents( event.node) )
[ "def", "OnSquareSelected", "(", "self", ",", "event", ")", ":", "self", ".", "selected_node", "=", "event", ".", "node", "self", ".", "calleeListControl", ".", "integrateRecords", "(", "self", ".", "adapter", ".", "children", "(", "event", ".", "node", ")"...
Update all views to show selection children/parents
[ "Update", "all", "views", "to", "show", "selection", "children", "/", "parents" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L629-L633
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.OnMoreSquareToggle
def OnMoreSquareToggle( self, event ): """Toggle the more-square view (better looking, but more likely to filter records)""" self.squareMap.square_style = not self.squareMap.square_style self.squareMap.Refresh() self.moreSquareViewItem.Check(self.squareMap.square_style)
python
def OnMoreSquareToggle( self, event ): """Toggle the more-square view (better looking, but more likely to filter records)""" self.squareMap.square_style = not self.squareMap.square_style self.squareMap.Refresh() self.moreSquareViewItem.Check(self.squareMap.square_style)
[ "def", "OnMoreSquareToggle", "(", "self", ",", "event", ")", ":", "self", ".", "squareMap", ".", "square_style", "=", "not", "self", ".", "squareMap", ".", "square_style", "self", ".", "squareMap", ".", "Refresh", "(", ")", "self", ".", "moreSquareViewItem",...
Toggle the more-square view (better looking, but more likely to filter records)
[ "Toggle", "the", "more", "-", "square", "view", "(", "better", "looking", "but", "more", "likely", "to", "filter", "records", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L637-L641
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.RecordHistory
def RecordHistory(self): """Add the given node to the history-set""" if not self.restoringHistory: record = self.activated_node if self.historyIndex < -1: try: del self.history[self.historyIndex+1:] except AttributeError, err: ...
python
def RecordHistory(self): """Add the given node to the history-set""" if not self.restoringHistory: record = self.activated_node if self.historyIndex < -1: try: del self.history[self.historyIndex+1:] except AttributeError, err: ...
[ "def", "RecordHistory", "(", "self", ")", ":", "if", "not", "self", ".", "restoringHistory", ":", "record", "=", "self", ".", "activated_node", "if", "self", ".", "historyIndex", "<", "-", "1", ":", "try", ":", "del", "self", ".", "history", "[", "self...
Add the given node to the history-set
[ "Add", "the", "given", "node", "to", "the", "history", "-", "set" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L645-L657
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.load
def load(self, *filenames): """Load our dataset (iteratively)""" if len(filenames) == 1: if os.path.basename( filenames[0] ) == 'index.coldshot': return self.load_coldshot( os.path.dirname( filenames[0]) ) elif os.path.isdir( filenames[0] ): return...
python
def load(self, *filenames): """Load our dataset (iteratively)""" if len(filenames) == 1: if os.path.basename( filenames[0] ) == 'index.coldshot': return self.load_coldshot( os.path.dirname( filenames[0]) ) elif os.path.isdir( filenames[0] ): return...
[ "def", "load", "(", "self", ",", "*", "filenames", ")", ":", "if", "len", "(", "filenames", ")", "==", "1", ":", "if", "os", ".", "path", ".", "basename", "(", "filenames", "[", "0", "]", ")", "==", "'index.coldshot'", ":", "return", "self", ".", ...
Load our dataset (iteratively)
[ "Load", "our", "dataset", "(", "iteratively", ")" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L673-L693
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SetModel
def SetModel(self, loader): """Set our overall model (a loader object) and populate sub-controls""" self.loader = loader self.adapter, tree, rows = self.RootNode() self.listControl.integrateRecords(rows.values()) self.activated_node = tree self.squareMap.SetModel(tree, se...
python
def SetModel(self, loader): """Set our overall model (a loader object) and populate sub-controls""" self.loader = loader self.adapter, tree, rows = self.RootNode() self.listControl.integrateRecords(rows.values()) self.activated_node = tree self.squareMap.SetModel(tree, se...
[ "def", "SetModel", "(", "self", ",", "loader", ")", ":", "self", ".", "loader", "=", "loader", "self", ".", "adapter", ",", "tree", ",", "rows", "=", "self", ".", "RootNode", "(", ")", "self", ".", "listControl", ".", "integrateRecords", "(", "rows", ...
Set our overall model (a loader object) and populate sub-controls
[ "Set", "our", "overall", "model", "(", "a", "loader", "object", ")", "and", "populate", "sub", "-", "controls" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L710-L717
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.RootNode
def RootNode(self): """Return our current root node and appropriate adapter for it""" tree = self.loader.get_root( self.viewType ) adapter = self.loader.get_adapter( self.viewType ) rows = self.loader.get_rows( self.viewType ) adapter.SetPercentage(self.percentageView, a...
python
def RootNode(self): """Return our current root node and appropriate adapter for it""" tree = self.loader.get_root( self.viewType ) adapter = self.loader.get_adapter( self.viewType ) rows = self.loader.get_rows( self.viewType ) adapter.SetPercentage(self.percentageView, a...
[ "def", "RootNode", "(", "self", ")", ":", "tree", "=", "self", ".", "loader", ".", "get_root", "(", "self", ".", "viewType", ")", "adapter", "=", "self", ".", "loader", ".", "get_adapter", "(", "self", ".", "viewType", ")", "rows", "=", "self", ".", ...
Return our current root node and appropriate adapter for it
[ "Return", "our", "current", "root", "node", "and", "appropriate", "adapter", "for", "it" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L719-L727
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.SaveState
def SaveState( self, config_parser ): """Retrieve window state to be restored on the next run...""" if not config_parser.has_section( 'window' ): config_parser.add_section( 'window' ) if self.IsMaximized(): config_parser.set( 'window', 'maximized', str(True)) else...
python
def SaveState( self, config_parser ): """Retrieve window state to be restored on the next run...""" if not config_parser.has_section( 'window' ): config_parser.add_section( 'window' ) if self.IsMaximized(): config_parser.set( 'window', 'maximized', str(True)) else...
[ "def", "SaveState", "(", "self", ",", "config_parser", ")", ":", "if", "not", "config_parser", ".", "has_section", "(", "'window'", ")", ":", "config_parser", ".", "add_section", "(", "'window'", ")", "if", "self", ".", "IsMaximized", "(", ")", ":", "confi...
Retrieve window state to be restored on the next run...
[ "Retrieve", "window", "state", "to", "be", "restored", "on", "the", "next", "run", "..." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L729-L747
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MainFrame.LoadState
def LoadState( self, config_parser ): """Set our window state from the given config_parser instance""" if not config_parser: return if ( not config_parser.has_section( 'window' ) or ( config_parser.has_option( 'window','maximized' ) and co...
python
def LoadState( self, config_parser ): """Set our window state from the given config_parser instance""" if not config_parser: return if ( not config_parser.has_section( 'window' ) or ( config_parser.has_option( 'window','maximized' ) and co...
[ "def", "LoadState", "(", "self", ",", "config_parser", ")", ":", "if", "not", "config_parser", ":", "return", "if", "(", "not", "config_parser", ".", "has_section", "(", "'window'", ")", "or", "(", "config_parser", ".", "has_option", "(", "'window'", ",", ...
Set our window state from the given config_parser instance
[ "Set", "our", "window", "state", "from", "the", "given", "config_parser", "instance" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L750-L791
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
RunSnakeRunApp.OnInit
def OnInit(self, profile=None, memoryProfile=None): """Initialise the application""" wx.Image.AddHandler(self.handler) frame = MainFrame( config_parser = load_config()) frame.Show(True) self.SetTopWindow(frame) if profile: wx.CallAfter(frame.load, *[profile]) ...
python
def OnInit(self, profile=None, memoryProfile=None): """Initialise the application""" wx.Image.AddHandler(self.handler) frame = MainFrame( config_parser = load_config()) frame.Show(True) self.SetTopWindow(frame) if profile: wx.CallAfter(frame.load, *[profile]) ...
[ "def", "OnInit", "(", "self", ",", "profile", "=", "None", ",", "memoryProfile", "=", "None", ")", ":", "wx", ".", "Image", ".", "AddHandler", "(", "self", ".", "handler", ")", "frame", "=", "MainFrame", "(", "config_parser", "=", "load_config", "(", "...
Initialise the application
[ "Initialise", "the", "application" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L808-L824
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
MeliaeViewApp.OnInit
def OnInit(self): """Initialise the application""" wx.Image.AddHandler(self.handler) frame = MainFrame( config_parser = load_config()) frame.Show(True) self.SetTopWindow(frame) if sys.argv[1:]: wx.CallAfter( frame.load_memory, sys.argv[1] ) else: ...
python
def OnInit(self): """Initialise the application""" wx.Image.AddHandler(self.handler) frame = MainFrame( config_parser = load_config()) frame.Show(True) self.SetTopWindow(frame) if sys.argv[1:]: wx.CallAfter( frame.load_memory, sys.argv[1] ) else: ...
[ "def", "OnInit", "(", "self", ")", ":", "wx", ".", "Image", ".", "AddHandler", "(", "self", ".", "handler", ")", "frame", "=", "MainFrame", "(", "config_parser", "=", "load_config", "(", ")", ")", "frame", ".", "Show", "(", "True", ")", "self", ".", ...
Initialise the application
[ "Initialise", "the", "application" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L828-L838
lrq3000/pyFileFixity
pyFileFixity/lib/distance/distance/_fastcomp.py
fast_comp
def fast_comp(seq1, seq2, transpositions=False): """Compute the distance between the two sequences `seq1` and `seq2` up to a maximum of 2 included, and return it. If the edit distance between the two sequences is higher than that, -1 is returned. If `transpositions` is `True`, transpositions will be taken into ac...
python
def fast_comp(seq1, seq2, transpositions=False): """Compute the distance between the two sequences `seq1` and `seq2` up to a maximum of 2 included, and return it. If the edit distance between the two sequences is higher than that, -1 is returned. If `transpositions` is `True`, transpositions will be taken into ac...
[ "def", "fast_comp", "(", "seq1", ",", "seq2", ",", "transpositions", "=", "False", ")", ":", "replace", ",", "insert", ",", "delete", "=", "\"r\"", ",", "\"i\"", ",", "\"d\"", "L1", ",", "L2", "=", "len", "(", "seq1", ")", ",", "len", "(", "seq2", ...
Compute the distance between the two sequences `seq1` and `seq2` up to a maximum of 2 included, and return it. If the edit distance between the two sequences is higher than that, -1 is returned. If `transpositions` is `True`, transpositions will be taken into account for the computation of the distance. This can ...
[ "Compute", "the", "distance", "between", "the", "two", "sequences", "seq1", "and", "seq2", "up", "to", "a", "maximum", "of", "2", "included", "and", "return", "it", ".", "If", "the", "edit", "distance", "between", "the", "two", "sequences", "is", "higher",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/distance/distance/_fastcomp.py#L3-L82
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
is_file
def is_file(dirname): '''Checks if a path is an actual file that exists''' if not os.path.isfile(dirname): msg = "{0} is not an existing file".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
python
def is_file(dirname): '''Checks if a path is an actual file that exists''' if not os.path.isfile(dirname): msg = "{0} is not an existing file".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
[ "def", "is_file", "(", "dirname", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "dirname", ")", ":", "msg", "=", "\"{0} is not an existing file\"", ".", "format", "(", "dirname", ")", "raise", "argparse", ".", "ArgumentTypeError", "(", "msg...
Checks if a path is an actual file that exists
[ "Checks", "if", "a", "path", "is", "an", "actual", "file", "that", "exists" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L19-L25
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
is_dir
def is_dir(dirname): '''Checks if a path is an actual directory that exists''' if not os.path.isdir(dirname): msg = "{0} is not a directory".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
python
def is_dir(dirname): '''Checks if a path is an actual directory that exists''' if not os.path.isdir(dirname): msg = "{0} is not a directory".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
[ "def", "is_dir", "(", "dirname", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "dirname", ")", ":", "msg", "=", "\"{0} is not a directory\"", ".", "format", "(", "dirname", ")", "raise", "argparse", ".", "ArgumentTypeError", "(", "msg", ")...
Checks if a path is an actual directory that exists
[ "Checks", "if", "a", "path", "is", "an", "actual", "directory", "that", "exists" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L27-L33
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
is_dir_or_file
def is_dir_or_file(dirname): '''Checks if a path is an actual directory that exists or a file''' if not os.path.isdir(dirname) and not os.path.isfile(dirname): msg = "{0} is not a directory nor a file".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
python
def is_dir_or_file(dirname): '''Checks if a path is an actual directory that exists or a file''' if not os.path.isdir(dirname) and not os.path.isfile(dirname): msg = "{0} is not a directory nor a file".format(dirname) raise argparse.ArgumentTypeError(msg) else: return dirname
[ "def", "is_dir_or_file", "(", "dirname", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "dirname", ")", "and", "not", "os", ".", "path", ".", "isfile", "(", "dirname", ")", ":", "msg", "=", "\"{0} is not a directory nor a file\"", ".", "for...
Checks if a path is an actual directory that exists or a file
[ "Checks", "if", "a", "path", "is", "an", "actual", "directory", "that", "exists", "or", "a", "file" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L35-L41
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
fullpath
def fullpath(relpath): '''Relative path to absolute''' if (type(relpath) is object or type(relpath) is file): relpath = relpath.name return os.path.abspath(os.path.expanduser(relpath))
python
def fullpath(relpath): '''Relative path to absolute''' if (type(relpath) is object or type(relpath) is file): relpath = relpath.name return os.path.abspath(os.path.expanduser(relpath))
[ "def", "fullpath", "(", "relpath", ")", ":", "if", "(", "type", "(", "relpath", ")", "is", "object", "or", "type", "(", "relpath", ")", "is", "file", ")", ":", "relpath", "=", "relpath", ".", "name", "return", "os", ".", "path", ".", "abspath", "("...
Relative path to absolute
[ "Relative", "path", "to", "absolute" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L43-L47
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
recwalk
def recwalk(inputpath, sorting=True): '''Recursively walk through a folder. This provides a mean to flatten out the files restitution (necessary to show a progress bar). This is a generator.''' # If it's only a single file, return this single file if os.path.isfile(inputpath): abs_path = fullpath(in...
python
def recwalk(inputpath, sorting=True): '''Recursively walk through a folder. This provides a mean to flatten out the files restitution (necessary to show a progress bar). This is a generator.''' # If it's only a single file, return this single file if os.path.isfile(inputpath): abs_path = fullpath(in...
[ "def", "recwalk", "(", "inputpath", ",", "sorting", "=", "True", ")", ":", "# If it's only a single file, return this single file", "if", "os", ".", "path", ".", "isfile", "(", "inputpath", ")", ":", "abs_path", "=", "fullpath", "(", "inputpath", ")", "yield", ...
Recursively walk through a folder. This provides a mean to flatten out the files restitution (necessary to show a progress bar). This is a generator.
[ "Recursively", "walk", "through", "a", "folder", ".", "This", "provides", "a", "mean", "to", "flatten", "out", "the", "files", "restitution", "(", "necessary", "to", "show", "a", "progress", "bar", ")", ".", "This", "is", "a", "generator", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L49-L62
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
path2unix
def path2unix(path, nojoin=False, fromwinpath=False): '''From a path given in any format, converts to posix path format fromwinpath=True forces the input path to be recognized as a Windows path (useful on Unix machines to unit test Windows paths)''' if fromwinpath: pathparts = list(PureWindowsPath(p...
python
def path2unix(path, nojoin=False, fromwinpath=False): '''From a path given in any format, converts to posix path format fromwinpath=True forces the input path to be recognized as a Windows path (useful on Unix machines to unit test Windows paths)''' if fromwinpath: pathparts = list(PureWindowsPath(p...
[ "def", "path2unix", "(", "path", ",", "nojoin", "=", "False", ",", "fromwinpath", "=", "False", ")", ":", "if", "fromwinpath", ":", "pathparts", "=", "list", "(", "PureWindowsPath", "(", "path", ")", ".", "parts", ")", "else", ":", "pathparts", "=", "l...
From a path given in any format, converts to posix path format fromwinpath=True forces the input path to be recognized as a Windows path (useful on Unix machines to unit test Windows paths)
[ "From", "a", "path", "given", "in", "any", "format", "converts", "to", "posix", "path", "format", "fromwinpath", "=", "True", "forces", "the", "input", "path", "to", "be", "recognized", "as", "a", "Windows", "path", "(", "useful", "on", "Unix", "machines",...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L72-L82
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
get_next_entry
def get_next_entry(file, entrymarker="\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF", only_coord=True, blocksize=65535): '''Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very s...
python
def get_next_entry(file, entrymarker="\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF\xFE\xFF", only_coord=True, blocksize=65535): '''Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very s...
[ "def", "get_next_entry", "(", "file", ",", "entrymarker", "=", "\"\\xFE\\xFF\\xFE\\xFF\\xFE\\xFF\\xFE\\xFF\\xFE\\xFF\"", ",", "only_coord", "=", "True", ",", "blocksize", "=", "65535", ")", ":", "found", "=", "False", "start", "=", "None", "# start and end vars are th...
Find or read the next ecc entry in a given ecc file. Call this function multiple times with the same file handle to get subsequent markers positions (this is not a generator but it works very similarly, because it will continue reading from the file's current cursor position -- this can be used advantageously if yo...
[ "Find", "or", "read", "the", "next", "ecc", "entry", "in", "a", "given", "ecc", "file", ".", "Call", "this", "function", "multiple", "times", "with", "the", "same", "file", "handle", "to", "get", "subsequent", "markers", "positions", "(", "this", "is", "...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L84-L142
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
remove_if_exist
def remove_if_exist(path): # pragma: no cover """Delete a file or a directory recursively if it exists, else no exception is raised""" if os.path.exists(path): if os.path.isdir(path): shutil.rmtree(path) return True elif os.path.isfile(path): os.remove(path) ...
python
def remove_if_exist(path): # pragma: no cover """Delete a file or a directory recursively if it exists, else no exception is raised""" if os.path.exists(path): if os.path.isdir(path): shutil.rmtree(path) return True elif os.path.isfile(path): os.remove(path) ...
[ "def", "remove_if_exist", "(", "path", ")", ":", "# pragma: no cover", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "shutil", ".", "rmtree", "(", "path", ")", "return", ...
Delete a file or a directory recursively if it exists, else no exception is raised
[ "Delete", "a", "file", "or", "a", "directory", "recursively", "if", "it", "exists", "else", "no", "exception", "is", "raised" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L149-L158
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
copy_any
def copy_any(src, dst, only_missing=False): # pragma: no cover """Copy a file or a directory tree, deleting the destination before processing""" if not only_missing: remove_if_exist(dst) if os.path.exists(src): if os.path.isdir(src): if not only_missing: shutil.c...
python
def copy_any(src, dst, only_missing=False): # pragma: no cover """Copy a file or a directory tree, deleting the destination before processing""" if not only_missing: remove_if_exist(dst) if os.path.exists(src): if os.path.isdir(src): if not only_missing: shutil.c...
[ "def", "copy_any", "(", "src", ",", "dst", ",", "only_missing", "=", "False", ")", ":", "# pragma: no cover", "if", "not", "only_missing", ":", "remove_if_exist", "(", "dst", ")", "if", "os", ".", "path", ".", "exists", "(", "src", ")", ":", "if", "os"...
Copy a file or a directory tree, deleting the destination before processing
[ "Copy", "a", "file", "or", "a", "directory", "tree", "deleting", "the", "destination", "before", "processing" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L160-L182
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
group_files_by_size
def group_files_by_size(fileslist, multi): # pragma: no cover ''' Cluster files into the specified number of groups, where each groups total size is as close as possible to each other. Pseudo-code (O(n^g) time complexity): Input: number of groups G per cluster, list of files F with respective sizes - ...
python
def group_files_by_size(fileslist, multi): # pragma: no cover ''' Cluster files into the specified number of groups, where each groups total size is as close as possible to each other. Pseudo-code (O(n^g) time complexity): Input: number of groups G per cluster, list of files F with respective sizes - ...
[ "def", "group_files_by_size", "(", "fileslist", ",", "multi", ")", ":", "# pragma: no cover", "flord", "=", "OrderedDict", "(", "sorted", "(", "fileslist", ".", "items", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", ...
Cluster files into the specified number of groups, where each groups total size is as close as possible to each other. Pseudo-code (O(n^g) time complexity): Input: number of groups G per cluster, list of files F with respective sizes - Order F by descending size - Until F is empty: - Create a c...
[ "Cluster", "files", "into", "the", "specified", "number", "of", "groups", "where", "each", "groups", "total", "size", "is", "as", "close", "as", "possible", "to", "each", "other", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L204-L260
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
group_files_by_size_fast
def group_files_by_size_fast(fileslist, nbgroups, mode=1): # pragma: no cover '''Given a files list with sizes, output a list where the files are grouped in nbgroups per cluster. Pseudo-code for algorithm in O(n log(g)) (thank's to insertion sort or binary search trees) See for more infos: http://cs.stack...
python
def group_files_by_size_fast(fileslist, nbgroups, mode=1): # pragma: no cover '''Given a files list with sizes, output a list where the files are grouped in nbgroups per cluster. Pseudo-code for algorithm in O(n log(g)) (thank's to insertion sort or binary search trees) See for more infos: http://cs.stack...
[ "def", "group_files_by_size_fast", "(", "fileslist", ",", "nbgroups", ",", "mode", "=", "1", ")", ":", "# pragma: no cover", "ftofill", "=", "SortedList", "(", ")", "ftofill_pointer", "=", "{", "}", "fgrouped", "=", "[", "]", "# [] or {}", "ford", "=", "sort...
Given a files list with sizes, output a list where the files are grouped in nbgroups per cluster. Pseudo-code for algorithm in O(n log(g)) (thank's to insertion sort or binary search trees) See for more infos: http://cs.stackexchange.com/questions/44406/fast-algorithm-for-clustering-groups-of-elements-given-th...
[ "Given", "a", "files", "list", "with", "sizes", "output", "a", "list", "where", "the", "files", "are", "grouped", "in", "nbgroups", "per", "cluster", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L262-L329
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
group_files_by_size_simple
def group_files_by_size_simple(fileslist, nbgroups): # pragma: no cover """ Simple and fast files grouping strategy: just order by size, and group files n-by-n, so that files with the closest sizes are grouped together. In this strategy, there is only one file per subgroup, and thus there will often be remaini...
python
def group_files_by_size_simple(fileslist, nbgroups): # pragma: no cover """ Simple and fast files grouping strategy: just order by size, and group files n-by-n, so that files with the closest sizes are grouped together. In this strategy, there is only one file per subgroup, and thus there will often be remaini...
[ "def", "group_files_by_size_simple", "(", "fileslist", ",", "nbgroups", ")", ":", "# pragma: no cover", "ford", "=", "sorted", "(", "fileslist", ".", "iteritems", "(", ")", ",", "key", "=", "lambda", "x", ":", "x", "[", "1", "]", ",", "reverse", "=", "Tr...
Simple and fast files grouping strategy: just order by size, and group files n-by-n, so that files with the closest sizes are grouped together. In this strategy, there is only one file per subgroup, and thus there will often be remaining space left because there is no filling strategy here, but it's very fast.
[ "Simple", "and", "fast", "files", "grouping", "strategy", ":", "just", "order", "by", "size", "and", "group", "files", "n", "-", "by", "-", "n", "so", "that", "files", "with", "the", "closest", "sizes", "are", "grouped", "together", ".", "In", "this", ...
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L331-L336
lrq3000/pyFileFixity
pyFileFixity/lib/aux_funcs.py
grouped_count_sizes
def grouped_count_sizes(fileslist, fgrouped): # pragma: no cover '''Compute the total size per group and total number of files. Useful to check that everything is OK.''' fsizes = {} total_files = 0 allitems = None if isinstance(fgrouped, dict): allitems = fgrouped.iteritems() elif isins...
python
def grouped_count_sizes(fileslist, fgrouped): # pragma: no cover '''Compute the total size per group and total number of files. Useful to check that everything is OK.''' fsizes = {} total_files = 0 allitems = None if isinstance(fgrouped, dict): allitems = fgrouped.iteritems() elif isins...
[ "def", "grouped_count_sizes", "(", "fileslist", ",", "fgrouped", ")", ":", "# pragma: no cover", "fsizes", "=", "{", "}", "total_files", "=", "0", "allitems", "=", "None", "if", "isinstance", "(", "fgrouped", ",", "dict", ")", ":", "allitems", "=", "fgrouped...
Compute the total size per group and total number of files. Useful to check that everything is OK.
[ "Compute", "the", "total", "size", "per", "group", "and", "total", "number", "of", "files", ".", "Useful", "to", "check", "that", "everything", "is", "OK", "." ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/aux_funcs.py#L338-L356
lrq3000/pyFileFixity
pyFileFixity/lib/gooey/gui/windows/advanced_config.py
ConfigPanel.GetOptions
def GetOptions(self): """ returns the collective values from all of the widgets contained in the panel""" values = [c.GetValue() for c in chain(*self.widgets) if c.GetValue() is not None] return ' '.join(values)
python
def GetOptions(self): """ returns the collective values from all of the widgets contained in the panel""" values = [c.GetValue() for c in chain(*self.widgets) if c.GetValue() is not None] return ' '.join(values)
[ "def", "GetOptions", "(", "self", ")", ":", "values", "=", "[", "c", ".", "GetValue", "(", ")", "for", "c", "in", "chain", "(", "*", "self", ".", "widgets", ")", "if", "c", ".", "GetValue", "(", ")", "is", "not", "None", "]", "return", "' '", "...
returns the collective values from all of the widgets contained in the panel
[ "returns", "the", "collective", "values", "from", "all", "of", "the", "widgets", "contained", "in", "the", "panel" ]
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/gooey/gui/windows/advanced_config.py#L92-L99