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

25 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-01 22:29 +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 type aliases. ''' 

22# ruff: noqa: F403,F405 

23 

24 

25from __future__ import annotations 

26 

27from . import __ 

28from ..nomina import * 

29 

30 

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

32BehaviorExclusionNamesOmni: __.typx.TypeAlias = ( 

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

34BehaviorExclusionPredicate: __.typx.TypeAlias = ( 

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

36BehaviorExclusionPredicates: __.typx.TypeAlias = ( 

37 __.cabc.Sequence[ BehaviorExclusionPredicate ] ) 

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

39BehaviorExclusionRegexes: __.typx.TypeAlias = ( 

40 __.cabc.Sequence[ BehaviorExclusionRegex ] ) 

41BehaviorExclusionVerifier: __.typx.TypeAlias = ( 

42 str | BehaviorExclusionRegex | BehaviorExclusionPredicate ) 

43BehaviorExclusionVerifiers: __.typx.TypeAlias = ( 

44 __.cabc.Sequence[ BehaviorExclusionVerifier ] ) 

45BehaviorExclusionVerifiersOmni: __.typx.TypeAlias = ( 

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

47ErrorClassProvider: __.typx.TypeAlias = ( 

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

49 

50 

51class AssignerCore( __.typx.Protocol ): 

52 ''' Core implementation of attributes assigner. ''' 

53 

54 @staticmethod 

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

56 obj: object, /, *, 

57 ligation: AssignerLigation, 

58 attributes_namer: AttributesNamer, 

59 error_class_provider: ErrorClassProvider, 

60 level: str, 

61 name: str, 

62 value: __.typx.Any, 

63 ) -> None: raise NotImplementedError 

64 

65 

66class DeleterCore( __.typx.Protocol ): 

67 ''' Core implementation of attributes deleter. ''' 

68 

69 @staticmethod 

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

71 obj: object, /, *, 

72 ligation: DeleterLigation, 

73 attributes_namer: AttributesNamer, 

74 error_class_provider: ErrorClassProvider, 

75 level: str, 

76 name: str, 

77 ) -> None: raise NotImplementedError 

78 

79 

80class SurveyorCore( __.typx.Protocol ): 

81 ''' Core implementation of attributes surveyor. ''' 

82 

83 @staticmethod 

84 def __call__( # pragma: no branch 

85 obj: object, /, *, 

86 ligation: SurveyorLigation, 

87 attributes_namer: AttributesNamer, 

88 level: str, 

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

90 

91 

92class ClassPreparer( __.typx.Protocol ): 

93 ''' Prepares class for decorator application. ''' 

94 

95 @staticmethod 

96 def __call__( # pragma: no branch 

97 class_: type, 

98 decorators: DecoratorsMutable, /, *, 

99 attributes_namer: AttributesNamer, 

100 ) -> None: raise NotImplementedError