Coverage for sources/classcore/standard/nomina.py: 100%
32 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-07-01 05:36 +0000
« prev ^ index » next coverage.py v7.9.1, created at 2025-07-01 05:36 +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 . import __
26from ..nomina import *
29concealment_label = 'concealment'
30immutability_label = 'immutability'
33BehaviorExclusionNames: __.typx.TypeAlias = __.cabc.Set[ str ]
34BehaviorExclusionNamesOmni: __.typx.TypeAlias = (
35 BehaviorExclusionNames | __.typx.Literal[ '*' ] )
36BehaviorExclusionPredicate: __.typx.TypeAlias = (
37 __.cabc.Callable[ [ str ], bool ] )
38BehaviorExclusionPredicates: __.typx.TypeAlias = (
39 __.cabc.Sequence[ BehaviorExclusionPredicate ] )
40BehaviorExclusionRegex: __.typx.TypeAlias = __.re.Pattern[ str ]
41BehaviorExclusionRegexes: __.typx.TypeAlias = (
42 __.cabc.Sequence[ BehaviorExclusionRegex ] )
43BehaviorExclusionVerifier: __.typx.TypeAlias = (
44 str | BehaviorExclusionRegex | BehaviorExclusionPredicate )
45BehaviorExclusionVerifiers: __.typx.TypeAlias = (
46 __.cabc.Sequence[ BehaviorExclusionVerifier ] )
47BehaviorExclusionVerifiersOmni: __.typx.TypeAlias = (
48 BehaviorExclusionVerifiers | __.typx.Literal[ '*' ] )
49ErrorClassProvider: __.typx.TypeAlias = __.typx.Annotated[
50 __.cabc.Callable[ [ str ], type[ Exception ] ],
51 __.ddoc.Doc(
52 ''' Takes name of exception class and returns corresponding class.
54 Can be used by downstream packages to provide exceptions from their
55 own hierarchies rather than the hierarchy from this package.
56 ''' ),
57]
60class AssignerCore( __.typx.Protocol ):
61 ''' Core implementation of attributes assigner. '''
63 @staticmethod
64 def __call__( # noqa: PLR0913 # pragma: no branch
65 obj: object, /, *,
66 ligation: AssignerLigation,
67 attributes_namer: AttributesNamer,
68 error_class_provider: ErrorClassProvider,
69 level: str,
70 name: str,
71 value: __.typx.Any,
72 ) -> None: raise NotImplementedError
75class DeleterCore( __.typx.Protocol ):
76 ''' Core implementation of attributes deleter. '''
78 @staticmethod
79 def __call__( # noqa: PLR0913 # pragma: no branch
80 obj: object, /, *,
81 ligation: DeleterLigation,
82 attributes_namer: AttributesNamer,
83 error_class_provider: ErrorClassProvider,
84 level: str,
85 name: str,
86 ) -> None: raise NotImplementedError
89class SurveyorCore( __.typx.Protocol ):
90 ''' Core implementation of attributes surveyor. '''
92 @staticmethod
93 def __call__( # pragma: no branch
94 obj: object, /, *,
95 ligation: SurveyorLigation,
96 attributes_namer: AttributesNamer,
97 level: str,
98 ) -> __.cabc.Iterable[ str ]: raise NotImplementedError
101class ClassPreparer( __.typx.Protocol ):
102 ''' Prepares class for decorator application. '''
104 @staticmethod
105 def __call__( # pragma: no branch
106 class_: type,
107 decorators: DecoratorsMutable[ __.U ], /, *,
108 attributes_namer: AttributesNamer,
109 ) -> None: raise NotImplementedError
112DynadocConfiguration: __.typx.TypeAlias = __.cabc.Mapping[ str, __.typx.Any ]
113# TODO: Use argument type aliases from 'dynadoc' package.
114DynadocContextArgument: __.typx.TypeAlias = __.typx.Annotated[
115 __.ddoc.Context,
116 __.ddoc.Doc(
117 ''' Dynadoc context.
119 Renderer, dictionaries for resolution of stringified annotations,
120 etc....
121 ''' ),
122]
123DynadocIntrospectionArgument: __.typx.TypeAlias = __.typx.Annotated[
124 __.ddoc.IntrospectionControl,
125 __.ddoc.Doc(
126 ''' Dynadoc introspection control.
128 Which kinds of object to recursively introspect?
129 Scan unnannotated attributes?
130 Consider base classes?
131 Etc...
132 ''' ),
133]
134DynadocPreserveArgument: __.typx.TypeAlias = __.typx.Annotated[
135 bool, __.ddoc.Doc( ''' Preserve existing docstring? ''' )
136]
137DynadocTableArgument: __.typx.TypeAlias = __.typx.Annotated[
138 __.cabc.Mapping[ str, str ],
139 __.ddoc.Doc( ''' Table of documentation fragments. ''' ),
140]
141ProduceDynadocConfigurationReturn: __.typx.TypeAlias = __.typx.Annotated[
142 DynadocConfiguration,
143 __.ddoc.Doc(
144 ''' Dynadoc configuration dictionary.
146 Suitable as a keyword expansion (``**``) argument to
147 ``assign_module_docstring`` or ``with_docstring``.
148 ''' ),
149]