__init__.py 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. """
  2. pylib: rapid testing and development utils
  3. this module uses apipkg.py for lazy-loading sub modules
  4. and classes. The initpkg-dictionary below specifies
  5. name->value mappings where value can be another namespace
  6. dictionary or an import path.
  7. (c) Holger Krekel and others, 2004-2014
  8. """
  9. from py._error import error
  10. try:
  11. from py._vendored_packages import apipkg
  12. lib_not_mangled_by_packagers = True
  13. vendor_prefix = '._vendored_packages.'
  14. except ImportError:
  15. import apipkg
  16. lib_not_mangled_by_packagers = False
  17. vendor_prefix = ''
  18. __version__ = '1.5.3'
  19. apipkg.initpkg(__name__, attr={'_apipkg': apipkg, 'error': error}, exportdefs={
  20. # access to all standard lib modules
  21. 'std': '._std:std',
  22. '_pydir' : '.__metainfo:pydir',
  23. 'version': 'py:__version__', # backward compatibility
  24. # pytest-2.0 has a flat namespace, we use alias modules
  25. # to keep old references compatible
  26. 'test' : 'pytest',
  27. # hook into the top-level standard library
  28. 'process' : {
  29. '__doc__' : '._process:__doc__',
  30. 'cmdexec' : '._process.cmdexec:cmdexec',
  31. 'kill' : '._process.killproc:kill',
  32. 'ForkedFunc' : '._process.forkedfunc:ForkedFunc',
  33. },
  34. 'apipkg' : {
  35. 'initpkg' : vendor_prefix + 'apipkg:initpkg',
  36. 'ApiModule' : vendor_prefix + 'apipkg:ApiModule',
  37. },
  38. 'iniconfig' : {
  39. 'IniConfig' : vendor_prefix + 'iniconfig:IniConfig',
  40. 'ParseError' : vendor_prefix + 'iniconfig:ParseError',
  41. },
  42. 'path' : {
  43. '__doc__' : '._path:__doc__',
  44. 'svnwc' : '._path.svnwc:SvnWCCommandPath',
  45. 'svnurl' : '._path.svnurl:SvnCommandPath',
  46. 'local' : '._path.local:LocalPath',
  47. 'SvnAuth' : '._path.svnwc:SvnAuth',
  48. },
  49. # python inspection/code-generation API
  50. 'code' : {
  51. '__doc__' : '._code:__doc__',
  52. 'compile' : '._code.source:compile_',
  53. 'Source' : '._code.source:Source',
  54. 'Code' : '._code.code:Code',
  55. 'Frame' : '._code.code:Frame',
  56. 'ExceptionInfo' : '._code.code:ExceptionInfo',
  57. 'Traceback' : '._code.code:Traceback',
  58. 'getfslineno' : '._code.source:getfslineno',
  59. 'getrawcode' : '._code.code:getrawcode',
  60. 'patch_builtins' : '._code.code:patch_builtins',
  61. 'unpatch_builtins' : '._code.code:unpatch_builtins',
  62. '_AssertionError' : '._code.assertion:AssertionError',
  63. '_reinterpret_old' : '._code.assertion:reinterpret_old',
  64. '_reinterpret' : '._code.assertion:reinterpret',
  65. '_reprcompare' : '._code.assertion:_reprcompare',
  66. '_format_explanation' : '._code.assertion:_format_explanation',
  67. },
  68. # backports and additions of builtins
  69. 'builtin' : {
  70. '__doc__' : '._builtin:__doc__',
  71. 'enumerate' : '._builtin:enumerate',
  72. 'reversed' : '._builtin:reversed',
  73. 'sorted' : '._builtin:sorted',
  74. 'any' : '._builtin:any',
  75. 'all' : '._builtin:all',
  76. 'set' : '._builtin:set',
  77. 'frozenset' : '._builtin:frozenset',
  78. 'BaseException' : '._builtin:BaseException',
  79. 'GeneratorExit' : '._builtin:GeneratorExit',
  80. '_sysex' : '._builtin:_sysex',
  81. 'print_' : '._builtin:print_',
  82. '_reraise' : '._builtin:_reraise',
  83. '_tryimport' : '._builtin:_tryimport',
  84. 'exec_' : '._builtin:exec_',
  85. '_basestring' : '._builtin:_basestring',
  86. '_totext' : '._builtin:_totext',
  87. '_isbytes' : '._builtin:_isbytes',
  88. '_istext' : '._builtin:_istext',
  89. '_getimself' : '._builtin:_getimself',
  90. '_getfuncdict' : '._builtin:_getfuncdict',
  91. '_getcode' : '._builtin:_getcode',
  92. 'builtins' : '._builtin:builtins',
  93. 'execfile' : '._builtin:execfile',
  94. 'callable' : '._builtin:callable',
  95. 'bytes' : '._builtin:bytes',
  96. 'text' : '._builtin:text',
  97. },
  98. # input-output helping
  99. 'io' : {
  100. '__doc__' : '._io:__doc__',
  101. 'dupfile' : '._io.capture:dupfile',
  102. 'TextIO' : '._io.capture:TextIO',
  103. 'BytesIO' : '._io.capture:BytesIO',
  104. 'FDCapture' : '._io.capture:FDCapture',
  105. 'StdCapture' : '._io.capture:StdCapture',
  106. 'StdCaptureFD' : '._io.capture:StdCaptureFD',
  107. 'TerminalWriter' : '._io.terminalwriter:TerminalWriter',
  108. 'ansi_print' : '._io.terminalwriter:ansi_print',
  109. 'get_terminal_width' : '._io.terminalwriter:get_terminal_width',
  110. 'saferepr' : '._io.saferepr:saferepr',
  111. },
  112. # small and mean xml/html generation
  113. 'xml' : {
  114. '__doc__' : '._xmlgen:__doc__',
  115. 'html' : '._xmlgen:html',
  116. 'Tag' : '._xmlgen:Tag',
  117. 'raw' : '._xmlgen:raw',
  118. 'Namespace' : '._xmlgen:Namespace',
  119. 'escape' : '._xmlgen:escape',
  120. },
  121. 'log' : {
  122. # logging API ('producers' and 'consumers' connected via keywords)
  123. '__doc__' : '._log:__doc__',
  124. '_apiwarn' : '._log.warning:_apiwarn',
  125. 'Producer' : '._log.log:Producer',
  126. 'setconsumer' : '._log.log:setconsumer',
  127. '_setstate' : '._log.log:setstate',
  128. '_getstate' : '._log.log:getstate',
  129. 'Path' : '._log.log:Path',
  130. 'STDOUT' : '._log.log:STDOUT',
  131. 'STDERR' : '._log.log:STDERR',
  132. 'Syslog' : '._log.log:Syslog',
  133. },
  134. })