init_modifiers

The init_modifiers module holds methods and decorators related to init methods of classes..

Functions

class_init(*overrides: str | Callable) Callable

Make it so that a function assigns arguments directly to the same-named properties of its containing class.

Parameters:

overrides – Any names that should not be handled directly from the decorator.

dictable(extra_routes: dict | None = None, slices: dict | None = None, needs: Iterable | None = None, needs_not: Iterable | None = None)

Make it so that a function can take a dictionary of its arguments as a single argument. It will still be able to take its normal arguments.

Parameters:
  • extra_routes – Any extra key aliases that should be used to convert dictionaries.

  • slices – Any slices of keys which should be combined into a single input. This has limited testing, so avoid use if possible.

  • needs – Keys that must be in the dictionary in order for it to be interpreted as a dict instantiation. This is only needed if the first argument of the original function can be a dictionary, and the function can be called with only one argument.

  • needs_not – Keys that must not be in the dictionary in order for it to be interpreted as a dict instantiation. This is only needed if the first argument of the original function can be a dictionary, and the function can be called with only one argument.

listable(allow_too_many: bool = False) Callable

Make it so that a function can take a list of its arguments as the only argument. It will still be able to take its normal arguments.

Parameters:

allow_too_many – Should the function ignore extra args?