1#!/usr/bin/env python3
2"""
3
4"""
5# ruff: noqa:
6
7# Imports:
8from __future__ import annotations
9
10# ##-- stdlib imports
11import datetime
12import enum
13import functools as ftz
14import itertools as itz
15import logging as logmod
16import re
17import time
18import types
19import collections
20import contextlib
21import hashlib
22from copy import deepcopy
23from uuid import UUID, uuid1
24from weakref import ref
25import atexit # for @atexit.register
26import faulthandler
27# ##-- end stdlib imports
28from importlib.metadata import EntryPoint
29from jgdv._abstract.protocols.general import SpecStruct_p
30import doot
31from doot.cmds._interface import Command_p
32
33# ##-- types
34# isort: off
35import abc
36import collections.abc
37from typing import TYPE_CHECKING, cast, assert_type, assert_never
38from typing import Generic, NewType
39# Protocols:
40from typing import Protocol, runtime_checkable
41# Typing Decorators:
42from typing import no_type_check, final, override, overload
43if TYPE_CHECKING:
44 import pathlib as pl
45 from jgdv import Maybe
46 from jgdv.structs.chainguard import ChainGuard
47 from typing import Final
48 from typing import ClassVar, Any, LiteralString
49 from typing import Never, Self, Literal
50 from typing import TypeGuard
51 from collections.abc import Iterable, Iterator, Callable, Generator
52 from collections.abc import Sequence, Mapping, MutableMapping, Hashable
53
54##--|
55
56# isort: on
57# ##-- end types
58
59##-- logging
60logging = logmod.getLogger(__name__)
61##-- end logging
62
63# Types
64type Loaders_p = CommandLoader_p | PluginLoader_p | TaskLoader_p
65type PluginLoader_p = Loader_p[EntryPoint]
66type CommandLoader_p = Loader_p[Command_p]
67type TaskLoader_p = Loader_p[SpecStruct_p]
68# Body:
69
[docs]
70@runtime_checkable
71class Loader_p[T](Protocol):
72
[docs]
73 def setup(self, data:ChainGuard) -> Self: ...
74
[docs]
75 def load(self) -> ChainGuard: ...