pyrokinetics.file_utils.FileReaderFactory

pyrokinetics.file_utils.FileReaderFactory#

class pyrokinetics.file_utils.FileReaderFactory(file_type, super_class=<class 'object'>)[source]#

Bases: Factory

Factory variant in which file type can be inferred from a path as well as a key.

Parameters:
  • file_type (Type)

  • super_class (Type)

__init__(file_type, super_class=<class 'object'>)[source]#
Parameters:

Methods

__init__(file_type[, super_class])

create(key, *args, **kwargs)

Create a new object of type key, forwarding all arguments.

items()

Dict-like items iterator

register(key, cls)

Register a new type with the factory.

type(key)

Returns type associated with a given key.

type(key)[source]#

Returns type associated with a given key. If there is no type registered with that key, tries to infer the type by reading the file. This makes use of the verify_file_type() functions implemented for each registered reader.

Return type:

Type

Parameters:

key (str)