UnifiedOutputRegistry¶
- class astropy.io.registry.UnifiedOutputRegistry[source]¶
Bases:
_UnifiedIORegistryBase
Write-only Registry.
New in version 5.0.
Methods Summary
get_writer
(data_format, data_class)Get writer for
data_format
.register_writer
(data_format, data_class, ...)Register a table writer function.
unregister_writer
(data_format, data_class)Unregister a writer function
write
(data, *args[, format])Write out data.
Methods Documentation
- get_writer(data_format, data_class)[source]¶
Get writer for
data_format
.- Parameters:
- data_format
python:str
The data format identifier. This is the string that is used to specify the data type when reading/writing.
- data_classclass
The class of the object that can be written.
- data_format
- Returns:
- writer
python:callable()
The registered writer function for this format and class.
- writer
- register_writer(data_format, data_class, function, force=False, priority=0)[source]¶
Register a table writer function.
- Parameters:
- data_format
python:str
The data format identifier. This is the string that will be used to specify the data type when writing.
- data_classclass
The class of the object that can be written.
- functionpython:function
The function to write out a data object.
- forcebool, optional
Whether to override any existing function if already present. Default is
False
.- priority
python:int
, optional The priority of the writer, used to compare possible formats when trying to determine the best writer to use. Higher priorities are preferred over lower priorities, with the default priority being 0 (negative numbers are allowed though).
- data_format
- unregister_writer(data_format, data_class)[source]¶
Unregister a writer function
- Parameters:
- data_format
python:str
The data format identifier.
- data_classclass
The class of the object that can be written.
- data_format
- write(data, *args, format=None, **kwargs)[source]¶
Write out data.
- Parameters:
- data
object
The data to write.
- *args
The arguments passed to this method depend on the format.
- format
python:str
orpython:None
- **kwargs
The arguments passed to this method depend on the format.
- data
- Returns:
object
orpython:None
The output of the registered writer. Most often
None
.New in version 4.3.