read_structure_step.formats package#

Subpackages#

Submodules#

read_structure_step.formats.registries module#

This module contains the decorator definitions to register a reader for a given file format and its corresponding format checker. The decorators will automatically add the decorated function to a dictionary to ease extensibility.

read_structure_step.formats.registries.REGISTERED_READERS#

The registry of file formats that can be read. Each entry, which is keyed by the extension including the initial dot, is a dictionary with at least the following:

  • “function”: the function to call to read the file.

  • “description”: the readable name for the format, e.g. “MDL structure-data file”

Type:

dict(str, dict(str, str))

read_structure_step.formats.registries.REGISTERED_FORMAT_CHECKERS#

The registry of functions for checking is an unknown file has a given format.

Type:

dict(str, function)

read_structure_step.formats.registries.FORMAT_METADATA#

Metadata describing a file format.

Type:

dict(str, dict(str, str))

read_structure_step.formats.registries.get_format_metadata(extension)[source]#

Return the metadata for a given extension.

Parameters:

extension (str) – The file format extension, including dot.

Returns:

The metadata as a dictionary.

Return type:

dict(str, any)

read_structure_step.formats.registries.last_resort_checker(format, fn)[source]#

Sets the reader for a list of formats if there is no reader registered.

Parameters:
  • format (str) – File extension indicating format, e.g. ‘.pdb’

  • fn (function) – The function that checks the file

read_structure_step.formats.registries.last_resort_reader(formats, fn)[source]#

Sets the reader for a list of formats if there is no reader registered.

Parameters:
  • formats ((str)) – An iterable list of formats handled by the function of last resort.

  • fn (function) – The function of last resort.

read_structure_step.formats.registries.last_resort_writer(formats, fn)[source]#

Sets the writer for a list of formats if there is no writer registered.

Parameters:
  • formats ((str)) – An iterable list of formats handled by the function of last resort.

  • fn (function) – The function of last resort.

read_structure_step.formats.registries.register_format_checker(file_format)[source]#
read_structure_step.formats.registries.register_reader(file_format)[source]#
read_structure_step.formats.registries.register_writer(file_format)[source]#

A decorator for registering structure file writers.

read_structure_step.formats.registries.set_format_metadata(extensions, **kwargs)[source]#

Set the metadata for the given extensions.

Parameters:
  • extensions (str or iterable) – Either a single extension as a string or a lost of extensions that this metadata applies to.

  • **kwargs – Keyword arguments giving the metadata.

read_structure_step.formats.which module#

read_structure_step.formats.which.which(program)[source]#

Module contents#