File handler to support different file extensions. Uses reflectometry’s registry utility.
The default readers are found in the ‘readers’ sub-module and registered by default at initialization time.
To add a new default reader, one must register it in the register_readers method found in readers/__init__.py.
A utility method (find_plugins) is available to inspect a directory (for instance, a user plug-in directory) and look for new readers/writers.
Bases: object
Utility class to use the Registry as a singleton.
alias of type
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
x.__str__() <==> str(x)
list of weak references to the object (if defined)
Internal method used to test the uniqueness of the registry object
Append a reader object to readers
Parameters: |
|
---|
Look into a module to find whether it contains a Reader class. If so, append it to readers and (potentially) to the list of writers for the given extension
Parameters: |
|
---|
Find plugins in a given directory
Parameters: | dir – directory to look into to find new readers/writers |
---|
Load a file
Parameters: |
|
---|---|
Returns: | DataInfo object |
Save a DataInfo object to file :param file: file name (path) :param data: DataInfo object :param format: format to write the data in
Bases: data_util.registry.ExtensionRegistry
Registry class for file format extensions. Readers and writers are supported.
alias of type
x.__delattr__(‘name’) <==> del x.name
x.__getattribute__(‘name’) <==> x.name
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__(‘name’, value) <==> x.name = value
x.__str__() <==> str(x)
list of weak references to the object (if defined)
Look into a module to find whether it contains a Reader class. If so, add it to readers and (potentially) to the list of writers. :param module: module object
Append a reader object to readers
Parameters: |
|
---|
Look into a module to find whether it contains a Reader class. If so, APPEND it to readers and (potentially) to the list of writers for the given extension
Parameters: |
|
---|
Return a sorted list of registered extensions.
Find readers in a given directory. This method can be used to inspect user plug-in directories to find new readers/writers.
Parameters: | dir – directory to search into |
---|---|
Returns: | number of readers found |
Return a sorted list of the registered formats.
Call the loader for the file type of path.
Parameters: |
|
---|
Defaults to the ascii (multi-column) reader if no reader was registered for the file’s extension.
Return the loader associated with the file type of path.
Raises ValueError if file type is not known.
Returns: | the loader associated with the file type of path. |
---|---|
Raises ValueError: | |
if file type is not known. |
Call the writer for the file type of path.
Raises ValueError if no writer is available. Raises KeyError if format is not available.
May raise a writer-defined exception if writer fails.