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