Coverage for sources/classcore/standard/nomina.py: 100%

32 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-07-20 04:08 +0000

1# vim: set filetype=python fileencoding=utf-8: 

2# -*- coding: utf-8 -*- 

3 

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#============================================================================# 

19 

20 

21''' Catalog of common names and type aliases. ''' 

22# ruff: noqa: F403,F405 

23 

24 

25from ..nomina import * 

26from . import __ 

27 

28concealment_label = 'concealment' 

29immutability_label = 'immutability' 

30 

31 

32BehaviorExclusionNames: __.typx.TypeAlias = __.cabc.Set[ str ] 

33BehaviorExclusionNamesOmni: __.typx.TypeAlias = ( 

34 BehaviorExclusionNames | __.typx.Literal[ '*' ] ) 

35BehaviorExclusionPredicate: __.typx.TypeAlias = ( 

36 __.cabc.Callable[ [ str ], bool ] ) 

37BehaviorExclusionPredicates: __.typx.TypeAlias = ( 

38 __.cabc.Sequence[ BehaviorExclusionPredicate ] ) 

39BehaviorExclusionRegex: __.typx.TypeAlias = __.re.Pattern[ str ] 

40BehaviorExclusionRegexes: __.typx.TypeAlias = ( 

41 __.cabc.Sequence[ BehaviorExclusionRegex ] ) 

42BehaviorExclusionVerifier: __.typx.TypeAlias = ( 

43 str | BehaviorExclusionRegex | BehaviorExclusionPredicate ) 

44BehaviorExclusionVerifiers: __.typx.TypeAlias = ( 

45 __.cabc.Sequence[ BehaviorExclusionVerifier ] ) 

46BehaviorExclusionVerifiersOmni: __.typx.TypeAlias = ( 

47 BehaviorExclusionVerifiers | __.typx.Literal[ '*' ] ) 

48ErrorClassProvider: __.typx.TypeAlias = __.typx.Annotated[ 

49 __.cabc.Callable[ [ str ], type[ Exception ] ], 

50 __.ddoc.Doc( 

51 ''' Takes name of exception class and returns corresponding class. 

52 

53 Can be used by downstream packages to provide exceptions from their 

54 own hierarchies rather than the hierarchy from this package. 

55 ''' ), 

56] 

57 

58 

59class AssignerCore( __.typx.Protocol ): 

60 ''' Core implementation of attributes assigner. ''' 

61 

62 @staticmethod 

63 def __call__( # noqa: PLR0913 # pragma: no branch 

64 obj: object, /, *, 

65 ligation: AssignerLigation, 

66 attributes_namer: AttributesNamer, 

67 error_class_provider: ErrorClassProvider, 

68 level: str, 

69 name: str, 

70 value: __.typx.Any, 

71 ) -> None: raise NotImplementedError 

72 

73 

74class DeleterCore( __.typx.Protocol ): 

75 ''' Core implementation of attributes deleter. ''' 

76 

77 @staticmethod 

78 def __call__( # noqa: PLR0913 # pragma: no branch 

79 obj: object, /, *, 

80 ligation: DeleterLigation, 

81 attributes_namer: AttributesNamer, 

82 error_class_provider: ErrorClassProvider, 

83 level: str, 

84 name: str, 

85 ) -> None: raise NotImplementedError 

86 

87 

88class SurveyorCore( __.typx.Protocol ): 

89 ''' Core implementation of attributes surveyor. ''' 

90 

91 @staticmethod 

92 def __call__( # pragma: no branch 

93 obj: object, /, *, 

94 ligation: SurveyorLigation, 

95 attributes_namer: AttributesNamer, 

96 level: str, 

97 ) -> __.cabc.Iterable[ str ]: raise NotImplementedError 

98 

99 

100class ClassPreparer( __.typx.Protocol ): 

101 ''' Prepares class for decorator application. ''' 

102 

103 @staticmethod 

104 def __call__( # pragma: no branch 

105 class_: type, 

106 decorators: DecoratorsMutable[ __.U ], /, *, 

107 attributes_namer: AttributesNamer, 

108 ) -> None: raise NotImplementedError 

109 

110 

111DynadocConfiguration: __.typx.TypeAlias = __.cabc.Mapping[ str, __.typx.Any ] 

112DynadocContextArgument: __.typx.TypeAlias = __.typx.Annotated[ 

113 __.ddoc.Context, 

114 __.ddoc.Doc( 

115 ''' Dynadoc context. 

116 

117 Renderer, dictionaries for resolution of stringified annotations, 

118 etc.... 

119 ''' ), 

120] 

121DynadocIntrospectionArgument: __.typx.TypeAlias = __.typx.Annotated[ 

122 __.ddoc.IntrospectionControl, 

123 __.ddoc.Doc( 

124 ''' Dynadoc introspection control. 

125 

126 Which kinds of object to recursively introspect? 

127 Scan unnannotated attributes? 

128 Consider base classes? 

129 Etc... 

130 ''' ), 

131] 

132DynadocPreserveArgument: __.typx.TypeAlias = __.typx.Annotated[ 

133 bool, __.ddoc.Doc( ''' Preserve existing docstring? ''' ) 

134] 

135DynadocTableArgument: __.typx.TypeAlias = __.typx.Annotated[ 

136 __.cabc.Mapping[ str, str ], 

137 __.ddoc.Doc( ''' Table of documentation fragments. ''' ), 

138] 

139ProduceDynadocConfigurationReturn: __.typx.TypeAlias = __.typx.Annotated[ 

140 DynadocConfiguration, 

141 __.ddoc.Doc( 

142 ''' Dynadoc configuration dictionary. 

143 

144 Suitable as a keyword expansion (``**``) argument to 

145 ``assign_module_docstring`` or ``with_docstring``. 

146 ''' ), 

147]