Source code for jgdv.structs.dkey.special.str_key

 1#!/usr/bin/env python3
 2"""
 3
 4"""
 5# ruff: noqa: ANN002, ANN003
 6# Imports:
 7from __future__ import annotations
 8
 9# ##-- stdlib imports
10import datetime
11import enum
12import functools as ftz
13import itertools as itz
14import logging as logmod
15import pathlib as pl
16import re
17import string
18import time
19import types
20import weakref
21from uuid import UUID, uuid1
22
23# ##-- end stdlib imports
24
25# ##-- 1st party imports
26from jgdv._abstract.protocols.general import Buildable_p, SpecStruct_p
27from jgdv.structs.strang import CodeReference
28
29# ##-- end 1st party imports
30
31from .._interface import DKeyMark_e
32from ..dkey import DKey
33from ..keys import MultiDKey, NonDKey, SingleDKey
34
35# ##-- types
36# isort: off
37import abc
38import collections.abc
39from typing import TYPE_CHECKING, Generic, cast, assert_type, assert_never
40# Protocols:
41from typing import Protocol, runtime_checkable
42# Typing Decorators:
43from typing import no_type_check, final, override, overload
44
45if TYPE_CHECKING:
46    from typing import Final
47    from typing import ClassVar, Any, LiteralString
48    from typing import Never, Self, Literal
49    from typing import TypeGuard
50    from collections.abc import Iterable, Iterator, Callable, Generator
51    from collections.abc import Sequence, Mapping, MutableMapping, Hashable
52
53    from jgdv import Maybe, Ident, RxStr, Rx
54    from .._interface import KeyMark
55
56# isort: on
57# ##-- end types
58
59##-- logging
60logging = logmod.getLogger(__name__)
61##-- end logging
62
63
[docs] 64class StrDKey(DKey, mark=str, convert="s"): 65 """ 66 A Simple key that always expands to a string 67 """ 68 __slots__ = () 69 70 def __init__(self, *args, **kwargs) -> None: 71 super().__init__(*args, **kwargs) 72 self.data.expansion_type = str 73 self.data.typecheck = str