fabio.fabioutils

Package fabio :: Module fabioutils |
[hide private]
[frames] | no frames]

# Module fabioutils

source code

General purpose utilities functions for fabio

Classes | [hide private]
| FilenameObject The 'meaning' of a filename ...
| StringIO just an interface providing the name and mode property to a StringIO
| File wrapper for "file" with locking
| UnknownCompressedFile wrapper for "File" with locking
| GzipFile Just a wrapper forgzip.GzipFile providing the correct seek capabilities for python 2.5
| BZ2File Wrapper with lock

Functions | [hide private]
deprecated(func) used to deprecate a function/method: prints a lot of warning messages to enforce the modifaction of the code | source code
getnum(name) # try to figure out a file number # guess it starts at the back | source code
numstem(name) cant see how to do without reversing strings Match 1 or more digits going backwards from the end of the string | source code
deconstruct_filename(*arg, **kw) decorator that deprecates the use of a function | source code
construct_filename(filename, frame=None) Try to construct the filename for a given frame | source code
next_filename(name, padding=True) increment number | source code
previous_filename(name, padding=True) decrement number | source code
jump_filename(name, num, padding=True) jump to number | source code
extract_filenumber(name) extract file number | source code
isAscii(name, listExcluded=None) Returns: True of False whether name is pure ascii or not | source code
toAscii(name, excluded=None) Returns: the name with all non valid char removed | source code
nice_int(s) Workaround that int('1.0') raises an exception | source code

Variables | [hide private]
| logger = `logging.getLogger("fabioutils")`
| FILETYPES = ``{``'``cbf``'``:` `[``'``cbf``'``]``,` `'``cbf.bz2``'``:` `[``'``cbf``'``]``,` `'``cbf.gz``'``:` `[``'``c``...``
| COMPRESSORS = ``{``'``.bz2``'``:` `'``bzip2 -dc` `'``,` `'``.gz``'``:` `'``gzip -dc` `'``}``
| dictAscii = ``{`None`:` `[``'``` `'``,` `'``!``'``,` `'``"``'``,` `'``#``'``,` `'``$``'``,` `'``%``'``,` `'``&``'``,` `'``\'``'``,` `'``...``
| lines = ``'``bzip2, a block-sorting file compressor. Version 1.0.``...``
| __package__ = ``'``fabio``'``
| i = `126`
| key = ``'``cbf``'``

Function Details | [hide private]

### deconstruct_filename(*arg, **kw) | source code
decorator that deprecates the use of a function Decorators: `@deprecated`

### isAscii(name, listExcluded=None) | source code
Parameters: `name` - string to check `listExcluded` - list of char or string excluded. Returns: True of False whether name is pure ascii or not

### toAscii(name, excluded=None) | source code
Parameters: `name` - string to check `excluded` - tuple of char or string excluded (not list: they are mutable). Returns: the name with all non valid char removed

### nice_int(s) | source code
Workaround that int('1.0') raises an exception Parameters: `s` - string to be converted to integer

Variables Details | [hide private]

  ### FILETYPES Value:
      {'cbf': ['cbf'],
       'cbf.bz2': ['cbf'],
       'cbf.gz': ['cbf'],
       'cor': ['edf'],
       'cor.bz2': ['edf'],
       'cor.gz': ['edf'],
       'dm3': ['dm3'],
       'dm3.bz2': ['dm3'],
      ...

  ### dictAscii Value:
      {None: [' ',
              '!',
              '"',
              '#',
              '$',
              '%',
              '&',
              '\'',
      ...

  ### lines Value:
      '''bzip2, a block-sorting file compressor.  Version 1.0.5, 10-Dec-2007
      .

         usage: bzip2 [flags and input files in any order]

         -h --help           print this message
         -d --decompress     force decompression
         -z --compress       force compression
      ...