Source code for doot.control.arg_parser_model

 1#!/usr/bin/env python3
 2"""
 3
 4"""
 5# ruff: noqa:
 6# mypy: disable-error-code="attr-defined"
 7# Imports:
 8from __future__ import annotations
 9
10# ##-- stdlib imports
11import atexit#  for @atexit.register
12import collections
13import contextlib
14import datetime
15import enum
16import faulthandler
17import functools as ftz
18import hashlib
19import itertools as itz
20import logging as logmod
21import pathlib as pl
22import re
23import time
24import types
25from copy import deepcopy
26from uuid import UUID, uuid1
27from weakref import ref
28
29# ##-- end stdlib imports
30
31# ##-- 3rd party imports
32from jgdv import Proto
33from jgdv.cli import errors
34from jgdv.cli._interface import (EMPTY_CMD, EXTRA_KEY, ArgParserModel_p, ParamSpec_i,
35                                 ParamSource_p, ParamSpec_p, ParseResult_d, PositionalParam_p)
36from jgdv.cli.param_spec import HelpParam, ParamSpec, SeparatorParam, ParamProcessor
37from jgdv.cli import CLIParserModel
38
39# ##-- end 3rd party imports
40
41# ##-- types
42# isort: off
43import abc
44import collections.abc
45from typing import TYPE_CHECKING, cast, assert_type, assert_never
46from typing import Generic, NewType, Never
47# Protocols:
48from typing import Protocol, runtime_checkable
49# Typing Decorators:
50from typing import no_type_check, final, override, overload
51
52if TYPE_CHECKING:
53    from jgdv import Maybe
54    from typing import Final
55    from typing import ClassVar, Any, LiteralString
56    from typing import Self, Literal
57    from typing import TypeGuard
58    from collections.abc import Iterable, Iterator, Callable, Generator
59    from collections.abc import Sequence, Mapping, MutableMapping, Hashable
60
61##--|
62
63# isort: on
64# ##-- end types
65
66##-- logging
67logging = logmod.getLogger(__name__)
68##-- end logging
69
70# Vars:
71HELP            : Final[ParamSpec]     = HelpParam()
72SEPARATOR       : Final[ParamSpec]     = SeparatorParam()
73# Body:
74
[docs] 75@Proto(ArgParserModel_p) 76class DootArgParserModel(CLIParserModel): 77 """ 78 79 # {prog} {args} {cmd} {cmd_args} 80 # {prog} {args} [{task} {tasks_args}] - implicit do cmd 81 82 """ 83 84 pass