UserOptions

giant.utilities.options:

class giant.utilities.options.UserOptions[source]

This is a class used to create a dataclass of user options.

These options are used to set defaults for parameters set inside the associated class for the options.

Example:

StarIDOptions contains the default options for the StarID class.

Custom objects built from this abstract class must follow the naming scheme <callable_name>Options and be loaded into the options keyword argument for callable_name.__init__().

To apply options to your class, the UserOptions.apply_options() method should be invoked.

for example:
>>> @dataclass
>>> class ExampleOptions(UserOptions):
>>>     example_var : int = 1234
>>> class Example(UserOptions):
>>>     def __init__(self, positional_argument, options = None):
>>>         if options is None:
>>>             options = ExampleOptions()
>>>         options.apply_options(self) #apply the options as attributes of self
>>> my_example = Example()
>>> print(my_example.example_var)
...     1234
override_options()[source]

This method is used for special cases when certain options should be overwritten

local_vars(variables=[], target=None)[source]

this is used to overwrite options in variables only used in __init__

Parameters:
  • variables (list)

  • target (Callable | None)

Return type:

list | TypeVar

apply_options(target)[source]

Update the options as attributes of the object class

Parameters:

target (object) – the instance that we are to update

Return type:

None

property options_dict: Dict

Determine the options input to the dataclass.

This property method will ignore all internal properties and functions