Coverage for sources/dynadoc/xtnsapi.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-05-25 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''' Interface for extension development. ''' 

22 

23# ruff: noqa: F403,F405 

24 

25 

26from . import __ 

27 

28from .context import * 

29from .interfaces import * 

30from .introspection import * 

31from .nomina import * 

32 

33 

34FragmentRectifierArgument: __.typx.TypeAlias = __.typx.Annotated[ 

35 FragmentRectifier, Fname( 'fragment rectifier' ) ] 

36FragmentsArgumentMultivalent: __.typx.TypeAlias = __.typx.Annotated[ 

37 Fragment, 

38 Doc( 

39 ''' Fragments from which to produce a docstring. 

40 

41 If fragment is a string, then it will be used as an index 

42 into a table of docstring fragments. 

43 If fragment is a :pep:`727` ``Doc`` object, then the value of its 

44 ``documentation`` attribute will be incorporated. 

45 ''' ), 

46] 

47FragmentsNameArgument: __.typx.TypeAlias = __.typx.Annotated[ 

48 str, Fname( 'fragments name' ) ] 

49InformationsArgument: __.typx.TypeAlias = __.typx.Annotated[ 

50 Informations, 

51 Doc( ''' Information extracted from object introspection. ''' ), 

52] 

53IntrospectionLimitNameArgument: __.typx.TypeAlias = __.typx.Annotated[ 

54 str, Fname( 'introspection limit name' ) ] 

55InvokerGlobalsArgument: __.typx.TypeAlias = __.typx.Annotated[ 

56 __.typx.Optional[ Variables ], Fname( 'invoker globals' ) ] 

57NotifierArgument: __.typx.TypeAlias = __.typx.Annotated[ 

58 Notifier, Fname( 'notifier' ) ] 

59PreserveArgument: __.typx.TypeAlias = __.typx.Annotated[ 

60 bool, Doc( ''' Preserve extant docstring? ''' ) ] 

61ResolverGlobalsArgument: __.typx.TypeAlias = __.typx.Annotated[ 

62 __.typx.Optional[ Variables ], Fname( 'resolver globals' ) ] 

63ResolverLocalsArgument: __.typx.TypeAlias = __.typx.Annotated[ 

64 __.typx.Optional[ Variables ], Fname( 'resolver locals' ) ] 

65VisibilityDeciderArgument: __.typx.TypeAlias = __.typx.Annotated[ 

66 VisibilityDecider, Fname( 'visibility decider' ) ] 

67 

68 

69RendererReturnValue: __.typx.TypeAlias = __.typx.Annotated[ 

70 str, Doc( ''' Rendered docstring fragment. ''' ) ] 

71 

72class Renderer( __.typx.Protocol ): 

73 ''' Produces docstring fragment from object and information about it. ''' 

74 

75 @staticmethod 

76 def __call__( 

77 possessor: PossessorArgument, 

78 informations: InformationsArgument, 

79 context: ContextArgument, 

80 ) -> RendererReturnValue: 

81 ''' (Signature for fragment renderer.) ''' 

82 raise NotImplementedError # pragma: no cover 

83 

84RendererArgument: __.typx.TypeAlias = __.typx.Annotated[ 

85 Renderer, Fname( 'renderer' ) ]