jgdv._abstract.protocols.general

Protocols

ActionGrouper_p

For things have multiple named groups of actions

ArtifactStruct_p

Base class for artifacts, for type matching

Buildable_p

For things that need building, but don't have a separate factory

DILogger_p

Protocol for classes with a dependency injectable logger

ExecutableTask

Runners pass off to Tasks/Jobs implementing this protocol

Factory_p

Factory protocol: {type}.build

FailHandler_p

Base class for protocol classes.

InstantiableSpecification_p

A Specification that can be instantiated further

Loader_p

The protocol for something that will load something from the system, a file, etc

Nameable_p

The core protocol of something use as a name

Persistent_p

A Protocol for persisting data

SpecStruct_p

Base class for specs, for type matching

StubStruct_p

Base class for stubs, for type matching

TomlStubber_p

Something that can be turned into toml

UpToDate_p

For things (often artifacts) which might need to have actions done if they were created too long ago

Visitor_p

Base class for protocol classes.

Module Contents

class jgdv._abstract.protocols.general.ActionGrouper_p[source]

Bases: Protocol

For things have multiple named groups of actions

get_group(name) <Unknown>[source]
Parameters:

name (str)

Return type:

jgdv._abstract.types.Maybe[list]

class jgdv._abstract.protocols.general.ArtifactStruct_p[source]

Bases: Protocol

Base class for artifacts, for type matching

exists(*, data=None) <Unknown>[source]
Return type:

bool

class jgdv._abstract.protocols.general.Buildable_p[source]

Bases: Protocol

For things that need building, but don’t have a separate factory TODO add type parameter

classmethod build(*args) <Unknown>[source]
Parameters:

args (Any)

Return type:

Self

class jgdv._abstract.protocols.general.DILogger_p[source]

Bases: Protocol

Protocol for classes with a dependency injectable logger

logger() <Unknown>[source]
Return type:

Logger

class jgdv._abstract.protocols.general.ExecutableTask[source]

Bases: Protocol

Runners pass off to Tasks/Jobs implementing this protocol instead of using their default logic

check_entry() <Unknown>[source]
Return type:

bool

current_priority() <Unknown>[source]
Return type:

int

current_status() <Unknown>[source]
Return type:

enum.Enum

decrement_priority() <Unknown>[source]
Return type:

None

execute() <Unknown>[source]
Return type:

None

execute_action() <Unknown>[source]
Return type:

None

execute_action_group(group_name) <Unknown>[source]
Parameters:

group_name (str)

Return type:

enum.Enum | list

expand() <Unknown>[source]
Return type:

list

force_status(status) <Unknown>[source]
Parameters:

status (enum.Enum)

Return type:

None

setup() <Unknown>[source]
Return type:

None

teardown() <Unknown>[source]
Return type:

None

class jgdv._abstract.protocols.general.Factory_p[source]

Bases: Protocol

Factory protocol: {type}.build

classmethod build(*args, **kwargs) <Unknown>[source]
Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

T

class jgdv._abstract.protocols.general.FailHandler_p[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...
handle_failure(err, *args, **kwargs) <Unknown>[source]
Parameters:
Return type:

jgdv._abstract.types.Maybe[Any]

class jgdv._abstract.protocols.general.InstantiableSpecification_p[source]

Bases: Protocol

A Specification that can be instantiated further

instantiate_onto(data) <Unknown>[source]
Parameters:

data (jgdv._abstract.types.Maybe[Self])

Return type:

Self

make() <Unknown>[source]
Return type:

Self

class jgdv._abstract.protocols.general.Loader_p[source]

Bases: Protocol

The protocol for something that will load something from the system, a file, etc TODO add a type parameter

load() <Unknown>[source]
Return type:

ChainGuard

setup(extra_config) <Unknown>[source]
Parameters:

extra_config (ChainGuard)

Return type:

Self

class jgdv._abstract.protocols.general.Nameable_p[source]

Bases: Protocol

The core protocol of something use as a name

class jgdv._abstract.protocols.general.Persistent_p[source]

Bases: Protocol

A Protocol for persisting data

read(target) <Unknown>[source]
Parameters:

target (pathlib.Path)

Return type:

None

write(target) <Unknown>[source]
Parameters:

target (pathlib.Path)

Return type:

None

class jgdv._abstract.protocols.general.SpecStruct_p[source]

Bases: Protocol

Base class for specs, for type matching

property args: list[source]
Return type:

list

property kwargs: dict[source]
Return type:

dict

property params: dict | ChainGuard[source]
Return type:

dict | ChainGuard

class jgdv._abstract.protocols.general.StubStruct_p[source]

Bases: Protocol

Base class for stubs, for type matching

to_toml() <Unknown>[source]
Return type:

str

class jgdv._abstract.protocols.general.TomlStubber_p[source]

Bases: Protocol

Something that can be turned into toml

classmethod class_help() <Unknown>[source]
Return type:

str

classmethod stub_class(stub) <Unknown>[source]
Parameters:

stub (StubStruct_p)

Return type:

None

stub_instance(stub) <Unknown>[source]
Parameters:

stub (StubStruct_p)

Return type:

None

property doc: list[str][source]
Return type:

list[str]

property short_doc: str[source]
Return type:

str

class jgdv._abstract.protocols.general.UpToDate_p[source]

Bases: Protocol

For things (often artifacts) which might need to have actions done if they were created too long ago

is_stale(*, other=None) <Unknown>[source]
Parameters:

other (Any)

Return type:

bool

class jgdv._abstract.protocols.general.Visitor_p[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...
visit(**kwargs) <Unknown>[source]
Parameters:

kwargs (Any)

Return type:

Any