rfwtools.example.Factory

class rfwtools.example.Factory(e_type=None, **kwargs)[source]

Bases: object

A class for producing a variety of types of IExample objects

__init__(e_type=None, **kwargs)[source]

Construct a factory for creating Example objects with a default type.

All additional keyword arguments will be passed to the Example type constructor.

Parameters:
  • e_type (Optional[ExampleType]) – The default type of IExample object that will be created.

  • **kwargs – All additional keyword arguments will be passed to the responsible constructor on every get_example() call.

Methods

__init__([e_type])

Construct a factory for creating Example objects with a default type.

get_example([e_type])

Get an IExample object.

Attributes

e_type

The type of example that is to be made.

example_kwargs

kwargs to be passed to example constructor

e_type

The type of example that is to be made.

Type:

(ExampleType)

example_kwargs

kwargs to be passed to example constructor

Type:

(dict of str

Type:

Any)

get_example(e_type=None, **kwargs)[source]

Get an IExample object.

Parameters:
  • e_type (Optional[ExampleType]) – The type of IExample object to create. If None, defaults to the e_type given at construction.

  • **kwargs – All additional keyword arguments will be passed to the responsible constructor on every get_example() call.

Raises:

ValueError – When no e_type is available or if an unsupported e_type is specified.

Return type:

IExample