bee_python 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. data/LICENSE +202 -0
  2. data/build/README +23 -0
  3. data/egg/egg/build.yml +70 -0
  4. data/egg/egg/ez_setup.py +280 -0
  5. data/egg/egg/script.py +12 -0
  6. data/egg/egg/setup.erb +11 -0
  7. data/egg/egg/suite.py +37 -0
  8. data/egg/egg/test.py +31 -0
  9. data/egg/egg.yml +69 -0
  10. data/egg/http/build.erb +53 -0
  11. data/egg/http/server.py +34 -0
  12. data/egg/http.yml +50 -0
  13. data/egg/mysql/mysql.py +43 -0
  14. data/egg/mysql.yml +44 -0
  15. data/egg/project/build.erb +77 -0
  16. data/egg/project/script.py +42 -0
  17. data/egg/project/test.py +31 -0
  18. data/egg/project.yml +59 -0
  19. data/egg/script/build.erb +35 -0
  20. data/egg/script/script.py +42 -0
  21. data/egg/script.yml +50 -0
  22. data/egg/soap/build.erb +52 -0
  23. data/egg/soap/client.py +18 -0
  24. data/egg/soap/server.py +30 -0
  25. data/egg/soap.yml +58 -0
  26. data/egg/source/source.py +42 -0
  27. data/egg/source.yml +47 -0
  28. data/egg/test/test.py +28 -0
  29. data/egg/test.yml +44 -0
  30. data/egg/xmlrpc/build.erb +52 -0
  31. data/egg/xmlrpc/client.py +22 -0
  32. data/egg/xmlrpc/server.py +24 -0
  33. data/egg/xmlrpc.yml +51 -0
  34. data/lib/bee_task_python.rb +390 -0
  35. data/test/build.yml +16 -0
  36. data/test/tc_bee_task_python.rb +27 -0
  37. data/test/test_build.rb +26 -0
  38. data/test/test_build_listener.rb +62 -0
  39. data/test/ts_bee_python.rb +26 -0
  40. data/tools/common/__init__.py +5 -0
  41. data/tools/common/common/__init__.py +140 -0
  42. data/tools/common/common/__pkginfo__.py +43 -0
  43. data/tools/common/common/adbh.py +35 -0
  44. data/tools/common/common/cache.py +114 -0
  45. data/tools/common/common/changelog.py +234 -0
  46. data/tools/common/common/clcommands.py +181 -0
  47. data/tools/common/common/cli.py +212 -0
  48. data/tools/common/common/compat.py +328 -0
  49. data/tools/common/common/configuration.py +1087 -0
  50. data/tools/common/common/contexts.py +58 -0
  51. data/tools/common/common/corbautils.py +117 -0
  52. data/tools/common/common/daemon.py +171 -0
  53. data/tools/common/common/date.py +279 -0
  54. data/tools/common/common/db.py +49 -0
  55. data/tools/common/common/dbf.py +229 -0
  56. data/tools/common/common/debugger.py +208 -0
  57. data/tools/common/common/decorators.py +190 -0
  58. data/tools/common/common/deprecation.py +118 -0
  59. data/tools/common/common/fileutils.py +409 -0
  60. data/tools/common/common/graph.py +259 -0
  61. data/tools/common/common/html.py +142 -0
  62. data/tools/common/common/interface.py +76 -0
  63. data/tools/common/common/logging_ext.py +166 -0
  64. data/tools/common/common/modutils.py +670 -0
  65. data/tools/common/common/optik_ext.py +383 -0
  66. data/tools/common/common/optparser.py +92 -0
  67. data/tools/common/common/pdf_ext.py +111 -0
  68. data/tools/common/common/proc.py +276 -0
  69. data/tools/common/common/pyro_ext.py +146 -0
  70. data/tools/common/common/pytest.py +754 -0
  71. data/tools/common/common/shellutils.py +383 -0
  72. data/tools/common/common/sphinx_ext.py +87 -0
  73. data/tools/common/common/sphinxutils.py +122 -0
  74. data/tools/common/common/sqlgen.py +31 -0
  75. data/tools/common/common/table.py +930 -0
  76. data/tools/common/common/tasksqueue.py +97 -0
  77. data/tools/common/common/test/__init__.py +1 -0
  78. data/tools/common/common/test/data/ChangeLog +184 -0
  79. data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  80. data/tools/common/common/test/data/__init__.py +1 -0
  81. data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
  82. data/tools/common/common/test/data/content_differ_dir/README +1 -0
  83. data/tools/common/common/test/data/content_differ_dir/subdir/coin +1 -0
  84. data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +53 -0
  85. data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
  86. data/tools/common/common/test/data/file_differ_dir/README +1 -0
  87. data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +53 -0
  88. data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  89. data/tools/common/common/test/data/find_test/__init__.py +0 -0
  90. data/tools/common/common/test/data/find_test/foo.txt +0 -0
  91. data/tools/common/common/test/data/find_test/module.py +0 -0
  92. data/tools/common/common/test/data/find_test/module2.py +0 -0
  93. data/tools/common/common/test/data/find_test/newlines.txt +0 -0
  94. data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
  95. data/tools/common/common/test/data/find_test/nonregr.py +0 -0
  96. data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
  97. data/tools/common/common/test/data/find_test/spam.txt +0 -0
  98. data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
  99. data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
  100. data/tools/common/common/test/data/find_test/test.ini +0 -0
  101. data/tools/common/common/test/data/find_test/test1.msg +0 -0
  102. data/tools/common/common/test/data/find_test/test2.msg +0 -0
  103. data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
  104. data/tools/common/common/test/data/foo.txt +9 -0
  105. data/tools/common/common/test/data/module.py +88 -0
  106. data/tools/common/common/test/data/module2.py +77 -0
  107. data/tools/common/common/test/data/newlines.txt +3 -0
  108. data/tools/common/common/test/data/noendingnewline.py +36 -0
  109. data/tools/common/common/test/data/nonregr.py +14 -0
  110. data/tools/common/common/test/data/normal_file.txt +0 -0
  111. data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
  112. data/tools/common/common/test/data/reference_dir/README +1 -0
  113. data/tools/common/common/test/data/reference_dir/subdir/coin +1 -0
  114. data/tools/common/common/test/data/reference_dir/subdir/toto.txt +53 -0
  115. data/tools/common/common/test/data/same_dir/NOTHING +0 -0
  116. data/tools/common/common/test/data/same_dir/README +1 -0
  117. data/tools/common/common/test/data/same_dir/subdir/coin +1 -0
  118. data/tools/common/common/test/data/same_dir/subdir/toto.txt +53 -0
  119. data/tools/common/common/test/data/spam.txt +9 -0
  120. data/tools/common/common/test/data/sub/doc.txt +1 -0
  121. data/tools/common/common/test/data/sub/momo.py +1 -0
  122. data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
  123. data/tools/common/common/test/data/subdir_differ_dir/README +1 -0
  124. data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +1 -0
  125. data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +53 -0
  126. data/tools/common/common/test/data/test.ini +20 -0
  127. data/tools/common/common/test/data/test1.msg +30 -0
  128. data/tools/common/common/test/data/test2.msg +42 -0
  129. data/tools/common/common/test/data/write_protected_file.txt +0 -0
  130. data/tools/common/common/test/foomod.py +17 -0
  131. data/tools/common/common/test/unittest_cache.py +129 -0
  132. data/tools/common/common/test/unittest_changelog.py +37 -0
  133. data/tools/common/common/test/unittest_compat.py +239 -0
  134. data/tools/common/common/test/unittest_configuration.py +348 -0
  135. data/tools/common/common/test/unittest_date.py +154 -0
  136. data/tools/common/common/test/unittest_decorators.py +62 -0
  137. data/tools/common/common/test/unittest_deprecation.py +76 -0
  138. data/tools/common/common/test/unittest_fileutils.py +133 -0
  139. data/tools/common/common/test/unittest_graph.py +50 -0
  140. data/tools/common/common/test/unittest_html.py +76 -0
  141. data/tools/common/common/test/unittest_interface.py +87 -0
  142. data/tools/common/common/test/unittest_modutils.py +244 -0
  143. data/tools/common/common/test/unittest_pytest.py +50 -0
  144. data/tools/common/common/test/unittest_shellutils.py +248 -0
  145. data/tools/common/common/test/unittest_table.py +448 -0
  146. data/tools/common/common/test/unittest_taskqueue.py +71 -0
  147. data/tools/common/common/test/unittest_testlib.py +956 -0
  148. data/tools/common/common/test/unittest_textutils.py +247 -0
  149. data/tools/common/common/test/unittest_tree.py +248 -0
  150. data/tools/common/common/test/unittest_umessage.py +55 -0
  151. data/tools/common/common/test/unittest_ureports_html.py +64 -0
  152. data/tools/common/common/test/unittest_ureports_text.py +105 -0
  153. data/tools/common/common/test/unittest_xmlutils.py +75 -0
  154. data/tools/common/common/test/utils.py +87 -0
  155. data/tools/common/common/testlib.py +1927 -0
  156. data/tools/common/common/textutils.py +476 -0
  157. data/tools/common/common/tree.py +372 -0
  158. data/tools/common/common/umessage.py +161 -0
  159. data/tools/common/common/ureports/__init__.py +174 -0
  160. data/tools/common/common/ureports/docbook_writer.py +139 -0
  161. data/tools/common/common/ureports/html_writer.py +131 -0
  162. data/tools/common/common/ureports/nodes.py +201 -0
  163. data/tools/common/common/ureports/text_writer.py +140 -0
  164. data/tools/common/common/vcgutils.py +216 -0
  165. data/tools/common/common/visitor.py +107 -0
  166. data/tools/common/common/xmlrpcutils.py +136 -0
  167. data/tools/common/common/xmlutils.py +61 -0
  168. data/tools/compile/compile.py +16 -0
  169. data/tools/coverage/coverage.py +602 -0
  170. data/tools/epydoc/__init__.py +227 -0
  171. data/tools/epydoc/__init__.pyc +0 -0
  172. data/tools/epydoc/apidoc.py +2203 -0
  173. data/tools/epydoc/apidoc.pyc +0 -0
  174. data/tools/epydoc/checker.py +349 -0
  175. data/tools/epydoc/checker.pyc +0 -0
  176. data/tools/epydoc/cli.py +1470 -0
  177. data/tools/epydoc/cli.pyc +0 -0
  178. data/tools/epydoc/compat.py +250 -0
  179. data/tools/epydoc/compat.pyc +0 -0
  180. data/tools/epydoc/docbuilder.py +1358 -0
  181. data/tools/epydoc/docbuilder.pyc +0 -0
  182. data/tools/epydoc/docintrospecter.py +1056 -0
  183. data/tools/epydoc/docintrospecter.pyc +0 -0
  184. data/tools/epydoc/docparser.py +2113 -0
  185. data/tools/epydoc/docparser.pyc +0 -0
  186. data/tools/epydoc/docstringparser.py +1111 -0
  187. data/tools/epydoc/docstringparser.pyc +0 -0
  188. data/tools/epydoc/docwriter/__init__.py +12 -0
  189. data/tools/epydoc/docwriter/__init__.pyc +0 -0
  190. data/tools/epydoc/docwriter/dotgraph.py +1351 -0
  191. data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
  192. data/tools/epydoc/docwriter/html.py +3491 -0
  193. data/tools/epydoc/docwriter/html.pyc +0 -0
  194. data/tools/epydoc/docwriter/html_colorize.py +909 -0
  195. data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
  196. data/tools/epydoc/docwriter/html_css.py +550 -0
  197. data/tools/epydoc/docwriter/html_css.pyc +0 -0
  198. data/tools/epydoc/docwriter/html_help.py +190 -0
  199. data/tools/epydoc/docwriter/html_help.pyc +0 -0
  200. data/tools/epydoc/docwriter/latex.py +1187 -0
  201. data/tools/epydoc/docwriter/latex.pyc +0 -0
  202. data/tools/epydoc/docwriter/plaintext.py +276 -0
  203. data/tools/epydoc/docwriter/plaintext.pyc +0 -0
  204. data/tools/epydoc/docwriter/xlink.py +505 -0
  205. data/tools/epydoc/docwriter/xlink.pyc +0 -0
  206. data/tools/epydoc/gui.py +1148 -0
  207. data/tools/epydoc/gui.pyc +0 -0
  208. data/tools/epydoc/log.py +204 -0
  209. data/tools/epydoc/log.pyc +0 -0
  210. data/tools/epydoc/markup/__init__.py +623 -0
  211. data/tools/epydoc/markup/__init__.pyc +0 -0
  212. data/tools/epydoc/markup/doctest.py +311 -0
  213. data/tools/epydoc/markup/doctest.pyc +0 -0
  214. data/tools/epydoc/markup/epytext.py +2116 -0
  215. data/tools/epydoc/markup/epytext.pyc +0 -0
  216. data/tools/epydoc/markup/javadoc.py +250 -0
  217. data/tools/epydoc/markup/javadoc.pyc +0 -0
  218. data/tools/epydoc/markup/plaintext.py +78 -0
  219. data/tools/epydoc/markup/plaintext.pyc +0 -0
  220. data/tools/epydoc/markup/pyval_repr.py +532 -0
  221. data/tools/epydoc/markup/pyval_repr.pyc +0 -0
  222. data/tools/epydoc/markup/restructuredtext.py +906 -0
  223. data/tools/epydoc/markup/restructuredtext.pyc +0 -0
  224. data/tools/epydoc/test/__init__.py +97 -0
  225. data/tools/epydoc/test/__init__.pyc +0 -0
  226. data/tools/epydoc/test/util.py +226 -0
  227. data/tools/epydoc/test/util.pyc +0 -0
  228. data/tools/epydoc/util.py +289 -0
  229. data/tools/epydoc/util.pyc +0 -0
  230. data/tools/logilab/logilab/__init__.py +5 -0
  231. data/tools/logilab/logilab/astng/__init__.py +82 -0
  232. data/tools/logilab/logilab/astng/__pkginfo__.py +76 -0
  233. data/tools/logilab/logilab/astng/_exceptions.py +64 -0
  234. data/tools/logilab/logilab/astng/_nodes_ast.py +667 -0
  235. data/tools/logilab/logilab/astng/_nodes_compiler.py +758 -0
  236. data/tools/logilab/logilab/astng/bases.py +608 -0
  237. data/tools/logilab/logilab/astng/builder.py +239 -0
  238. data/tools/logilab/logilab/astng/inference.py +426 -0
  239. data/tools/logilab/logilab/astng/inspector.py +289 -0
  240. data/tools/logilab/logilab/astng/manager.py +421 -0
  241. data/tools/logilab/logilab/astng/mixins.py +165 -0
  242. data/tools/logilab/logilab/astng/node_classes.py +848 -0
  243. data/tools/logilab/logilab/astng/nodes.py +85 -0
  244. data/tools/logilab/logilab/astng/nodes_as_string.py +389 -0
  245. data/tools/logilab/logilab/astng/patchcomptransformer.py +159 -0
  246. data/tools/logilab/logilab/astng/protocols.py +333 -0
  247. data/tools/logilab/logilab/astng/raw_building.py +212 -0
  248. data/tools/logilab/logilab/astng/rebuilder.py +307 -0
  249. data/tools/logilab/logilab/astng/scoped_nodes.py +951 -0
  250. data/tools/logilab/logilab/astng/test/__init__.py +19 -0
  251. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  252. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
  253. data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +33 -0
  254. data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +20 -0
  255. data/tools/logilab/logilab/astng/test/data/__init__.py +20 -0
  256. data/tools/logilab/logilab/astng/test/data/all.py +29 -0
  257. data/tools/logilab/logilab/astng/test/data/appl/__init__.py +23 -0
  258. data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +30 -0
  259. data/tools/logilab/logilab/astng/test/data/format.py +34 -0
  260. data/tools/logilab/logilab/astng/test/data/module.py +90 -0
  261. data/tools/logilab/logilab/astng/test/data/module2.py +112 -0
  262. data/tools/logilab/logilab/astng/test/data/noendingnewline.py +57 -0
  263. data/tools/logilab/logilab/astng/test/data/nonregr.py +76 -0
  264. data/tools/logilab/logilab/astng/test/data/notall.py +28 -0
  265. data/tools/logilab/logilab/astng/test/data2/__init__.py +20 -0
  266. data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +51 -0
  267. data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +32 -0
  268. data/tools/logilab/logilab/astng/test/regrtest.py +135 -0
  269. data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +22 -0
  270. data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +31 -0
  271. data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +68 -0
  272. data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +24 -0
  273. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +20 -0
  274. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +20 -0
  275. data/tools/logilab/logilab/astng/test/unittest_builder.py +684 -0
  276. data/tools/logilab/logilab/astng/test/unittest_inference.py +1112 -0
  277. data/tools/logilab/logilab/astng/test/unittest_inspector.py +105 -0
  278. data/tools/logilab/logilab/astng/test/unittest_lookup.py +302 -0
  279. data/tools/logilab/logilab/astng/test/unittest_manager.py +98 -0
  280. data/tools/logilab/logilab/astng/test/unittest_nodes.py +302 -0
  281. data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +501 -0
  282. data/tools/logilab/logilab/astng/test/unittest_utils.py +104 -0
  283. data/tools/logilab/logilab/astng/utils.py +342 -0
  284. data/tools/logilab/logilab/common/__init__.py +140 -0
  285. data/tools/logilab/logilab/common/__pkginfo__.py +43 -0
  286. data/tools/logilab/logilab/common/adbh.py +35 -0
  287. data/tools/logilab/logilab/common/cache.py +114 -0
  288. data/tools/logilab/logilab/common/changelog.py +234 -0
  289. data/tools/logilab/logilab/common/clcommands.py +181 -0
  290. data/tools/logilab/logilab/common/cli.py +212 -0
  291. data/tools/logilab/logilab/common/compat.py +328 -0
  292. data/tools/logilab/logilab/common/configuration.py +1087 -0
  293. data/tools/logilab/logilab/common/contexts.py +58 -0
  294. data/tools/logilab/logilab/common/corbautils.py +117 -0
  295. data/tools/logilab/logilab/common/daemon.py +171 -0
  296. data/tools/logilab/logilab/common/date.py +279 -0
  297. data/tools/logilab/logilab/common/db.py +49 -0
  298. data/tools/logilab/logilab/common/dbf.py +229 -0
  299. data/tools/logilab/logilab/common/debugger.py +208 -0
  300. data/tools/logilab/logilab/common/decorators.py +190 -0
  301. data/tools/logilab/logilab/common/deprecation.py +118 -0
  302. data/tools/logilab/logilab/common/fileutils.py +409 -0
  303. data/tools/logilab/logilab/common/graph.py +259 -0
  304. data/tools/logilab/logilab/common/html.py +142 -0
  305. data/tools/logilab/logilab/common/interface.py +76 -0
  306. data/tools/logilab/logilab/common/logging_ext.py +166 -0
  307. data/tools/logilab/logilab/common/modutils.py +670 -0
  308. data/tools/logilab/logilab/common/optik_ext.py +383 -0
  309. data/tools/logilab/logilab/common/optparser.py +92 -0
  310. data/tools/logilab/logilab/common/pdf_ext.py +111 -0
  311. data/tools/logilab/logilab/common/proc.py +276 -0
  312. data/tools/logilab/logilab/common/pyro_ext.py +146 -0
  313. data/tools/logilab/logilab/common/pytest.py +754 -0
  314. data/tools/logilab/logilab/common/shellutils.py +383 -0
  315. data/tools/logilab/logilab/common/sphinx_ext.py +87 -0
  316. data/tools/logilab/logilab/common/sphinxutils.py +122 -0
  317. data/tools/logilab/logilab/common/sqlgen.py +31 -0
  318. data/tools/logilab/logilab/common/table.py +930 -0
  319. data/tools/logilab/logilab/common/tasksqueue.py +97 -0
  320. data/tools/logilab/logilab/common/test/__init__.py +1 -0
  321. data/tools/logilab/logilab/common/test/data/ChangeLog +184 -0
  322. data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  323. data/tools/logilab/logilab/common/test/data/__init__.py +1 -0
  324. data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
  325. data/tools/logilab/logilab/common/test/data/content_differ_dir/README +1 -0
  326. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +1 -0
  327. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +53 -0
  328. data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
  329. data/tools/logilab/logilab/common/test/data/file_differ_dir/README +1 -0
  330. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +53 -0
  331. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  332. data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
  333. data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
  334. data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
  335. data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
  336. data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
  337. data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
  338. data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
  339. data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
  340. data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
  341. data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
  342. data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
  343. data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
  344. data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
  345. data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
  346. data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
  347. data/tools/logilab/logilab/common/test/data/foo.txt +9 -0
  348. data/tools/logilab/logilab/common/test/data/module.py +88 -0
  349. data/tools/logilab/logilab/common/test/data/module2.py +77 -0
  350. data/tools/logilab/logilab/common/test/data/newlines.txt +3 -0
  351. data/tools/logilab/logilab/common/test/data/noendingnewline.py +36 -0
  352. data/tools/logilab/logilab/common/test/data/nonregr.py +14 -0
  353. data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
  354. data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
  355. data/tools/logilab/logilab/common/test/data/reference_dir/README +1 -0
  356. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +1 -0
  357. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +53 -0
  358. data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
  359. data/tools/logilab/logilab/common/test/data/same_dir/README +1 -0
  360. data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +1 -0
  361. data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +53 -0
  362. data/tools/logilab/logilab/common/test/data/spam.txt +9 -0
  363. data/tools/logilab/logilab/common/test/data/sub/doc.txt +1 -0
  364. data/tools/logilab/logilab/common/test/data/sub/momo.py +1 -0
  365. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
  366. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +1 -0
  367. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +1 -0
  368. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +53 -0
  369. data/tools/logilab/logilab/common/test/data/test.ini +20 -0
  370. data/tools/logilab/logilab/common/test/data/test1.msg +30 -0
  371. data/tools/logilab/logilab/common/test/data/test2.msg +42 -0
  372. data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
  373. data/tools/logilab/logilab/common/test/foomod.py +17 -0
  374. data/tools/logilab/logilab/common/test/unittest_cache.py +129 -0
  375. data/tools/logilab/logilab/common/test/unittest_changelog.py +37 -0
  376. data/tools/logilab/logilab/common/test/unittest_compat.py +239 -0
  377. data/tools/logilab/logilab/common/test/unittest_configuration.py +348 -0
  378. data/tools/logilab/logilab/common/test/unittest_date.py +154 -0
  379. data/tools/logilab/logilab/common/test/unittest_decorators.py +62 -0
  380. data/tools/logilab/logilab/common/test/unittest_deprecation.py +76 -0
  381. data/tools/logilab/logilab/common/test/unittest_fileutils.py +133 -0
  382. data/tools/logilab/logilab/common/test/unittest_graph.py +50 -0
  383. data/tools/logilab/logilab/common/test/unittest_html.py +76 -0
  384. data/tools/logilab/logilab/common/test/unittest_interface.py +87 -0
  385. data/tools/logilab/logilab/common/test/unittest_modutils.py +244 -0
  386. data/tools/logilab/logilab/common/test/unittest_pytest.py +50 -0
  387. data/tools/logilab/logilab/common/test/unittest_shellutils.py +248 -0
  388. data/tools/logilab/logilab/common/test/unittest_table.py +448 -0
  389. data/tools/logilab/logilab/common/test/unittest_taskqueue.py +71 -0
  390. data/tools/logilab/logilab/common/test/unittest_testlib.py +956 -0
  391. data/tools/logilab/logilab/common/test/unittest_textutils.py +247 -0
  392. data/tools/logilab/logilab/common/test/unittest_tree.py +248 -0
  393. data/tools/logilab/logilab/common/test/unittest_umessage.py +55 -0
  394. data/tools/logilab/logilab/common/test/unittest_ureports_html.py +64 -0
  395. data/tools/logilab/logilab/common/test/unittest_ureports_text.py +105 -0
  396. data/tools/logilab/logilab/common/test/unittest_xmlutils.py +75 -0
  397. data/tools/logilab/logilab/common/test/utils.py +87 -0
  398. data/tools/logilab/logilab/common/testlib.py +1927 -0
  399. data/tools/logilab/logilab/common/textutils.py +476 -0
  400. data/tools/logilab/logilab/common/tree.py +372 -0
  401. data/tools/logilab/logilab/common/umessage.py +161 -0
  402. data/tools/logilab/logilab/common/ureports/__init__.py +174 -0
  403. data/tools/logilab/logilab/common/ureports/docbook_writer.py +139 -0
  404. data/tools/logilab/logilab/common/ureports/html_writer.py +131 -0
  405. data/tools/logilab/logilab/common/ureports/nodes.py +201 -0
  406. data/tools/logilab/logilab/common/ureports/text_writer.py +140 -0
  407. data/tools/logilab/logilab/common/vcgutils.py +216 -0
  408. data/tools/logilab/logilab/common/visitor.py +107 -0
  409. data/tools/logilab/logilab/common/xmlrpcutils.py +136 -0
  410. data/tools/logilab/logilab/common/xmlutils.py +61 -0
  411. data/tools/pychecker/COPYRIGHT +31 -0
  412. data/tools/pychecker/ChangeLog +349 -0
  413. data/tools/pychecker/CodeChecks.py +1969 -0
  414. data/tools/pychecker/CodeChecks.pyc +0 -0
  415. data/tools/pychecker/CodeChecks.pyo +0 -0
  416. data/tools/pychecker/Config.py +475 -0
  417. data/tools/pychecker/Config.pyc +0 -0
  418. data/tools/pychecker/Config.pyo +0 -0
  419. data/tools/pychecker/KNOWN_BUGS +100 -0
  420. data/tools/pychecker/MAINTAINERS +81 -0
  421. data/tools/pychecker/NEWS +406 -0
  422. data/tools/pychecker/OP.py +131 -0
  423. data/tools/pychecker/OP.pyc +0 -0
  424. data/tools/pychecker/OP.pyo +0 -0
  425. data/tools/pychecker/OptionTypes.py +117 -0
  426. data/tools/pychecker/OptionTypes.pyc +0 -0
  427. data/tools/pychecker/OptionTypes.pyo +0 -0
  428. data/tools/pychecker/README +152 -0
  429. data/tools/pychecker/Stack.py +115 -0
  430. data/tools/pychecker/Stack.pyc +0 -0
  431. data/tools/pychecker/Stack.pyo +0 -0
  432. data/tools/pychecker/TODO +101 -0
  433. data/tools/pychecker/VERSION +1 -0
  434. data/tools/pychecker/Warning.py +50 -0
  435. data/tools/pychecker/Warning.pyc +0 -0
  436. data/tools/pychecker/Warning.pyo +0 -0
  437. data/tools/pychecker/__init__.py +17 -0
  438. data/tools/pychecker/__init__.pyc +0 -0
  439. data/tools/pychecker/__init__.pyo +0 -0
  440. data/tools/pychecker/checker.py +961 -0
  441. data/tools/pychecker/checker.pyc +0 -0
  442. data/tools/pychecker/checker.pyo +0 -0
  443. data/tools/pychecker/function.py +159 -0
  444. data/tools/pychecker/function.pyc +0 -0
  445. data/tools/pychecker/function.pyo +0 -0
  446. data/tools/pychecker/msgs.py +175 -0
  447. data/tools/pychecker/msgs.pyc +0 -0
  448. data/tools/pychecker/msgs.pyo +0 -0
  449. data/tools/pychecker/options.py +275 -0
  450. data/tools/pychecker/options.pyc +0 -0
  451. data/tools/pychecker/options.pyo +0 -0
  452. data/tools/pychecker/pcmodules.py +19 -0
  453. data/tools/pychecker/pcmodules.pyc +0 -0
  454. data/tools/pychecker/pcmodules.pyo +0 -0
  455. data/tools/pychecker/printer.py +47 -0
  456. data/tools/pychecker/printer.pyc +0 -0
  457. data/tools/pychecker/printer.pyo +0 -0
  458. data/tools/pychecker/python.py +427 -0
  459. data/tools/pychecker/python.pyc +0 -0
  460. data/tools/pychecker/python.pyo +0 -0
  461. data/tools/pychecker/utils.py +102 -0
  462. data/tools/pychecker/utils.pyc +0 -0
  463. data/tools/pychecker/utils.pyo +0 -0
  464. data/tools/pychecker/warn.py +778 -0
  465. data/tools/pychecker/warn.pyc +0 -0
  466. data/tools/pychecker/warn.pyo +0 -0
  467. data/tools/pylint2/pylint/__init__.py +16 -0
  468. data/tools/pylint2/pylint/__pkginfo__.py +67 -0
  469. data/tools/pylint2/pylint/checkers/__init__.py +155 -0
  470. data/tools/pylint2/pylint/checkers/base.py +749 -0
  471. data/tools/pylint2/pylint/checkers/classes.py +527 -0
  472. data/tools/pylint2/pylint/checkers/design_analysis.py +344 -0
  473. data/tools/pylint2/pylint/checkers/exceptions.py +183 -0
  474. data/tools/pylint2/pylint/checkers/format.py +367 -0
  475. data/tools/pylint2/pylint/checkers/imports.py +379 -0
  476. data/tools/pylint2/pylint/checkers/logging.py +98 -0
  477. data/tools/pylint2/pylint/checkers/misc.py +128 -0
  478. data/tools/pylint2/pylint/checkers/newstyle.py +107 -0
  479. data/tools/pylint2/pylint/checkers/raw_metrics.py +125 -0
  480. data/tools/pylint2/pylint/checkers/similar.py +333 -0
  481. data/tools/pylint2/pylint/checkers/string_format.py +239 -0
  482. data/tools/pylint2/pylint/checkers/typecheck.py +364 -0
  483. data/tools/pylint2/pylint/checkers/utils.py +208 -0
  484. data/tools/pylint2/pylint/checkers/variables.py +498 -0
  485. data/tools/pylint2/pylint/config.py +149 -0
  486. data/tools/pylint2/pylint/epylint.py +149 -0
  487. data/tools/pylint2/pylint/gui.py +433 -0
  488. data/tools/pylint2/pylint/interfaces.py +98 -0
  489. data/tools/pylint2/pylint/lint.py +914 -0
  490. data/tools/pylint2/pylint/pyreverse/__init__.py +5 -0
  491. data/tools/pylint2/pylint/pyreverse/diadefslib.py +229 -0
  492. data/tools/pylint2/pylint/pyreverse/diagrams.py +247 -0
  493. data/tools/pylint2/pylint/pyreverse/main.py +123 -0
  494. data/tools/pylint2/pylint/pyreverse/utils.py +131 -0
  495. data/tools/pylint2/pylint/pyreverse/writer.py +196 -0
  496. data/tools/pylint2/pylint/reporters/__init__.py +67 -0
  497. data/tools/pylint2/pylint/reporters/guireporter.py +36 -0
  498. data/tools/pylint2/pylint/reporters/html.py +69 -0
  499. data/tools/pylint2/pylint/reporters/text.py +156 -0
  500. data/tools/pylint2/pylint/utils.py +518 -0
  501. data/tools/pylint2/pylint.py +16 -0
  502. data/tools/test/suite.py +35 -0
  503. metadata +566 -0
