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

32 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-08 04:17 +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 . import __ 

26from ..nomina import * 

27 

28 

29concealment_label = 'concealment' 

30immutability_label = 'immutability' 

31 

32 

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

50 __.cabc.Callable[ [ str ], type[ Exception ] ] ) 

51 

52 

53class AssignerCore( __.typx.Protocol ): 

54 ''' Core implementation of attributes assigner. ''' 

55 

56 @staticmethod 

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

58 obj: object, /, *, 

59 ligation: AssignerLigation, 

60 attributes_namer: AttributesNamer, 

61 error_class_provider: ErrorClassProvider, 

62 level: str, 

63 name: str, 

64 value: __.typx.Any, 

65 ) -> None: raise NotImplementedError 

66 

67 

68class DeleterCore( __.typx.Protocol ): 

69 ''' Core implementation of attributes deleter. ''' 

70 

71 @staticmethod 

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

73 obj: object, /, *, 

74 ligation: DeleterLigation, 

75 attributes_namer: AttributesNamer, 

76 error_class_provider: ErrorClassProvider, 

77 level: str, 

78 name: str, 

79 ) -> None: raise NotImplementedError 

80 

81 

82class SurveyorCore( __.typx.Protocol ): 

83 ''' Core implementation of attributes surveyor. ''' 

84 

85 @staticmethod 

86 def __call__( # pragma: no branch 

87 obj: object, /, *, 

88 ligation: SurveyorLigation, 

89 attributes_namer: AttributesNamer, 

90 level: str, 

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

92 

93 

94class ClassPreparer( __.typx.Protocol ): 

95 ''' Prepares class for decorator application. ''' 

96 

97 @staticmethod 

98 def __call__( # pragma: no branch 

99 class_: type, 

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

101 attributes_namer: AttributesNamer, 

102 ) -> None: raise NotImplementedError 

103 

104 

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

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

107 __.dynadoc.Context, 

108 __.dynadoc.Doc( 

109 ''' Dynadoc context. 

110 

111 Renderer, dictionaries for resolution of stringified annotations, 

112 etc.... 

113 ''' ), 

114] 

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

116 __.dynadoc.IntrospectionControl, 

117 __.dynadoc.Doc( 

118 ''' Dynadoc introspection control. 

119 

120 Which kinds of object to recursively introspect? 

121 Scan unnannotated attributes? 

122 Consider base classes? 

123 Etc... 

124 ''' ), 

125] 

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

127 bool, __.dynadoc.Doc( ''' Preserve existing docstring? ''' ) 

128] 

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

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

131 __.dynadoc.Doc( ''' Table of documentation fragments. ''' ), 

132] 

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

134 DynadocConfiguration, 

135 __.dynadoc.Doc( 

136 ''' Dynadoc configuration dictionary. 

137 

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

139 ``assign_module_docstring`` or ``with_docstring``. 

140 ''' ), 

141]