jgdv.structs.strang.code_ref

Type Aliases

CheckType

Classes

CodeReference

A reference to a class or function.

Module Contents

jgdv.structs.strang.code_ref.CheckType: TypeAlias = type | types.UnionType
class jgdv.structs.strang.code_ref.CodeReference(
*args,
value=None,
check=None,
**kwargs,
)[source]

Bases: jgdv.structs.strang.strang.Strang

A reference to a class or function.

can be created from a string (so can be used from toml), or from the actual object (from in python)

Has the form:

[cls::]module.a.b.c:ClassName

Can be built with an imported value directly, and a type to check against

__call__ imports the reference

Parameters:
  • args (Any)

  • value (jgdv.Maybe)

  • check (jgdv.Maybe[CheckType | CheckCancel])

  • kwargs (Any)

_check_imported_type(check=None) <Unknown>[source]
Parameters:

check (jgdv.Maybe[CheckType | CheckCancel])

Return type:

None

_do_import(*, check=None) <Unknown>[source]
Parameters:

check (jgdv.Maybe[CheckType | CheckCancel])

Return type:

Any

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

Literal[True]

classmethod _pre_process_h(
input,
*args,
strict=False,
**kwargs,
) <Unknown>[source]
Parameters:
  • input (Any)

  • args (Any)

  • strict (bool)

  • kwargs (Any)

Return type:

jgdv.MaybeT[bool, *PreProcessResult[T]]

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

args (jgdv.Maybe[CheckType | CheckCancel])

Return type:

jgdv.Maybe[CheckType]

to_alias(group, plugins) <Unknown>[source]

TODO Given a nested dict-like, see if this reference can be reduced to an alias

Parameters:
  • group (str)

  • plugins (dict | jgdv.structs.chainguard.ChainGuard)

Return type:

str

abstractmethod to_uniq(*args) <Unknown>[source]

Generate a concrete instance of this name with a UUID prepended,

ie: a.task.group::task.name..{prefix?}.$gen$.<UUID>

Parameters:

args (str)

Return type:

Never

_check: jgdv.Maybe[CheckType]
_formatter: ClassVar
_processor: ClassVar
_sections: ClassVar
_value = None