Coverage for /pythoncovmergedfiles/medio/medio/src/py/py/__init__.py: 57%

14 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:35 +0000

1""" 

2pylib: rapid testing and development utils 

3 

4this module uses apipkg.py for lazy-loading sub modules 

5and classes. The initpkg-dictionary below specifies 

6name->value mappings where value can be another namespace 

7dictionary or an import path. 

8 

9(c) Holger Krekel and others, 2004-2014 

10""" 

11from py._error import error 

12 

13try: 

14 from py._vendored_packages import apipkg 

15 lib_not_mangled_by_packagers = True 

16 vendor_prefix = '._vendored_packages.' 

17except ImportError: 

18 import apipkg 

19 lib_not_mangled_by_packagers = False 

20 vendor_prefix = '' 

21 

22try: 

23 from ._version import version as __version__ 

24except ImportError: 

25 # broken installation, we don't even try 

26 __version__ = "unknown" 

27 

28 

29apipkg.initpkg(__name__, attr={'_apipkg': apipkg, 'error': error}, exportdefs={ 

30 # access to all standard lib modules 

31 'std': '._std:std', 

32 

33 '_pydir' : '.__metainfo:pydir', 

34 'version': 'py:__version__', # backward compatibility 

35 

36 # pytest-2.0 has a flat namespace, we use alias modules 

37 # to keep old references compatible 

38 'test' : 'pytest', 

39 

40 # hook into the top-level standard library 

41 'process' : { 

42 '__doc__' : '._process:__doc__', 

43 'cmdexec' : '._process.cmdexec:cmdexec', 

44 'kill' : '._process.killproc:kill', 

45 'ForkedFunc' : '._process.forkedfunc:ForkedFunc', 

46 }, 

47 

48 'apipkg' : { 

49 'initpkg' : vendor_prefix + 'apipkg:initpkg', 

50 'ApiModule' : vendor_prefix + 'apipkg:ApiModule', 

51 }, 

52 

53 'iniconfig' : { 

54 'IniConfig' : vendor_prefix + 'iniconfig:IniConfig', 

55 'ParseError' : vendor_prefix + 'iniconfig:ParseError', 

56 }, 

57 

58 'path' : { 

59 '__doc__' : '._path:__doc__', 

60 'svnwc' : '._path.svnwc:SvnWCCommandPath', 

61 'svnurl' : '._path.svnurl:SvnCommandPath', 

62 'local' : '._path.local:LocalPath', 

63 'SvnAuth' : '._path.svnwc:SvnAuth', 

64 }, 

65 

66 # python inspection/code-generation API 

67 'code' : { 

68 '__doc__' : '._code:__doc__', 

69 'compile' : '._code.source:compile_', 

70 'Source' : '._code.source:Source', 

71 'Code' : '._code.code:Code', 

72 'Frame' : '._code.code:Frame', 

73 'ExceptionInfo' : '._code.code:ExceptionInfo', 

74 'Traceback' : '._code.code:Traceback', 

75 'getfslineno' : '._code.source:getfslineno', 

76 'getrawcode' : '._code.code:getrawcode', 

77 'patch_builtins' : '._code.code:patch_builtins', 

78 'unpatch_builtins' : '._code.code:unpatch_builtins', 

79 '_AssertionError' : '._code.assertion:AssertionError', 

80 '_reinterpret_old' : '._code.assertion:reinterpret_old', 

81 '_reinterpret' : '._code.assertion:reinterpret', 

82 '_reprcompare' : '._code.assertion:_reprcompare', 

83 '_format_explanation' : '._code.assertion:_format_explanation', 

84 }, 

85 

86 # backports and additions of builtins 

87 'builtin' : { 

88 '__doc__' : '._builtin:__doc__', 

89 'enumerate' : '._builtin:enumerate', 

90 'reversed' : '._builtin:reversed', 

91 'sorted' : '._builtin:sorted', 

92 'any' : '._builtin:any', 

93 'all' : '._builtin:all', 

94 'set' : '._builtin:set', 

95 'frozenset' : '._builtin:frozenset', 

96 'BaseException' : '._builtin:BaseException', 

97 'GeneratorExit' : '._builtin:GeneratorExit', 

98 '_sysex' : '._builtin:_sysex', 

99 'print_' : '._builtin:print_', 

100 '_reraise' : '._builtin:_reraise', 

101 '_tryimport' : '._builtin:_tryimport', 

102 'exec_' : '._builtin:exec_', 

103 '_basestring' : '._builtin:_basestring', 

104 '_totext' : '._builtin:_totext', 

105 '_isbytes' : '._builtin:_isbytes', 

106 '_istext' : '._builtin:_istext', 

107 '_getimself' : '._builtin:_getimself', 

108 '_getfuncdict' : '._builtin:_getfuncdict', 

109 '_getcode' : '._builtin:_getcode', 

110 'builtins' : '._builtin:builtins', 

111 'execfile' : '._builtin:execfile', 

112 'callable' : '._builtin:callable', 

113 'bytes' : '._builtin:bytes', 

114 'text' : '._builtin:text', 

115 }, 

116 

117 # input-output helping 

118 'io' : { 

119 '__doc__' : '._io:__doc__', 

120 'dupfile' : '._io.capture:dupfile', 

121 'TextIO' : '._io.capture:TextIO', 

122 'BytesIO' : '._io.capture:BytesIO', 

123 'FDCapture' : '._io.capture:FDCapture', 

124 'StdCapture' : '._io.capture:StdCapture', 

125 'StdCaptureFD' : '._io.capture:StdCaptureFD', 

126 'TerminalWriter' : '._io.terminalwriter:TerminalWriter', 

127 'ansi_print' : '._io.terminalwriter:ansi_print', 

128 'get_terminal_width' : '._io.terminalwriter:get_terminal_width', 

129 'saferepr' : '._io.saferepr:saferepr', 

130 }, 

131 

132 # small and mean xml/html generation 

133 'xml' : { 

134 '__doc__' : '._xmlgen:__doc__', 

135 'html' : '._xmlgen:html', 

136 'Tag' : '._xmlgen:Tag', 

137 'raw' : '._xmlgen:raw', 

138 'Namespace' : '._xmlgen:Namespace', 

139 'escape' : '._xmlgen:escape', 

140 }, 

141 

142 'log' : { 

143 # logging API ('producers' and 'consumers' connected via keywords) 

144 '__doc__' : '._log:__doc__', 

145 '_apiwarn' : '._log.warning:_apiwarn', 

146 'Producer' : '._log.log:Producer', 

147 'setconsumer' : '._log.log:setconsumer', 

148 '_setstate' : '._log.log:setstate', 

149 '_getstate' : '._log.log:getstate', 

150 'Path' : '._log.log:Path', 

151 'STDOUT' : '._log.log:STDOUT', 

152 'STDERR' : '._log.log:STDERR', 

153 'Syslog' : '._log.log:Syslog', 

154 }, 

155 

156})