palgen.loaders.loader#

Module Contents#

class palgen.loaders.loader.Kind(*args, **kwds)#
palgen.loaders.loader.Kind enum.Enum enum.Enum palgen.loaders.loader.Kind palgen.loaders.loader.Kind palgen.loaders.loader.Kind palgen.loaders.loader.Kind->enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

PRIVATE#
PUBLIC#
BUILTIN#
__repr__()#

Return repr(self).

__str__()#

Return str(self).

__dir__()#

Returns all members and all public methods

__format__(format_spec)#

Default object formatter.

__hash__()#

Return hash(self).

__reduce_ex__(proto)#

Helper for pickle.

name()#

The name of the Enum member.

value()#

The value of the Enum member.

class palgen.loaders.loader.ExtensionInfo#
palgen.loaders.loader.ExtensionInfo enum.Enum enum.Enum palgen.loaders.loader.ExtensionInfo palgen.loaders.loader.ExtensionInfo palgen.loaders.loader.ExtensionInfo palgen.loaders.loader.Kind palgen.loaders.loader.Kind palgen.loaders.loader.Kind palgen.loaders.loader.Kind->enum.Enum palgen.loaders.loader.Kind->palgen.loaders.loader.ExtensionInfo kind pathlib.Path pathlib.Path pathlib.Path->palgen.loaders.loader.ExtensionInfo path pathlib.PurePath pathlib.PurePath pathlib.Path->pathlib.PurePath
property name: str#
Return type:

str

extension: click.Command | click.Group | Type[palgen.interface.Extension]#
module: str#
path: pathlib.Path#
kind: Kind#
inherited: bool = False#
class palgen.loaders.loader.Loader#
palgen.loaders.loader.Loader palgen.loaders.loader.Loader palgen.loaders.loader.Loader palgen.loaders.loader.Loader
__slots__ = ()#
abstract ingest(sources)#

Searches the given sources for ingestable extensions and loads them.

Parameters:

sources (Iterable[Path | str]) – An iterable of paths to input files or strings

Yields:

tuple[str, Type[Extension]] – name and class of all discovered palgen extensions

Return type:

Iterable[ExtensionInfo]

abstract load(source)#

Attempt loading palgen extensions from the given path or string.

Parameters:

source (Path | str) – Source to load from

Yields:

tuple[str, Type[Extension]] – name and class of all discovered palgen extensions

Return type:

Iterable[ExtensionInfo]