@@ -0,0 +1,97 @@
1
+ # epydoc -- Regression testing
2
+ #
3
+ # Copyright (C) 2005 Edward Loper
4
+ # Author: Edward Loper <edloper@loper.org>
5
+ # URL: <http://epydoc.sf.net>
6
+ #
7
+ # $Id: __init__.py,v 1.1 2009/11/26 13:20:53 casa Exp $
8
+
9
+ """
10
+ Regression testing.
11
+ """
12
+ __docformat__ = 'epytext en'
13
+
14
+ import unittest, doctest, epydoc, os, os.path, re, sys
15
+
16
+ def main():
17
+ try:
18
+ doctest.register_optionflag
19
+ except:
20
+ print ("\n"
21
+ "The regression test suite requires a more recent version of\n"
22
+ "doctest (e.g., the version that ships with Python 2.4 or 2.5).\n"
23
+ "Please place a new version of doctest on your path before \n"
24
+ "running the test suite.\n")
25
+ return
26
+
27
+
28
+ PY24 = doctest.register_optionflag('PYTHON2.4')
29
+ """Flag indicating that a doctest example requires Python 2.4+"""
30
+
31
+ PY25 = doctest.register_optionflag('PYTHON2.5')
32
+ """Flag indicating that a doctest example requires Python 2.5+"""
33
+
34
+ class DocTestParser(doctest.DocTestParser):
35
+ """
36
+ Custom doctest parser that adds support for two new flags
37
+ +PYTHON2.4 and +PYTHON2.5.
38
+ """
39
+ def parse(self, string, name='<string>'):
40
+ pieces = doctest.DocTestParser.parse(self, string, name)
41
+ for i, val in enumerate(pieces):
42
+ if (isinstance(val, doctest.Example) and
43
+ ((val.options.get(PY24, False) and
44
+ sys.version[:2] < (2,4)) or
45
+ (val.options.get(PY25, False) and
46
+ sys.version[:2] < (2,5)))):
47
+ pieces[i] = doctest.Example('1', '1')
48
+ return pieces
49
+
50
+ # Turn on debugging.
51
+ epydoc.DEBUG = True
52
+
53
+ # Options for doctest:
54
+ options = doctest.ELLIPSIS
55
+ doctest.set_unittest_reportflags(doctest.REPORT_UDIFF)
56
+
57
+ # Use a custom parser
58
+ parser = DocTestParser()
59
+
60
+ # Find all test cases.
61
+ tests = []
62
+ testdir = os.path.join(os.path.split(__file__)[0])
63
+ if testdir == '': testdir = '.'
64
+ for filename in os.listdir(testdir):
65
+ if (filename.endswith('.doctest') and
66
+ check_requirements(os.path.join(testdir, filename))):
67
+ tests.append(doctest.DocFileSuite(filename, optionflags=options,
68
+ parser=parser))
69
+
70
+ # Run all test cases.
71
+ unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(tests))
72
+
73
+ def check_requirements(filename):
74
+ """
75
+ Search for strings of the form::
76
+
77
+ [Require: <module>]
78
+
79
+ If any are found, then try importing the module named <module>.
80
+ If the import fails, then return False. If all required modules
81
+ are found, return True. (This includes the case where no
82
+ requirements are listed.)
83
+ """
84
+ s = open(filename).read()
85
+ for m in re.finditer('(?mi)^[ ]*\:RequireModule:(.*)$', s):
86
+ module = m.group(1).strip()
87
+ try:
88
+ __import__(module)
89
+ except ImportError:
90
+ print ('Skipping %r (required module %r not found)' %
91
+ (os.path.split(filename)[-1], module))
92
+ return False
93
+ return True
94
+
95
+
96
+ if __name__=='__main__':
97
+ main()
Binary file
@@ -0,0 +1,226 @@
1
+ #
2
+ # epydoc -- Utility functions used by regression tests (*.doctest)
3
+ # Edward Loper
4
+ #
5
+ # Created [01/30/01 05:18 PM]
6
+ # $Id: util.py,v 1.1 2009/11/26 13:20:53 casa Exp $
7
+ #
8
+
9
+ """
10
+ Utility functions used by the regression tests (C{*.doctest}).
11
+ """
12
+ __docformat__ = 'epytext en'
13
+
14
+ import tempfile, re, os, os.path, textwrap, sys
15
+ from epydoc.docbuilder import build_doc, build_doc_index
16
+ from epydoc.docparser import parse_docs
17
+ from epydoc.docintrospecter import introspect_docs
18
+ from epydoc.apidoc import ClassDoc, RoutineDoc
19
+ from epydoc.markup import ParsedDocstring
20
+ from epydoc.docwriter.html import HTMLWriter
21
+
22
+ ######################################################################
23
+ #{ Test Functions
24
+ ######################################################################
25
+
26
+ def buildvaluedoc(s):
27
+ """
28
+ This test function takes a string containing the contents of a
29
+ module. It writes the string contents to a file, imports the file
30
+ as a module, and uses build_doc to build documentation, and
31
+ returns it as a C{ValueDoc} object.
32
+ """
33
+ tmp_dir = write_pystring_to_tmp_dir(s)
34
+ val_doc = build_doc(os.path.join(tmp_dir, 'epydoc_test.py'))
35
+ cleanup_tmp_dir(tmp_dir)
36
+ return val_doc
37
+
38
+ def runbuilder(s, attribs='', build=None, exclude=''):
39
+ """
40
+ This test function takes a string containing the contents of a
41
+ module. It writes the string contents to a file, imports the file
42
+ as a module, and uses build_doc to build documentation, and pretty
43
+ prints the resulting ModuleDoc object. The C{attribs} argument
44
+ specifies which attributes of the C{APIDoc}s should be displayed.
45
+ The C{build} argument gives the name of a variable in the module
46
+ whose documentation should be built, instead of bilding docs for
47
+ the whole module.
48
+ """
49
+ # Write it to a temp file.
50
+ tmp_dir = write_pystring_to_tmp_dir(s)
51
+ # Build it.
52
+ val_doc = build_doc(os.path.join(tmp_dir, 'epydoc_test.py'))
53
+ if build: val_doc = val_doc.variables[build].value
54
+ # Display it.
55
+ if isinstance(val_doc, ClassDoc):
56
+ for val in val_doc.variables.values():
57
+ if isinstance(val.value, RoutineDoc):
58
+ fun_to_plain(val.value)
59
+ s = val_doc.pp(include=attribs.split(),exclude=exclude.split())
60
+ s = re.sub(r"(filename = ).*", r"\1...", s)
61
+ s = re.sub(r"(<module 'epydoc_test' from ).*", r'\1...', s)
62
+ s = re.sub(r"(<function \w+ at )0x\w+>", r"\1...>", s)
63
+ s = re.sub(r"(<\w+ object at )0x\w+>", r"\1...>", s)
64
+ print s
65
+ # Clean up.
66
+ cleanup_tmp_dir(tmp_dir)
67
+
68
+ def runparser(s, attribs='', show=None, exclude=''):
69
+ """
70
+ This test function takes a string containing the contents of a
71
+ module, and writes it to a file, uses `parse_docs` to parse it,
72
+ and pretty prints the resulting ModuleDoc object. The `attribs`
73
+ argument specifies which attributes of the `APIDoc`s should be
74
+ displayed. The `show` argument, if specifies, gives the name of
75
+ the object in the module that should be displayed (but the whole
76
+ module will always be inspected; this just selects what to
77
+ display).
78
+ """
79
+ # Write it to a temp file.
80
+ tmp_dir = write_pystring_to_tmp_dir(s)
81
+ # Parse it.
82
+ val_doc = parse_docs(os.path.join(tmp_dir, 'epydoc_test.py'))
83
+ if show is not None:
84
+ for name in show.split('.'):
85
+ if isinstance(val_doc, ClassDoc):
86
+ val_doc = val_doc.local_variables[name].value
87
+ else:
88
+ val_doc = val_doc.variables[name].value
89
+ # Display it.
90
+ s = val_doc.pp(include=attribs.split(), exclude=exclude.split())
91
+ s = re.sub(r"filename = .*", "filename = ...", s)
92
+ print s
93
+ # Clean up.
94
+ cleanup_tmp_dir(tmp_dir)
95
+
96
+ def runintrospecter(s, attribs='', introspect=None, exclude=''):
97
+ """
98
+ This test function takes a string containing the contents of a
99
+ module. It writes the string contents to a file, imports the file
100
+ as a module, and uses C{introspect_docs} to introspect it, and
101
+ pretty prints the resulting ModuleDoc object. The C{attribs}
102
+ argument specifies which attributes of the C{APIDoc}s should be
103
+ displayed. The C{introspect} argument gives the name of a variable
104
+ in the module whose value should be introspected, instead of
105
+ introspecting the whole module.
106
+ """
107
+ # Write it to a temp file.
108
+ tmp_dir = write_pystring_to_tmp_dir(s)
109
+ # Import it.
110
+ sys.path.insert(0, tmp_dir)
111
+ if introspect is None:
112
+ import epydoc_test as val
113
+ else:
114
+ exec("from epydoc_test import %s as val" % introspect)
115
+ del sys.path[0]
116
+ # Introspect it.
117
+ val_doc = introspect_docs(val)
118
+ # Display it.
119
+ s = val_doc.pp(include=attribs.split(),exclude=exclude.split())
120
+ s = re.sub(r"(filename = ).*", r"\1...", s)
121
+ s = re.sub(r"(<module 'epydoc_test' from ).*", r'\1...', s)
122
+ s = re.sub(r"(<function \w+ at )0x\w+>", r"\1...>", s)
123
+ s = re.sub(r"(<\w+ object at )0x\w+>", r"\1...>", s)
124
+ print s
125
+ # Clean up.
126
+ cleanup_tmp_dir(tmp_dir)
127
+
128
+ def print_warnings():
129
+ """
130
+ Register a logger that will print warnings & errors.
131
+ """
132
+ from epydoc import log
133
+ del log._loggers[:]
134
+ log.register_logger(log.SimpleLogger(log.DOCSTRING_WARNING))
135
+
136
+ def testencoding(s, introspect=True, parse=True, debug=False):
137
+ """
138
+ An end-to-end test for unicode encodings. This function takes a
139
+ given string, writes it to a python file, and processes that
140
+ file's documentation. It then generates HTML output from the
141
+ documentation, extracts all docstrings from the generated HTML
142
+ output, and displays them. (In order to extract & display all
143
+ docstrings, it monkey-patches the HMTLwriter.docstring_to_html()
144
+ method.)"""
145
+ # Monkey-patch docstring_to_html
146
+ original_docstring_to_html = HTMLWriter.docstring_to_html
147
+ HTMLWriter.docstring_to_html = print_docstring_as_html
148
+
149
+ # Write s to a temporary file.
150
+ tmp_dir = tempfile.mkdtemp()
151
+ path = os.path.join(tmp_dir, 'enc_test.py')
152
+ out = open(path, 'w')
153
+ out.write(textwrap.dedent(s))
154
+ out.close()
155
+ # Build docs for it
156
+ docindex = build_doc_index([path], introspect, parse)
157
+ if docindex is None: return
158
+ sys.modules.pop('enc_test', None)
159
+ # Write html output.
160
+ writer = HTMLWriter(docindex, mark_docstrings=True)
161
+ writer.write(tmp_dir)
162
+ for file in os.listdir(tmp_dir):
163
+ os.unlink(os.path.join(tmp_dir,file))
164
+ os.rmdir(tmp_dir)
165
+
166
+ # Restore the HTMLWriter class to its original state.
167
+ HTMLWriter.docstring_to_html = original_docstring_to_html
168
+
169
+ ######################################################################
170
+ #{ Helper Functions
171
+ ######################################################################
172
+
173
+ def write_pystring_to_tmp_dir(s):
174
+ tmp_dir = tempfile.mkdtemp()
175
+ out = open(os.path.join(tmp_dir, 'epydoc_test.py'), 'w')
176
+ out.write(textwrap.dedent(s))
177
+ out.close()
178
+ return tmp_dir
179
+
180
+ def cleanup_tmp_dir(tmp_dir):
181
+ os.unlink(os.path.join(tmp_dir, 'epydoc_test.py'))
182
+ try: os.unlink(os.path.join(tmp_dir, 'epydoc_test.pyc'))
183
+ except OSError: pass
184
+ os.rmdir(tmp_dir)
185
+ sys.modules.pop('epydoc_test', None)
186
+
187
+ def to_plain(docstring):
188
+ """Conver a parsed docstring into plain text"""
189
+ if isinstance(docstring, ParsedDocstring):
190
+ docstring = docstring.to_plaintext(None)
191
+ return docstring.rstrip()
192
+
193
+ def fun_to_plain(val_doc):
194
+ """Convert parsed docstrings in text from a RoutineDoc"""
195
+ for k, v in val_doc.arg_types.items():
196
+ val_doc.arg_types[k] = to_plain(v)
197
+ for i, (k, v) in enumerate(val_doc.arg_descrs):
198
+ val_doc.arg_descrs[i] = (k, to_plain(v))
199
+
200
+ def print_docstring_as_html(self, parsed_docstring, *varargs, **kwargs):
201
+ """
202
+ Convert the given parsed_docstring to HTML and print it. Ignore
203
+ any other arguments. This function is used by L{testencoding} to
204
+ monkey-patch the HTMLWriter class's docstring_to_html() method.
205
+ """
206
+ s = parsed_docstring.to_html(None).strip()
207
+ s = s.encode('ascii', 'xmlcharrefreplace')
208
+ s = remove_surrogates(s)
209
+ print s
210
+ return ''
211
+
212
+ def remove_surrogates(s):
213
+ """
214
+ The following is a helper function, used to convert two-character
215
+ surrogate sequences into single characters. This is needed
216
+ because some systems create surrogates but others don't.
217
+ """
218
+ pieces = re.split('(&#\d+;)', s)
219
+ for i in range(3, len(pieces)-1, 2):
220
+ if pieces[i-1] != '': continue
221
+ high,low = int(pieces[i-2][2:-1]), int(pieces[i][2:-1])
222
+ if 0xd800 <= high <= 0xdbff and 0xdc00 <= low <= 0xdfff:
223
+ pieces[i-2] = '&#%d;' % (((high&0x3ff)<<10) +
224
+ (low&0x3ff) + 0x10000)
225
+ pieces[i] = ''
226
+ return ''.join(pieces)
Binary file
@@ -0,0 +1,289 @@
1
+ # epydoc -- Utility functions
2
+ #
3
+ # Copyright (C) 2005 Edward Loper
4
+ # Author: Edward Loper <edloper@loper.org>
5
+ # URL: <http://epydoc.sf.net>
6
+ #
7
+ # $Id: util.py,v 1.1 2009/11/26 13:20:42 casa Exp $
8
+
9
+ """
10
+ Miscellaneous utility functions that are used by multiple modules.
11
+
12
+ @group Python source types: is_module_file, is_package_dir, is_pyname,
13
+ py_src_filename
14
+ @group Text processing: wordwrap, decode_with_backslashreplace,
15
+ plaintext_to_html
16
+ """
17
+ __docformat__ = 'epytext en'
18
+
19
+ import os, os.path, re
20
+
21
+ ######################################################################
22
+ ## Python Source Types
23
+ ######################################################################
24
+
25
+ PY_SRC_EXTENSIONS = ['.py', '.pyw']
26
+ PY_BIN_EXTENSIONS = ['.pyc', '.so', '.pyd']
27
+
28
+ def is_module_file(path):
29
+ # Make sure it's a file name.
30
+ if not isinstance(path, basestring):
31
+ return False
32
+ (dir, filename) = os.path.split(path)
33
+ (basename, extension) = os.path.splitext(filename)
34
+ return (os.path.isfile(path) and
35
+ re.match('[a-zA-Z_]\w*$', basename) and
36
+ extension in PY_SRC_EXTENSIONS+PY_BIN_EXTENSIONS)
37
+
38
+ def is_src_filename(filename):
39
+ if not isinstance(filename, basestring): return False
40
+ if not os.path.exists(filename): return False
41
+ return os.path.splitext(filename)[1] in PY_SRC_EXTENSIONS
42
+
43
+ def is_package_dir(dirname):
44
+ """
45
+ Return true if the given directory is a valid package directory
46
+ (i.e., it names a directory that contains a valid __init__ file,
47
+ and its name is a valid identifier).
48
+ """
49
+ # Make sure it's a directory name.
50
+ if not isinstance(dirname, basestring):
51
+ return False
52
+ if not os.path.isdir(dirname):
53
+ return False
54
+ dirname = os.path.abspath(dirname)
55
+ # Make sure it's a valid identifier. (Special case for
56
+ # "foo/", where os.path.split -> ("foo", "").)
57
+ (parent, dir) = os.path.split(dirname)
58
+ if dir == '': (parent, dir) = os.path.split(parent)
59
+
60
+ # The following constraint was removed because of sourceforge
61
+ # bug #1787028 -- in some cases (eg eggs), it's too strict.
62
+ #if not re.match('\w+$', dir):
63
+ # return False
64
+
65
+ for name in os.listdir(dirname):
66
+ filename = os.path.join(dirname, name)
67
+ if name.startswith('__init__.') and is_module_file(filename):
68
+ return True
69
+ else:
70
+ return False
71
+
72
+ def is_pyname(name):
73
+ return re.match(r"\w+(\.\w+)*$", name)
74
+
75
+ def py_src_filename(filename):
76
+ basefile, extension = os.path.splitext(filename)
77
+ if extension in PY_SRC_EXTENSIONS:
78
+ return filename
79
+ else:
80
+ for ext in PY_SRC_EXTENSIONS:
81
+ if os.path.isfile('%s%s' % (basefile, ext)):
82
+ return '%s%s' % (basefile, ext)
83
+ else:
84
+ raise ValueError('Could not find a corresponding '
85
+ 'Python source file for %r.' % filename)
86
+
87
+ def munge_script_name(filename):
88
+ name = os.path.split(filename)[1]
89
+ name = re.sub(r'\W', '_', name)
90
+ return 'script-'+name
91
+
92
+ ######################################################################
93
+ ## Text Processing
94
+ ######################################################################
95
+
96
+ def decode_with_backslashreplace(s):
97
+ r"""
98
+ Convert the given 8-bit string into unicode, treating any
99
+ character c such that ord(c)<128 as an ascii character, and
100
+ converting any c such that ord(c)>128 into a backslashed escape
101
+ sequence.
102
+
103
+ >>> decode_with_backslashreplace('abc\xff\xe8')
104
+ u'abc\\xff\\xe8'
105
+ """
106
+ # s.encode('string-escape') is not appropriate here, since it
107
+ # also adds backslashes to some ascii chars (eg \ and ').
108
+ assert isinstance(s, str)
109
+ return (s
110
+ .decode('latin1')
111
+ .encode('ascii', 'backslashreplace')
112
+ .decode('ascii'))
113
+
114
+ def wordwrap(str, indent=0, right=75, startindex=0, splitchars=''):
115
+ """
116
+ Word-wrap the given string. I.e., add newlines to the string such
117
+ that any lines that are longer than C{right} are broken into
118
+ shorter lines (at the first whitespace sequence that occurs before
119
+ index C{right}). If the given string contains newlines, they will
120
+ I{not} be removed. Any lines that begin with whitespace will not
121
+ be wordwrapped.
122
+
123
+ @param indent: If specified, then indent each line by this number
124
+ of spaces.
125
+ @type indent: C{int}
126
+ @param right: The right margin for word wrapping. Lines that are
127
+ longer than C{right} will be broken at the first whitespace
128
+ sequence before the right margin.
129
+ @type right: C{int}
130
+ @param startindex: If specified, then assume that the first line
131
+ is already preceeded by C{startindex} characters.
132
+ @type startindex: C{int}
133
+ @param splitchars: A list of non-whitespace characters which can
134
+ be used to split a line. (E.g., use '/\\' to allow path names
135
+ to be split over multiple lines.)
136
+ @rtype: C{str}
137
+ """
138
+ if splitchars:
139
+ chunks = re.split(r'( +|\n|[^ \n%s]*[%s])' %
140
+ (re.escape(splitchars), re.escape(splitchars)),
141
+ str.expandtabs())
142
+ else:
143
+ chunks = re.split(r'( +|\n)', str.expandtabs())
144
+ result = [' '*(indent-startindex)]
145
+ charindex = max(indent, startindex)
146
+ for chunknum, chunk in enumerate(chunks):
147
+ if (charindex+len(chunk) > right and charindex > 0) or chunk == '\n':
148
+ result.append('\n' + ' '*indent)
149
+ charindex = indent
150
+ if chunk[:1] not in ('\n', ' '):
151
+ result.append(chunk)
152
+ charindex += len(chunk)
153
+ else:
154
+ result.append(chunk)
155
+ charindex += len(chunk)
156
+ return ''.join(result).rstrip()+'\n'
157
+
158
+ def plaintext_to_html(s):
159
+ """
160
+ @return: An HTML string that encodes the given plaintext string.
161
+ In particular, special characters (such as C{'<'} and C{'&'})
162
+ are escaped.
163
+ @rtype: C{string}
164
+ """
165
+ s = s.replace('&', '&amp;').replace('"', '&quot;')
166
+ s = s.replace('<', '&lt;').replace('>', '&gt;')
167
+ return s
168
+
169
+ def plaintext_to_latex(str, nbsp=0, breakany=0):
170
+ """
171
+ @return: A LaTeX string that encodes the given plaintext string.
172
+ In particular, special characters (such as C{'$'} and C{'_'})
173
+ are escaped, and tabs are expanded.
174
+ @rtype: C{string}
175
+ @param breakany: Insert hyphenation marks, so that LaTeX can
176
+ break the resulting string at any point. This is useful for
177
+ small boxes (e.g., the type box in the variable list table).
178
+ @param nbsp: Replace every space with a non-breaking space
179
+ (C{'~'}).
180
+ """
181
+ # These get converted to hyphenation points later
182
+ if breakany: str = re.sub('(.)', '\\1\1', str)
183
+
184
+ # These get converted to \textbackslash later.
185
+ str = str.replace('\\', '\0')
186
+
187
+ # Expand tabs
188
+ str = str.expandtabs()
189
+
190
+ # These elements need to be backslashed.
191
+ str = re.sub(r'([#$&%_\${}])', r'\\\1', str)
192
+
193
+ # These elements have special names.
194
+ str = str.replace('|', '{\\textbar}')
195
+ str = str.replace('<', '{\\textless}')
196
+ str = str.replace('>', '{\\textgreater}')
197
+ str = str.replace('^', '{\\textasciicircum}')
198
+ str = str.replace('~', '{\\textasciitilde}')
199
+ str = str.replace('\0', r'{\textbackslash}')
200
+
201
+ # replace spaces with non-breaking spaces
202
+ if nbsp: str = str.replace(' ', '~')
203
+
204
+ # Convert \1's to hyphenation points.
205
+ if breakany: str = str.replace('\1', r'\-')
206
+
207
+ return str
208
+
209
+ class RunSubprocessError(OSError):
210
+ def __init__(self, cmd, out, err):
211
+ OSError.__init__(self, '%s failed' % cmd[0])
212
+ self.out = out
213
+ self.err = err
214
+
215
+ def run_subprocess(cmd, data=None):
216
+ """
217
+ Execute the command C{cmd} in a subprocess.
218
+
219
+ @param cmd: The command to execute, specified as a list
220
+ of string.
221
+ @param data: A string containing data to send to the
222
+ subprocess.
223
+ @return: A tuple C{(out, err)}.
224
+ @raise OSError: If there is any problem executing the
225
+ command, or if its exitval is not 0.
226
+ """
227
+ if isinstance(cmd, basestring):
228
+ cmd = cmd.split()
229
+
230
+ # Under Python 2.4+, use subprocess
231
+ try:
232
+ from subprocess import Popen, PIPE
233
+ pipe = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
234
+ out, err = pipe.communicate(data)
235
+ if hasattr(pipe, 'returncode'):
236
+ if pipe.returncode == 0:
237
+ return out, err
238
+ else:
239
+ raise RunSubprocessError(cmd, out, err)
240
+ else:
241
+ # Assume that there was an error iff anything was written
242
+ # to the child's stderr.
243
+ if err == '':
244
+ return out, err
245
+ else:
246
+ raise RunSubprocessError(cmd, out, err)
247
+ except ImportError:
248
+ pass
249
+
250
+ # Under Python 2.3 or earlier, on unix, use popen2.Popen3 so we
251
+ # can access the return value.
252
+ import popen2
253
+ if hasattr(popen2, 'Popen3'):
254
+ pipe = popen2.Popen3(' '.join(cmd), True)
255
+ to_child = pipe.tochild
256
+ from_child = pipe.fromchild
257
+ child_err = pipe.childerr
258
+ if data:
259
+ to_child.write(data)
260
+ to_child.close()
261
+ out = err = ''
262
+ while pipe.poll() is None:
263
+ out += from_child.read()
264
+ err += child_err.read()
265
+ out += from_child.read()
266
+ err += child_err.read()
267
+ if pipe.wait() == 0:
268
+ return out, err
269
+ else:
270
+ raise RunSubprocessError(cmd, out, err)
271
+
272
+ # Under Python 2.3 or earlier, on non-unix, use os.popen3
273
+ else:
274
+ to_child, from_child, child_err = os.popen3(' '.join(cmd), 'b')
275
+ if data:
276
+ try:
277
+ to_child.write(data)
278
+ # Guard for a broken pipe error
279
+ except IOError, e:
280
+ raise OSError(e)
281
+ to_child.close()
282
+ out = from_child.read()
283
+ err = child_err.read()
284
+ # Assume that there was an error iff anything was written
285
+ # to the child's stderr.
286
+ if err == '':
287
+ return out, err
288
+ else:
289
+ raise RunSubprocessError(cmd, out, err)
Binary file
@@ -0,0 +1,5 @@
1
+ """generated file, don't modify or your data will be lost"""
2
+ try:
3
+ __import__('pkg_resources').declare_namespace(__name__)
4
+ except ImportError:
5
+ pass