Coverage for sources/classcore/standard/nomina.py: 100%
36 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-15 18:04 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-15 18:04 +0000
1# vim: set filetype=python fileencoding=utf-8:
2# -*- coding: utf-8 -*-
4#============================================================================#
5# #
6# Licensed under the Apache License, Version 2.0 (the "License"); #
7# you may not use this file except in compliance with the License. #
8# You may obtain a copy of the License at #
9# #
10# http://www.apache.org/licenses/LICENSE-2.0 #
11# #
12# Unless required by applicable law or agreed to in writing, software #
13# distributed under the License is distributed on an "AS IS" BASIS, #
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15# See the License for the specific language governing permissions and #
16# limitations under the License. #
17# #
18#============================================================================#
21''' Catalog of common names and type aliases. '''
22# ruff: noqa: F403,F405
25from ..nomina import *
26from . import __
28concealment_label = 'concealment'
29immutability_label = 'immutability'
32abc_class_mutables = __.abc_class_mutables
33typing_class_mutables = __.typing_class_mutables
36BehaviorExclusionNames: __.typx.TypeAlias = __.cabc.Set[ str ]
37BehaviorExclusionNamesOmni: __.typx.TypeAlias = (
38 BehaviorExclusionNames | __.typx.Literal[ '*' ] )
39BehaviorExclusionPredicate: __.typx.TypeAlias = (
40 __.cabc.Callable[ [ str ], bool ] )
41BehaviorExclusionPredicates: __.typx.TypeAlias = (
42 __.cabc.Sequence[ BehaviorExclusionPredicate ] )
43BehaviorExclusionRegex: __.typx.TypeAlias = __.re.Pattern[ str ]
44BehaviorExclusionRegexes: __.typx.TypeAlias = (
45 __.cabc.Sequence[ BehaviorExclusionRegex ] )
46BehaviorExclusionVerifier: __.typx.TypeAlias = (
47 str | BehaviorExclusionRegex | BehaviorExclusionPredicate )
48BehaviorExclusionVerifiers: __.typx.TypeAlias = (
49 __.cabc.Sequence[ BehaviorExclusionVerifier ] )
50BehaviorExclusionVerifiersOmni: __.typx.TypeAlias = (
51 BehaviorExclusionVerifiers | __.typx.Literal[ '*' ] )
52InternalNameDetector: __.typx.TypeAlias = (
53 __.cabc.Callable[ [ str ], bool ] )
54InternalNameDetectors: __.typx.TypeAlias = (
55 __.cabc.Sequence[ InternalNameDetector ] )
56ErrorClassProvider: __.typx.TypeAlias = __.typx.Annotated[
57 __.cabc.Callable[ [ str ], type[ Exception ] ],
58 __.ddoc.Doc(
59 ''' Takes name of exception class and returns corresponding class.
61 Can be used by downstream packages to provide exceptions from their
62 own hierarchies rather than the hierarchy from this package.
63 ''' ),
64]
67class AssignerCore( __.typx.Protocol ):
68 ''' Core implementation of attributes assigner. '''
70 @staticmethod
71 def __call__( # noqa: PLR0913 # pragma: no branch
72 obj: object, /, *,
73 ligation: AssignerLigation,
74 attributes_namer: AttributesNamer,
75 error_class_provider: ErrorClassProvider,
76 level: str,
77 name: str,
78 value: __.typx.Any,
79 ) -> None: raise NotImplementedError
82class DeleterCore( __.typx.Protocol ):
83 ''' Core implementation of attributes deleter. '''
85 @staticmethod
86 def __call__( # noqa: PLR0913 # pragma: no branch
87 obj: object, /, *,
88 ligation: DeleterLigation,
89 attributes_namer: AttributesNamer,
90 error_class_provider: ErrorClassProvider,
91 level: str,
92 name: str,
93 ) -> None: raise NotImplementedError
96class SurveyorCore( __.typx.Protocol ):
97 ''' Core implementation of attributes surveyor. '''
99 @staticmethod
100 def __call__( # pragma: no branch
101 obj: object, /, *,
102 ligation: SurveyorLigation,
103 attributes_namer: AttributesNamer,
104 level: str,
105 ) -> __.cabc.Iterable[ str ]: raise NotImplementedError
108class ClassPreparer( __.typx.Protocol ):
109 ''' Prepares class for decorator application. '''
111 @staticmethod
112 def __call__( # pragma: no branch
113 class_: type,
114 decorators: DecoratorsMutable[ __.U ], /, *,
115 attributes_namer: AttributesNamer,
116 ) -> None: raise NotImplementedError
119DynadocConfiguration: __.typx.TypeAlias = __.cabc.Mapping[ str, __.typx.Any ]
120DynadocContextArgument: __.typx.TypeAlias = __.typx.Annotated[
121 __.ddoc.Context,
122 __.ddoc.Doc(
123 ''' Dynadoc context.
125 Renderer, dictionaries for resolution of stringified annotations,
126 etc....
127 ''' ),
128]
129DynadocIntrospectionArgument: __.typx.TypeAlias = __.typx.Annotated[
130 __.ddoc.IntrospectionControl,
131 __.ddoc.Doc(
132 ''' Dynadoc introspection control.
134 Which kinds of object to recursively introspect?
135 Scan unnannotated attributes?
136 Consider base classes?
137 Etc...
138 ''' ),
139]
140DynadocPreserveArgument: __.typx.TypeAlias = __.typx.Annotated[
141 bool, __.ddoc.Doc( ''' Preserve existing docstring? ''' )
142]
143DynadocTableArgument: __.typx.TypeAlias = __.typx.Annotated[
144 __.cabc.Mapping[ str, str ],
145 __.ddoc.Doc( ''' Table of documentation fragments. ''' ),
146]
147ProduceDynadocConfigurationReturn: __.typx.TypeAlias = __.typx.Annotated[
148 DynadocConfiguration,
149 __.ddoc.Doc(
150 ''' Dynadoc configuration dictionary.
152 Suitable as a keyword expansion (``**``) argument to
153 ``assign_module_docstring`` or ``with_docstring``.
154 ''' ),
155]