bee_python 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (488) hide show
  1. data/{build/README → README} +1 -1
  2. data/egg/egg/build.yml +11 -49
  3. data/egg/egg.yml +19 -27
  4. data/egg/http/build.erb +32 -36
  5. data/egg/http/libhttp.py +102 -0
  6. data/egg/http/pylint.cfg +236 -0
  7. data/egg/http/server.py +7 -0
  8. data/egg/http/test.erb +32 -0
  9. data/egg/http.yml +33 -29
  10. data/egg/mysql/mysql.py +8 -9
  11. data/egg/project/build.erb +21 -53
  12. data/egg/project/pylint.cfg +236 -0
  13. data/egg/project/test.py +2 -2
  14. data/egg/project.yml +23 -31
  15. data/egg/script/build.erb +18 -23
  16. data/egg/script/pylint.cfg +236 -0
  17. data/egg/script.yml +22 -18
  18. data/egg/source/source.py +6 -6
  19. data/egg/test/test.py +1 -1
  20. data/lib/bee_task_python.rb +3 -34
  21. data/python.yml +123 -0
  22. metadata +61 -503
  23. data/test/build.yml +0 -16
  24. data/test/tc_bee_task_python.rb +0 -27
  25. data/test/test_build.rb +0 -26
  26. data/test/test_build_listener.rb +0 -110
  27. data/test/ts_bee_python.rb +0 -26
  28. data/tools/common/__init__.py +0 -5
  29. data/tools/common/common/__init__.py +0 -140
  30. data/tools/common/common/__pkginfo__.py +0 -43
  31. data/tools/common/common/adbh.py +0 -35
  32. data/tools/common/common/cache.py +0 -114
  33. data/tools/common/common/changelog.py +0 -234
  34. data/tools/common/common/clcommands.py +0 -181
  35. data/tools/common/common/cli.py +0 -212
  36. data/tools/common/common/compat.py +0 -328
  37. data/tools/common/common/configuration.py +0 -1087
  38. data/tools/common/common/contexts.py +0 -58
  39. data/tools/common/common/corbautils.py +0 -117
  40. data/tools/common/common/daemon.py +0 -171
  41. data/tools/common/common/date.py +0 -279
  42. data/tools/common/common/db.py +0 -49
  43. data/tools/common/common/dbf.py +0 -229
  44. data/tools/common/common/debugger.py +0 -208
  45. data/tools/common/common/decorators.py +0 -190
  46. data/tools/common/common/deprecation.py +0 -118
  47. data/tools/common/common/fileutils.py +0 -409
  48. data/tools/common/common/graph.py +0 -259
  49. data/tools/common/common/html.py +0 -142
  50. data/tools/common/common/interface.py +0 -76
  51. data/tools/common/common/logging_ext.py +0 -166
  52. data/tools/common/common/modutils.py +0 -670
  53. data/tools/common/common/optik_ext.py +0 -383
  54. data/tools/common/common/optparser.py +0 -92
  55. data/tools/common/common/pdf_ext.py +0 -111
  56. data/tools/common/common/proc.py +0 -276
  57. data/tools/common/common/pyro_ext.py +0 -146
  58. data/tools/common/common/pytest.py +0 -754
  59. data/tools/common/common/shellutils.py +0 -383
  60. data/tools/common/common/sphinx_ext.py +0 -87
  61. data/tools/common/common/sphinxutils.py +0 -122
  62. data/tools/common/common/sqlgen.py +0 -31
  63. data/tools/common/common/table.py +0 -930
  64. data/tools/common/common/tasksqueue.py +0 -97
  65. data/tools/common/common/test/__init__.py +0 -1
  66. data/tools/common/common/test/data/ChangeLog +0 -184
  67. data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  68. data/tools/common/common/test/data/__init__.py +0 -1
  69. data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
  70. data/tools/common/common/test/data/content_differ_dir/README +0 -1
  71. data/tools/common/common/test/data/content_differ_dir/subdir/coin +0 -1
  72. data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
  73. data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
  74. data/tools/common/common/test/data/file_differ_dir/README +0 -1
  75. data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
  76. data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  77. data/tools/common/common/test/data/find_test/__init__.py +0 -0
  78. data/tools/common/common/test/data/find_test/foo.txt +0 -0
  79. data/tools/common/common/test/data/find_test/module.py +0 -0
  80. data/tools/common/common/test/data/find_test/module2.py +0 -0
  81. data/tools/common/common/test/data/find_test/newlines.txt +0 -0
  82. data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
  83. data/tools/common/common/test/data/find_test/nonregr.py +0 -0
  84. data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
  85. data/tools/common/common/test/data/find_test/spam.txt +0 -0
  86. data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
  87. data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
  88. data/tools/common/common/test/data/find_test/test.ini +0 -0
  89. data/tools/common/common/test/data/find_test/test1.msg +0 -0
  90. data/tools/common/common/test/data/find_test/test2.msg +0 -0
  91. data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
  92. data/tools/common/common/test/data/foo.txt +0 -9
  93. data/tools/common/common/test/data/module.py +0 -88
  94. data/tools/common/common/test/data/module2.py +0 -77
  95. data/tools/common/common/test/data/newlines.txt +0 -3
  96. data/tools/common/common/test/data/noendingnewline.py +0 -36
  97. data/tools/common/common/test/data/nonregr.py +0 -14
  98. data/tools/common/common/test/data/normal_file.txt +0 -0
  99. data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
  100. data/tools/common/common/test/data/reference_dir/README +0 -1
  101. data/tools/common/common/test/data/reference_dir/subdir/coin +0 -1
  102. data/tools/common/common/test/data/reference_dir/subdir/toto.txt +0 -53
  103. data/tools/common/common/test/data/same_dir/NOTHING +0 -0
  104. data/tools/common/common/test/data/same_dir/README +0 -1
  105. data/tools/common/common/test/data/same_dir/subdir/coin +0 -1
  106. data/tools/common/common/test/data/same_dir/subdir/toto.txt +0 -53
  107. data/tools/common/common/test/data/spam.txt +0 -9
  108. data/tools/common/common/test/data/sub/doc.txt +0 -1
  109. data/tools/common/common/test/data/sub/momo.py +0 -1
  110. data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
  111. data/tools/common/common/test/data/subdir_differ_dir/README +0 -1
  112. data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +0 -1
  113. data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
  114. data/tools/common/common/test/data/test.ini +0 -20
  115. data/tools/common/common/test/data/test1.msg +0 -30
  116. data/tools/common/common/test/data/test2.msg +0 -42
  117. data/tools/common/common/test/data/write_protected_file.txt +0 -0
  118. data/tools/common/common/test/foomod.py +0 -17
  119. data/tools/common/common/test/unittest_cache.py +0 -129
  120. data/tools/common/common/test/unittest_changelog.py +0 -37
  121. data/tools/common/common/test/unittest_compat.py +0 -239
  122. data/tools/common/common/test/unittest_configuration.py +0 -348
  123. data/tools/common/common/test/unittest_date.py +0 -154
  124. data/tools/common/common/test/unittest_decorators.py +0 -62
  125. data/tools/common/common/test/unittest_deprecation.py +0 -76
  126. data/tools/common/common/test/unittest_fileutils.py +0 -133
  127. data/tools/common/common/test/unittest_graph.py +0 -50
  128. data/tools/common/common/test/unittest_html.py +0 -76
  129. data/tools/common/common/test/unittest_interface.py +0 -87
  130. data/tools/common/common/test/unittest_modutils.py +0 -244
  131. data/tools/common/common/test/unittest_pytest.py +0 -50
  132. data/tools/common/common/test/unittest_shellutils.py +0 -248
  133. data/tools/common/common/test/unittest_table.py +0 -448
  134. data/tools/common/common/test/unittest_taskqueue.py +0 -71
  135. data/tools/common/common/test/unittest_testlib.py +0 -956
  136. data/tools/common/common/test/unittest_textutils.py +0 -247
  137. data/tools/common/common/test/unittest_tree.py +0 -248
  138. data/tools/common/common/test/unittest_umessage.py +0 -55
  139. data/tools/common/common/test/unittest_ureports_html.py +0 -64
  140. data/tools/common/common/test/unittest_ureports_text.py +0 -105
  141. data/tools/common/common/test/unittest_xmlutils.py +0 -75
  142. data/tools/common/common/test/utils.py +0 -87
  143. data/tools/common/common/testlib.py +0 -1927
  144. data/tools/common/common/textutils.py +0 -476
  145. data/tools/common/common/tree.py +0 -372
  146. data/tools/common/common/umessage.py +0 -161
  147. data/tools/common/common/ureports/__init__.py +0 -174
  148. data/tools/common/common/ureports/docbook_writer.py +0 -139
  149. data/tools/common/common/ureports/html_writer.py +0 -131
  150. data/tools/common/common/ureports/nodes.py +0 -201
  151. data/tools/common/common/ureports/text_writer.py +0 -140
  152. data/tools/common/common/vcgutils.py +0 -216
  153. data/tools/common/common/visitor.py +0 -107
  154. data/tools/common/common/xmlrpcutils.py +0 -136
  155. data/tools/common/common/xmlutils.py +0 -61
  156. data/tools/coverage/coverage.py +0 -602
  157. data/tools/epydoc/__init__.py +0 -227
  158. data/tools/epydoc/__init__.pyc +0 -0
  159. data/tools/epydoc/apidoc.py +0 -2203
  160. data/tools/epydoc/apidoc.pyc +0 -0
  161. data/tools/epydoc/checker.py +0 -349
  162. data/tools/epydoc/checker.pyc +0 -0
  163. data/tools/epydoc/cli.py +0 -1470
  164. data/tools/epydoc/cli.pyc +0 -0
  165. data/tools/epydoc/compat.py +0 -250
  166. data/tools/epydoc/compat.pyc +0 -0
  167. data/tools/epydoc/docbuilder.py +0 -1358
  168. data/tools/epydoc/docbuilder.pyc +0 -0
  169. data/tools/epydoc/docintrospecter.py +0 -1056
  170. data/tools/epydoc/docintrospecter.pyc +0 -0
  171. data/tools/epydoc/docparser.py +0 -2113
  172. data/tools/epydoc/docparser.pyc +0 -0
  173. data/tools/epydoc/docstringparser.py +0 -1111
  174. data/tools/epydoc/docstringparser.pyc +0 -0
  175. data/tools/epydoc/docwriter/__init__.py +0 -12
  176. data/tools/epydoc/docwriter/__init__.pyc +0 -0
  177. data/tools/epydoc/docwriter/dotgraph.py +0 -1351
  178. data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
  179. data/tools/epydoc/docwriter/html.py +0 -3491
  180. data/tools/epydoc/docwriter/html.pyc +0 -0
  181. data/tools/epydoc/docwriter/html_colorize.py +0 -909
  182. data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
  183. data/tools/epydoc/docwriter/html_css.py +0 -550
  184. data/tools/epydoc/docwriter/html_css.pyc +0 -0
  185. data/tools/epydoc/docwriter/html_help.py +0 -190
  186. data/tools/epydoc/docwriter/html_help.pyc +0 -0
  187. data/tools/epydoc/docwriter/latex.py +0 -1187
  188. data/tools/epydoc/docwriter/latex.pyc +0 -0
  189. data/tools/epydoc/docwriter/plaintext.py +0 -276
  190. data/tools/epydoc/docwriter/plaintext.pyc +0 -0
  191. data/tools/epydoc/docwriter/xlink.py +0 -505
  192. data/tools/epydoc/docwriter/xlink.pyc +0 -0
  193. data/tools/epydoc/gui.py +0 -1148
  194. data/tools/epydoc/gui.pyc +0 -0
  195. data/tools/epydoc/log.py +0 -204
  196. data/tools/epydoc/log.pyc +0 -0
  197. data/tools/epydoc/markup/__init__.py +0 -623
  198. data/tools/epydoc/markup/__init__.pyc +0 -0
  199. data/tools/epydoc/markup/doctest.py +0 -311
  200. data/tools/epydoc/markup/doctest.pyc +0 -0
  201. data/tools/epydoc/markup/epytext.py +0 -2116
  202. data/tools/epydoc/markup/epytext.pyc +0 -0
  203. data/tools/epydoc/markup/javadoc.py +0 -250
  204. data/tools/epydoc/markup/javadoc.pyc +0 -0
  205. data/tools/epydoc/markup/plaintext.py +0 -78
  206. data/tools/epydoc/markup/plaintext.pyc +0 -0
  207. data/tools/epydoc/markup/pyval_repr.py +0 -532
  208. data/tools/epydoc/markup/pyval_repr.pyc +0 -0
  209. data/tools/epydoc/markup/restructuredtext.py +0 -906
  210. data/tools/epydoc/markup/restructuredtext.pyc +0 -0
  211. data/tools/epydoc/test/__init__.py +0 -97
  212. data/tools/epydoc/test/__init__.pyc +0 -0
  213. data/tools/epydoc/test/util.py +0 -226
  214. data/tools/epydoc/test/util.pyc +0 -0
  215. data/tools/epydoc/util.py +0 -289
  216. data/tools/epydoc/util.pyc +0 -0
  217. data/tools/logilab/logilab/__init__.py +0 -5
  218. data/tools/logilab/logilab/astng/__init__.py +0 -82
  219. data/tools/logilab/logilab/astng/__pkginfo__.py +0 -76
  220. data/tools/logilab/logilab/astng/_exceptions.py +0 -64
  221. data/tools/logilab/logilab/astng/_nodes_ast.py +0 -667
  222. data/tools/logilab/logilab/astng/_nodes_compiler.py +0 -758
  223. data/tools/logilab/logilab/astng/bases.py +0 -608
  224. data/tools/logilab/logilab/astng/builder.py +0 -239
  225. data/tools/logilab/logilab/astng/inference.py +0 -426
  226. data/tools/logilab/logilab/astng/inspector.py +0 -289
  227. data/tools/logilab/logilab/astng/manager.py +0 -421
  228. data/tools/logilab/logilab/astng/mixins.py +0 -165
  229. data/tools/logilab/logilab/astng/node_classes.py +0 -848
  230. data/tools/logilab/logilab/astng/nodes.py +0 -85
  231. data/tools/logilab/logilab/astng/nodes_as_string.py +0 -389
  232. data/tools/logilab/logilab/astng/patchcomptransformer.py +0 -159
  233. data/tools/logilab/logilab/astng/protocols.py +0 -333
  234. data/tools/logilab/logilab/astng/raw_building.py +0 -212
  235. data/tools/logilab/logilab/astng/rebuilder.py +0 -307
  236. data/tools/logilab/logilab/astng/scoped_nodes.py +0 -951
  237. data/tools/logilab/logilab/astng/test/__init__.py +0 -19
  238. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  239. data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
  240. data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +0 -33
  241. data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +0 -20
  242. data/tools/logilab/logilab/astng/test/data/__init__.py +0 -20
  243. data/tools/logilab/logilab/astng/test/data/all.py +0 -29
  244. data/tools/logilab/logilab/astng/test/data/appl/__init__.py +0 -23
  245. data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +0 -30
  246. data/tools/logilab/logilab/astng/test/data/format.py +0 -34
  247. data/tools/logilab/logilab/astng/test/data/module.py +0 -90
  248. data/tools/logilab/logilab/astng/test/data/module2.py +0 -112
  249. data/tools/logilab/logilab/astng/test/data/noendingnewline.py +0 -57
  250. data/tools/logilab/logilab/astng/test/data/nonregr.py +0 -76
  251. data/tools/logilab/logilab/astng/test/data/notall.py +0 -28
  252. data/tools/logilab/logilab/astng/test/data2/__init__.py +0 -20
  253. data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +0 -51
  254. data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +0 -32
  255. data/tools/logilab/logilab/astng/test/regrtest.py +0 -135
  256. data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +0 -22
  257. data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +0 -31
  258. data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +0 -68
  259. data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +0 -24
  260. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +0 -20
  261. data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +0 -20
  262. data/tools/logilab/logilab/astng/test/unittest_builder.py +0 -684
  263. data/tools/logilab/logilab/astng/test/unittest_inference.py +0 -1112
  264. data/tools/logilab/logilab/astng/test/unittest_inspector.py +0 -105
  265. data/tools/logilab/logilab/astng/test/unittest_lookup.py +0 -302
  266. data/tools/logilab/logilab/astng/test/unittest_manager.py +0 -98
  267. data/tools/logilab/logilab/astng/test/unittest_nodes.py +0 -302
  268. data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +0 -501
  269. data/tools/logilab/logilab/astng/test/unittest_utils.py +0 -104
  270. data/tools/logilab/logilab/astng/utils.py +0 -342
  271. data/tools/logilab/logilab/common/__init__.py +0 -140
  272. data/tools/logilab/logilab/common/__pkginfo__.py +0 -43
  273. data/tools/logilab/logilab/common/adbh.py +0 -35
  274. data/tools/logilab/logilab/common/cache.py +0 -114
  275. data/tools/logilab/logilab/common/changelog.py +0 -234
  276. data/tools/logilab/logilab/common/clcommands.py +0 -181
  277. data/tools/logilab/logilab/common/cli.py +0 -212
  278. data/tools/logilab/logilab/common/compat.py +0 -328
  279. data/tools/logilab/logilab/common/configuration.py +0 -1087
  280. data/tools/logilab/logilab/common/contexts.py +0 -58
  281. data/tools/logilab/logilab/common/corbautils.py +0 -117
  282. data/tools/logilab/logilab/common/daemon.py +0 -171
  283. data/tools/logilab/logilab/common/date.py +0 -279
  284. data/tools/logilab/logilab/common/db.py +0 -49
  285. data/tools/logilab/logilab/common/dbf.py +0 -229
  286. data/tools/logilab/logilab/common/debugger.py +0 -208
  287. data/tools/logilab/logilab/common/decorators.py +0 -190
  288. data/tools/logilab/logilab/common/deprecation.py +0 -118
  289. data/tools/logilab/logilab/common/fileutils.py +0 -409
  290. data/tools/logilab/logilab/common/graph.py +0 -259
  291. data/tools/logilab/logilab/common/html.py +0 -142
  292. data/tools/logilab/logilab/common/interface.py +0 -76
  293. data/tools/logilab/logilab/common/logging_ext.py +0 -166
  294. data/tools/logilab/logilab/common/modutils.py +0 -670
  295. data/tools/logilab/logilab/common/optik_ext.py +0 -383
  296. data/tools/logilab/logilab/common/optparser.py +0 -92
  297. data/tools/logilab/logilab/common/pdf_ext.py +0 -111
  298. data/tools/logilab/logilab/common/proc.py +0 -276
  299. data/tools/logilab/logilab/common/pyro_ext.py +0 -146
  300. data/tools/logilab/logilab/common/pytest.py +0 -754
  301. data/tools/logilab/logilab/common/shellutils.py +0 -383
  302. data/tools/logilab/logilab/common/sphinx_ext.py +0 -87
  303. data/tools/logilab/logilab/common/sphinxutils.py +0 -122
  304. data/tools/logilab/logilab/common/sqlgen.py +0 -31
  305. data/tools/logilab/logilab/common/table.py +0 -930
  306. data/tools/logilab/logilab/common/tasksqueue.py +0 -97
  307. data/tools/logilab/logilab/common/test/__init__.py +0 -1
  308. data/tools/logilab/logilab/common/test/data/ChangeLog +0 -184
  309. data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  310. data/tools/logilab/logilab/common/test/data/__init__.py +0 -1
  311. data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
  312. data/tools/logilab/logilab/common/test/data/content_differ_dir/README +0 -1
  313. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +0 -1
  314. data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
  315. data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
  316. data/tools/logilab/logilab/common/test/data/file_differ_dir/README +0 -1
  317. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
  318. data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
  319. data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
  320. data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
  321. data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
  322. data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
  323. data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
  324. data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
  325. data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
  326. data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
  327. data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
  328. data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
  329. data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
  330. data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
  331. data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
  332. data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
  333. data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
  334. data/tools/logilab/logilab/common/test/data/foo.txt +0 -9
  335. data/tools/logilab/logilab/common/test/data/module.py +0 -88
  336. data/tools/logilab/logilab/common/test/data/module2.py +0 -77
  337. data/tools/logilab/logilab/common/test/data/newlines.txt +0 -3
  338. data/tools/logilab/logilab/common/test/data/noendingnewline.py +0 -36
  339. data/tools/logilab/logilab/common/test/data/nonregr.py +0 -14
  340. data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
  341. data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
  342. data/tools/logilab/logilab/common/test/data/reference_dir/README +0 -1
  343. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +0 -1
  344. data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +0 -53
  345. data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
  346. data/tools/logilab/logilab/common/test/data/same_dir/README +0 -1
  347. data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +0 -1
  348. data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +0 -53
  349. data/tools/logilab/logilab/common/test/data/spam.txt +0 -9
  350. data/tools/logilab/logilab/common/test/data/sub/doc.txt +0 -1
  351. data/tools/logilab/logilab/common/test/data/sub/momo.py +0 -1
  352. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
  353. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +0 -1
  354. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +0 -1
  355. data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
  356. data/tools/logilab/logilab/common/test/data/test.ini +0 -20
  357. data/tools/logilab/logilab/common/test/data/test1.msg +0 -30
  358. data/tools/logilab/logilab/common/test/data/test2.msg +0 -42
  359. data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
  360. data/tools/logilab/logilab/common/test/foomod.py +0 -17
  361. data/tools/logilab/logilab/common/test/unittest_cache.py +0 -129
  362. data/tools/logilab/logilab/common/test/unittest_changelog.py +0 -37
  363. data/tools/logilab/logilab/common/test/unittest_compat.py +0 -239
  364. data/tools/logilab/logilab/common/test/unittest_configuration.py +0 -348
  365. data/tools/logilab/logilab/common/test/unittest_date.py +0 -154
  366. data/tools/logilab/logilab/common/test/unittest_decorators.py +0 -62
  367. data/tools/logilab/logilab/common/test/unittest_deprecation.py +0 -76
  368. data/tools/logilab/logilab/common/test/unittest_fileutils.py +0 -133
  369. data/tools/logilab/logilab/common/test/unittest_graph.py +0 -50
  370. data/tools/logilab/logilab/common/test/unittest_html.py +0 -76
  371. data/tools/logilab/logilab/common/test/unittest_interface.py +0 -87
  372. data/tools/logilab/logilab/common/test/unittest_modutils.py +0 -244
  373. data/tools/logilab/logilab/common/test/unittest_pytest.py +0 -50
  374. data/tools/logilab/logilab/common/test/unittest_shellutils.py +0 -248
  375. data/tools/logilab/logilab/common/test/unittest_table.py +0 -448
  376. data/tools/logilab/logilab/common/test/unittest_taskqueue.py +0 -71
  377. data/tools/logilab/logilab/common/test/unittest_testlib.py +0 -956
  378. data/tools/logilab/logilab/common/test/unittest_textutils.py +0 -247
  379. data/tools/logilab/logilab/common/test/unittest_tree.py +0 -248
  380. data/tools/logilab/logilab/common/test/unittest_umessage.py +0 -55
  381. data/tools/logilab/logilab/common/test/unittest_ureports_html.py +0 -64
  382. data/tools/logilab/logilab/common/test/unittest_ureports_text.py +0 -105
  383. data/tools/logilab/logilab/common/test/unittest_xmlutils.py +0 -75
  384. data/tools/logilab/logilab/common/test/utils.py +0 -87
  385. data/tools/logilab/logilab/common/testlib.py +0 -1927
  386. data/tools/logilab/logilab/common/textutils.py +0 -476
  387. data/tools/logilab/logilab/common/tree.py +0 -372
  388. data/tools/logilab/logilab/common/umessage.py +0 -161
  389. data/tools/logilab/logilab/common/ureports/__init__.py +0 -174
  390. data/tools/logilab/logilab/common/ureports/docbook_writer.py +0 -139
  391. data/tools/logilab/logilab/common/ureports/html_writer.py +0 -131
  392. data/tools/logilab/logilab/common/ureports/nodes.py +0 -201
  393. data/tools/logilab/logilab/common/ureports/text_writer.py +0 -140
  394. data/tools/logilab/logilab/common/vcgutils.py +0 -216
  395. data/tools/logilab/logilab/common/visitor.py +0 -107
  396. data/tools/logilab/logilab/common/xmlrpcutils.py +0 -136
  397. data/tools/logilab/logilab/common/xmlutils.py +0 -61
  398. data/tools/pychecker/COPYRIGHT +0 -31
  399. data/tools/pychecker/ChangeLog +0 -349
  400. data/tools/pychecker/CodeChecks.py +0 -1969
  401. data/tools/pychecker/CodeChecks.pyc +0 -0
  402. data/tools/pychecker/CodeChecks.pyo +0 -0
  403. data/tools/pychecker/Config.py +0 -475
  404. data/tools/pychecker/Config.pyc +0 -0
  405. data/tools/pychecker/Config.pyo +0 -0
  406. data/tools/pychecker/KNOWN_BUGS +0 -100
  407. data/tools/pychecker/MAINTAINERS +0 -81
  408. data/tools/pychecker/NEWS +0 -406
  409. data/tools/pychecker/OP.py +0 -131
  410. data/tools/pychecker/OP.pyc +0 -0
  411. data/tools/pychecker/OP.pyo +0 -0
  412. data/tools/pychecker/OptionTypes.py +0 -117
  413. data/tools/pychecker/OptionTypes.pyc +0 -0
  414. data/tools/pychecker/OptionTypes.pyo +0 -0
  415. data/tools/pychecker/README +0 -152
  416. data/tools/pychecker/Stack.py +0 -115
  417. data/tools/pychecker/Stack.pyc +0 -0
  418. data/tools/pychecker/Stack.pyo +0 -0
  419. data/tools/pychecker/TODO +0 -101
  420. data/tools/pychecker/VERSION +0 -1
  421. data/tools/pychecker/Warning.py +0 -50
  422. data/tools/pychecker/Warning.pyc +0 -0
  423. data/tools/pychecker/Warning.pyo +0 -0
  424. data/tools/pychecker/__init__.py +0 -17
  425. data/tools/pychecker/__init__.pyc +0 -0
  426. data/tools/pychecker/__init__.pyo +0 -0
  427. data/tools/pychecker/checker.py +0 -961
  428. data/tools/pychecker/checker.pyc +0 -0
  429. data/tools/pychecker/checker.pyo +0 -0
  430. data/tools/pychecker/function.py +0 -159
  431. data/tools/pychecker/function.pyc +0 -0
  432. data/tools/pychecker/function.pyo +0 -0
  433. data/tools/pychecker/msgs.py +0 -175
  434. data/tools/pychecker/msgs.pyc +0 -0
  435. data/tools/pychecker/msgs.pyo +0 -0
  436. data/tools/pychecker/options.py +0 -275
  437. data/tools/pychecker/options.pyc +0 -0
  438. data/tools/pychecker/options.pyo +0 -0
  439. data/tools/pychecker/pcmodules.py +0 -19
  440. data/tools/pychecker/pcmodules.pyc +0 -0
  441. data/tools/pychecker/pcmodules.pyo +0 -0
  442. data/tools/pychecker/printer.py +0 -47
  443. data/tools/pychecker/printer.pyc +0 -0
  444. data/tools/pychecker/printer.pyo +0 -0
  445. data/tools/pychecker/python.py +0 -427
  446. data/tools/pychecker/python.pyc +0 -0
  447. data/tools/pychecker/python.pyo +0 -0
  448. data/tools/pychecker/utils.py +0 -102
  449. data/tools/pychecker/utils.pyc +0 -0
  450. data/tools/pychecker/utils.pyo +0 -0
  451. data/tools/pychecker/warn.py +0 -778
  452. data/tools/pychecker/warn.pyc +0 -0
  453. data/tools/pychecker/warn.pyo +0 -0
  454. data/tools/pylint2/pylint/__init__.py +0 -16
  455. data/tools/pylint2/pylint/__pkginfo__.py +0 -67
  456. data/tools/pylint2/pylint/checkers/__init__.py +0 -155
  457. data/tools/pylint2/pylint/checkers/base.py +0 -749
  458. data/tools/pylint2/pylint/checkers/classes.py +0 -527
  459. data/tools/pylint2/pylint/checkers/design_analysis.py +0 -344
  460. data/tools/pylint2/pylint/checkers/exceptions.py +0 -183
  461. data/tools/pylint2/pylint/checkers/format.py +0 -367
  462. data/tools/pylint2/pylint/checkers/imports.py +0 -379
  463. data/tools/pylint2/pylint/checkers/logging.py +0 -98
  464. data/tools/pylint2/pylint/checkers/misc.py +0 -128
  465. data/tools/pylint2/pylint/checkers/newstyle.py +0 -107
  466. data/tools/pylint2/pylint/checkers/raw_metrics.py +0 -125
  467. data/tools/pylint2/pylint/checkers/similar.py +0 -333
  468. data/tools/pylint2/pylint/checkers/string_format.py +0 -239
  469. data/tools/pylint2/pylint/checkers/typecheck.py +0 -364
  470. data/tools/pylint2/pylint/checkers/utils.py +0 -208
  471. data/tools/pylint2/pylint/checkers/variables.py +0 -498
  472. data/tools/pylint2/pylint/config.py +0 -149
  473. data/tools/pylint2/pylint/epylint.py +0 -149
  474. data/tools/pylint2/pylint/gui.py +0 -433
  475. data/tools/pylint2/pylint/interfaces.py +0 -98
  476. data/tools/pylint2/pylint/lint.py +0 -914
  477. data/tools/pylint2/pylint/pyreverse/__init__.py +0 -5
  478. data/tools/pylint2/pylint/pyreverse/diadefslib.py +0 -229
  479. data/tools/pylint2/pylint/pyreverse/diagrams.py +0 -247
  480. data/tools/pylint2/pylint/pyreverse/main.py +0 -123
  481. data/tools/pylint2/pylint/pyreverse/utils.py +0 -131
  482. data/tools/pylint2/pylint/pyreverse/writer.py +0 -196
  483. data/tools/pylint2/pylint/reporters/__init__.py +0 -67
  484. data/tools/pylint2/pylint/reporters/guireporter.py +0 -36
  485. data/tools/pylint2/pylint/reporters/html.py +0 -69
  486. data/tools/pylint2/pylint/reporters/text.py +0 -156
  487. data/tools/pylint2/pylint/utils.py +0 -518
  488. data/tools/pylint2/pylint.py +0 -16
@@ -1,930 +0,0 @@
1
- # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
2
- # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
3
- #
4
- # This file is part of logilab-common.
5
- #
6
- # logilab-common is free software: you can redistribute it and/or modify it under
7
- # the terms of the GNU Lesser General Public License as published by the Free
8
- # Software Foundation, either version 2.1 of the License, or (at your option) any
9
- # later version.
10
- #
11
- # logilab-common is distributed in the hope that it will be useful, but WITHOUT
12
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
- # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14
- # details.
15
- #
16
- # You should have received a copy of the GNU Lesser General Public License along
17
- # with logilab-common. If not, see <http://www.gnu.org/licenses/>.
18
- """Table management module.
19
-
20
-
21
-
22
-
23
- """
24
- __docformat__ = "restructuredtext en"
25
-
26
- from logilab.common.compat import enumerate, sum, set
27
-
28
- class Table(object):
29
- """Table defines a data table with column and row names.
30
- inv:
31
- len(self.data) <= len(self.row_names)
32
- forall(self.data, lambda x: len(x) <= len(self.col_names))
33
- """
34
-
35
- def __init__(self, default_value=0, col_names=None, row_names=None):
36
- self.col_names = []
37
- self.row_names = []
38
- self.data = []
39
- self.default_value = default_value
40
- if col_names:
41
- self.create_columns(col_names)
42
- if row_names:
43
- self.create_rows(row_names)
44
-
45
- def _next_row_name(self):
46
- return 'row%s' % (len(self.row_names)+1)
47
-
48
- def __iter__(self):
49
- return iter(self.data)
50
-
51
- def __eq__(self, other):
52
- if other is None:
53
- return False
54
- else:
55
- return list(self) == list(other)
56
-
57
- def __ne__(self, other):
58
- return not self == other
59
-
60
- def __len__(self):
61
- return len(self.row_names)
62
-
63
- ## Rows / Columns creation #################################################
64
- def create_rows(self, row_names):
65
- """Appends row_names to the list of existing rows
66
- """
67
- self.row_names.extend(row_names)
68
- for row_name in row_names:
69
- self.data.append([self.default_value]*len(self.col_names))
70
-
71
- def create_columns(self, col_names):
72
- """Appends col_names to the list of existing columns
73
- """
74
- for col_name in col_names:
75
- self.create_column(col_name)
76
-
77
- def create_row(self, row_name=None):
78
- """Creates a rowname to the row_names list
79
- """
80
- row_name = row_name or self._next_row_name()
81
- self.row_names.append(row_name)
82
- self.data.append([self.default_value]*len(self.col_names))
83
-
84
-
85
- def create_column(self, col_name):
86
- """Creates a colname to the col_names list
87
- """
88
- self.col_names.append(col_name)
89
- for row in self.data:
90
- row.append(self.default_value)
91
-
92
- ## Sort by column ##########################################################
93
- def sort_by_column_id(self, col_id, method = 'asc'):
94
- """Sorts the table (in-place) according to data stored in col_id
95
- """
96
- try:
97
- col_index = self.col_names.index(col_id)
98
- self.sort_by_column_index(col_index, method)
99
- except ValueError:
100
- raise KeyError("Col (%s) not found in table" % (col_id))
101
-
102
-
103
- def sort_by_column_index(self, col_index, method = 'asc'):
104
- """Sorts the table 'in-place' according to data stored in col_index
105
-
106
- method should be in ('asc', 'desc')
107
- """
108
- sort_list = [(row[col_index], row, row_name)
109
- for row, row_name in zip(self.data, self.row_names)]
110
- # Sorting sort_list will sort according to col_index
111
- sort_list.sort()
112
- # If we want reverse sort, then reverse list
113
- if method.lower() == 'desc':
114
- sort_list.reverse()
115
-
116
- # Rebuild data / row names
117
- self.data = []
118
- self.row_names = []
119
- for val, row, row_name in sort_list:
120
- self.data.append(row)
121
- self.row_names.append(row_name)
122
-
123
- def groupby(self, colname, *others):
124
- """builds indexes of data
125
- :returns: nested dictionaries pointing to actual rows
126
- """
127
- groups = {}
128
- colnames = (colname,) + others
129
- col_indexes = [self.col_names.index(col_id) for col_id in colnames]
130
- for row in self.data:
131
- ptr = groups
132
- for col_index in col_indexes[:-1]:
133
- ptr = ptr.setdefault(row[col_index], {})
134
- ptr = ptr.setdefault(row[col_indexes[-1]],
135
- Table(default_value=self.default_value,
136
- col_names=self.col_names))
137
- ptr.append_row(tuple(row))
138
- return groups
139
-
140
- def select(self, colname, value):
141
- grouped = self.groupby(colname)
142
- try:
143
- return grouped[value]
144
- except KeyError:
145
- return []
146
-
147
- def remove(self, colname, value):
148
- col_index = self.col_names.index(colname)
149
- for row in self.data[:]:
150
- if row[col_index] == value:
151
- self.data.remove(row)
152
-
153
-
154
- ## The 'setter' part #######################################################
155
- def set_cell(self, row_index, col_index, data):
156
- """sets value of cell 'row_indew', 'col_index' to data
157
- """
158
- self.data[row_index][col_index] = data
159
-
160
-
161
- def set_cell_by_ids(self, row_id, col_id, data):
162
- """sets value of cell mapped by row_id and col_id to data
163
- Raises a KeyError if row_id or col_id are not found in the table
164
- """
165
- try:
166
- row_index = self.row_names.index(row_id)
167
- except ValueError:
168
- raise KeyError("Row (%s) not found in table" % (row_id))
169
- else:
170
- try:
171
- col_index = self.col_names.index(col_id)
172
- self.data[row_index][col_index] = data
173
- except ValueError:
174
- raise KeyError("Column (%s) not found in table" % (col_id))
175
-
176
-
177
- def set_row(self, row_index, row_data):
178
- """sets the 'row_index' row
179
- pre:
180
- type(row_data) == types.ListType
181
- len(row_data) == len(self.col_names)
182
- """
183
- self.data[row_index] = row_data
184
-
185
-
186
- def set_row_by_id(self, row_id, row_data):
187
- """sets the 'row_id' column
188
- pre:
189
- type(row_data) == types.ListType
190
- len(row_data) == len(self.row_names)
191
- Raises a KeyError if row_id is not found
192
- """
193
- try:
194
- row_index = self.row_names.index(row_id)
195
- self.set_row(row_index, row_data)
196
- except ValueError:
197
- raise KeyError('Row (%s) not found in table' % (row_id))
198
-
199
-
200
- def append_row(self, row_data, row_name=None):
201
- """Appends a row to the table
202
- pre:
203
- type(row_data) == types.ListType
204
- len(row_data) == len(self.col_names)
205
- """
206
- row_name = row_name or self._next_row_name()
207
- self.row_names.append(row_name)
208
- self.data.append(row_data)
209
- return len(self.data) - 1
210
-
211
- def insert_row(self, index, row_data, row_name=None):
212
- """Appends row_data before 'index' in the table. To make 'insert'
213
- behave like 'list.insert', inserting in an out of range index will
214
- insert row_data to the end of the list
215
- pre:
216
- type(row_data) == types.ListType
217
- len(row_data) == len(self.col_names)
218
- """
219
- row_name = row_name or self._next_row_name()
220
- self.row_names.insert(index, row_name)
221
- self.data.insert(index, row_data)
222
-
223
-
224
- def delete_row(self, index):
225
- """Deletes the 'index' row in the table, and returns it.
226
- Raises an IndexError if index is out of range
227
- """
228
- self.row_names.pop(index)
229
- return self.data.pop(index)
230
-
231
-
232
- def delete_row_by_id(self, row_id):
233
- """Deletes the 'row_id' row in the table.
234
- Raises a KeyError if row_id was not found.
235
- """
236
- try:
237
- row_index = self.row_names.index(row_id)
238
- self.delete_row(row_index)
239
- except ValueError:
240
- raise KeyError('Row (%s) not found in table' % (row_id))
241
-
242
-
243
- def set_column(self, col_index, col_data):
244
- """sets the 'col_index' column
245
- pre:
246
- type(col_data) == types.ListType
247
- len(col_data) == len(self.row_names)
248
- """
249
-
250
- for row_index, cell_data in enumerate(col_data):
251
- self.data[row_index][col_index] = cell_data
252
-
253
-
254
- def set_column_by_id(self, col_id, col_data):
255
- """sets the 'col_id' column
256
- pre:
257
- type(col_data) == types.ListType
258
- len(col_data) == len(self.col_names)
259
- Raises a KeyError if col_id is not found
260
- """
261
- try:
262
- col_index = self.col_names.index(col_id)
263
- self.set_column(col_index, col_data)
264
- except ValueError:
265
- raise KeyError('Column (%s) not found in table' % (col_id))
266
-
267
-
268
- def append_column(self, col_data, col_name):
269
- """Appends the 'col_index' column
270
- pre:
271
- type(col_data) == types.ListType
272
- len(col_data) == len(self.row_names)
273
- """
274
- self.col_names.append(col_name)
275
- for row_index, cell_data in enumerate(col_data):
276
- self.data[row_index].append(cell_data)
277
-
278
-
279
- def insert_column(self, index, col_data, col_name):
280
- """Appends col_data before 'index' in the table. To make 'insert'
281
- behave like 'list.insert', inserting in an out of range index will
282
- insert col_data to the end of the list
283
- pre:
284
- type(col_data) == types.ListType
285
- len(col_data) == len(self.row_names)
286
- """
287
- self.col_names.insert(index, col_name)
288
- for row_index, cell_data in enumerate(col_data):
289
- self.data[row_index].insert(index, cell_data)
290
-
291
-
292
- def delete_column(self, index):
293
- """Deletes the 'index' column in the table, and returns it.
294
- Raises an IndexError if index is out of range
295
- """
296
- self.col_names.pop(index)
297
- return [row.pop(index) for row in self.data]
298
-
299
-
300
- def delete_column_by_id(self, col_id):
301
- """Deletes the 'col_id' col in the table.
302
- Raises a KeyError if col_id was not found.
303
- """
304
- try:
305
- col_index = self.col_names.index(col_id)
306
- self.delete_column(col_index)
307
- except ValueError:
308
- raise KeyError('Column (%s) not found in table' % (col_id))
309
-
310
-
311
- ## The 'getter' part #######################################################
312
-
313
- def get_shape(self):
314
- """Returns a tuple which represents the table's shape
315
- """
316
- return len(self.row_names), len(self.col_names)
317
- shape = property(get_shape)
318
-
319
- def __getitem__(self, indices):
320
- """provided for convenience"""
321
- rows, multirows = None, False
322
- cols, multicols = None, False
323
- if isinstance(indices, tuple):
324
- rows = indices[0]
325
- if len(indices) > 1:
326
- cols = indices[1]
327
- else:
328
- rows = indices
329
- # define row slice
330
- if isinstance(rows,str):
331
- try:
332
- rows = self.row_names.index(rows)
333
- except ValueError:
334
- raise KeyError("Row (%s) not found in table" % (rows))
335
- if isinstance(rows,int):
336
- rows = slice(rows,rows+1)
337
- multirows = False
338
- else:
339
- rows = slice(None)
340
- multirows = True
341
- # define col slice
342
- if isinstance(cols,str):
343
- try:
344
- cols = self.col_names.index(cols)
345
- except ValueError:
346
- raise KeyError("Column (%s) not found in table" % (cols))
347
- if isinstance(cols,int):
348
- cols = slice(cols,cols+1)
349
- multicols = False
350
- else:
351
- cols = slice(None)
352
- multicols = True
353
- # get sub-table
354
- tab = Table()
355
- tab.default_value = self.default_value
356
- tab.create_rows(self.row_names[rows])
357
- tab.create_columns(self.col_names[cols])
358
- for idx,row in enumerate(self.data[rows]):
359
- tab.set_row(idx, row[cols])
360
- if multirows :
361
- if multicols:
362
- return tab
363
- else:
364
- return [item[0] for item in tab.data]
365
- else:
366
- if multicols:
367
- return tab.data[0]
368
- else:
369
- return tab.data[0][0]
370
-
371
- def get_cell_by_ids(self, row_id, col_id):
372
- """Returns the element at [row_id][col_id]
373
- """
374
- try:
375
- row_index = self.row_names.index(row_id)
376
- except ValueError:
377
- raise KeyError("Row (%s) not found in table" % (row_id))
378
- else:
379
- try:
380
- col_index = self.col_names.index(col_id)
381
- except ValueError:
382
- raise KeyError("Column (%s) not found in table" % (col_id))
383
- return self.data[row_index][col_index]
384
-
385
- def get_row_by_id(self, row_id):
386
- """Returns the 'row_id' row
387
- """
388
- try:
389
- row_index = self.row_names.index(row_id)
390
- except ValueError:
391
- raise KeyError("Row (%s) not found in table" % (row_id))
392
- return self.data[row_index]
393
-
394
- def get_column_by_id(self, col_id, distinct=False):
395
- """Returns the 'col_id' col
396
- """
397
- try:
398
- col_index = self.col_names.index(col_id)
399
- except ValueError:
400
- raise KeyError("Column (%s) not found in table" % (col_id))
401
- return self.get_column(col_index, distinct)
402
-
403
- def get_columns(self):
404
- """Returns all the columns in the table
405
- """
406
- return [self[:,index] for index in range(len(self.col_names))]
407
-
408
- def get_column(self, col_index, distinct=False):
409
- """get a column by index"""
410
- col = [row[col_index] for row in self.data]
411
- if distinct:
412
- col = list(set(col))
413
- return col
414
-
415
- def apply_stylesheet(self, stylesheet):
416
- """Applies the stylesheet to this table
417
- """
418
- for instruction in stylesheet.instructions:
419
- eval(instruction)
420
-
421
-
422
- def transpose(self):
423
- """Keeps the self object intact, and returns the transposed (rotated)
424
- table.
425
- """
426
- transposed = Table()
427
- transposed.create_rows(self.col_names)
428
- transposed.create_columns(self.row_names)
429
- for col_index, column in enumerate(self.get_columns()):
430
- transposed.set_row(col_index, column)
431
- return transposed
432
-
433
-
434
- def pprint(self):
435
- """returns a string representing the table in a pretty
436
- printed 'text' format.
437
- """
438
- # The maximum row name (to know the start_index of the first col)
439
- max_row_name = 0
440
- for row_name in self.row_names:
441
- if len(row_name) > max_row_name:
442
- max_row_name = len(row_name)
443
- col_start = max_row_name + 5
444
-
445
- lines = []
446
- # Build the 'first' line <=> the col_names one
447
- # The first cell <=> an empty one
448
- col_names_line = [' '*col_start]
449
- for col_name in self.col_names:
450
- col_names_line.append(col_name.encode('iso-8859-1') + ' '*5)
451
- lines.append('|' + '|'.join(col_names_line) + '|')
452
- max_line_length = len(lines[0])
453
-
454
- # Build the table
455
- for row_index, row in enumerate(self.data):
456
- line = []
457
- # First, build the row_name's cell
458
- row_name = self.row_names[row_index].encode('iso-8859-1')
459
- line.append(row_name + ' '*(col_start-len(row_name)))
460
-
461
- # Then, build all the table's cell for this line.
462
- for col_index, cell in enumerate(row):
463
- col_name_length = len(self.col_names[col_index]) + 5
464
- data = str(cell)
465
- line.append(data + ' '*(col_name_length - len(data)))
466
- lines.append('|' + '|'.join(line) + '|')
467
- if len(lines[-1]) > max_line_length:
468
- max_line_length = len(lines[-1])
469
-
470
- # Wrap the table with '-' to make a frame
471
- lines.insert(0, '-'*max_line_length)
472
- lines.append('-'*max_line_length)
473
- return '\n'.join(lines)
474
-
475
-
476
- def __repr__(self):
477
- return repr(self.data)
478
-
479
- def as_text(self):
480
- data = []
481
- # We must convert cells into strings before joining them
482
- for row in self.data:
483
- data.append([str(cell) for cell in row])
484
- lines = ['\t'.join(row) for row in data]
485
- return '\n'.join(lines)
486
-
487
-
488
-
489
- class TableStyle:
490
- """Defines a table's style
491
- """
492
-
493
- def __init__(self, table):
494
-
495
- self._table = table
496
- self.size = dict([(col_name,'1*') for col_name in table.col_names])
497
- # __row_column__ is a special key to define the first column which
498
- # actually has no name (<=> left most column <=> row names column)
499
- self.size['__row_column__'] = '1*'
500
- self.alignment = dict([(col_name,'right')
501
- for col_name in table.col_names])
502
- self.alignment['__row_column__'] = 'right'
503
-
504
- # We shouldn't have to create an entry for
505
- # the 1st col (the row_column one)
506
- self.units = dict([(col_name,'') for col_name in table.col_names])
507
- self.units['__row_column__'] = ''
508
-
509
- # XXX FIXME : params order should be reversed for all set() methods
510
- def set_size(self, value, col_id):
511
- """sets the size of the specified col_id to value
512
- """
513
- self.size[col_id] = value
514
-
515
- def set_size_by_index(self, value, col_index):
516
- """Allows to set the size according to the column index rather than
517
- using the column's id.
518
- BE CAREFUL : the '0' column is the '__row_column__' one !
519
- """
520
- if col_index == 0:
521
- col_id = '__row_column__'
522
- else:
523
- col_id = self._table.col_names[col_index-1]
524
-
525
- self.size[col_id] = value
526
-
527
-
528
- def set_alignment(self, value, col_id):
529
- """sets the alignment of the specified col_id to value
530
- """
531
- self.alignment[col_id] = value
532
-
533
-
534
- def set_alignment_by_index(self, value, col_index):
535
- """Allows to set the alignment according to the column index rather than
536
- using the column's id.
537
- BE CAREFUL : the '0' column is the '__row_column__' one !
538
- """
539
- if col_index == 0:
540
- col_id = '__row_column__'
541
- else:
542
- col_id = self._table.col_names[col_index-1]
543
-
544
- self.alignment[col_id] = value
545
-
546
-
547
- def set_unit(self, value, col_id):
548
- """sets the unit of the specified col_id to value
549
- """
550
- self.units[col_id] = value
551
-
552
-
553
- def set_unit_by_index(self, value, col_index):
554
- """Allows to set the unit according to the column index rather than
555
- using the column's id.
556
- BE CAREFUL : the '0' column is the '__row_column__' one !
557
- (Note that in the 'unit' case, you shouldn't have to set a unit
558
- for the 1st column (the __row__column__ one))
559
- """
560
- if col_index == 0:
561
- col_id = '__row_column__'
562
- else:
563
- col_id = self._table.col_names[col_index-1]
564
-
565
- self.units[col_id] = value
566
-
567
-
568
- def get_size(self, col_id):
569
- """Returns the size of the specified col_id
570
- """
571
- return self.size[col_id]
572
-
573
-
574
- def get_size_by_index(self, col_index):
575
- """Allows to get the size according to the column index rather than
576
- using the column's id.
577
- BE CAREFUL : the '0' column is the '__row_column__' one !
578
- """
579
- if col_index == 0:
580
- col_id = '__row_column__'
581
- else:
582
- col_id = self._table.col_names[col_index-1]
583
-
584
- return self.size[col_id]
585
-
586
-
587
- def get_alignment(self, col_id):
588
- """Returns the alignment of the specified col_id
589
- """
590
- return self.alignment[col_id]
591
-
592
-
593
- def get_alignment_by_index(self, col_index):
594
- """Allors to get the alignment according to the column index rather than
595
- using the column's id.
596
- BE CAREFUL : the '0' column is the '__row_column__' one !
597
- """
598
- if col_index == 0:
599
- col_id = '__row_column__'
600
- else:
601
- col_id = self._table.col_names[col_index-1]
602
-
603
- return self.alignment[col_id]
604
-
605
-
606
- def get_unit(self, col_id):
607
- """Returns the unit of the specified col_id
608
- """
609
- return self.units[col_id]
610
-
611
-
612
- def get_unit_by_index(self, col_index):
613
- """Allors to get the unit according to the column index rather than
614
- using the column's id.
615
- BE CAREFUL : the '0' column is the '__row_column__' one !
616
- """
617
- if col_index == 0:
618
- col_id = '__row_column__'
619
- else:
620
- col_id = self._table.col_names[col_index-1]
621
-
622
- return self.units[col_id]
623
-
624
-
625
- import re
626
- CELL_PROG = re.compile("([0-9]+)_([0-9]+)")
627
-
628
- class TableStyleSheet:
629
- """A simple Table stylesheet
630
- Rules are expressions where cells are defined by the row_index
631
- and col_index separated by an underscore ('_').
632
- For example, suppose you want to say that the (2,5) cell must be
633
- the sum of its two preceding cells in the row, you would create
634
- the following rule :
635
- 2_5 = 2_3 + 2_4
636
- You can also use all the math.* operations you want. For example:
637
- 2_5 = sqrt(2_3**2 + 2_4**2)
638
- """
639
-
640
- def __init__(self, rules = None):
641
- rules = rules or []
642
- self.rules = []
643
- self.instructions = []
644
- for rule in rules:
645
- self.add_rule(rule)
646
-
647
-
648
- def add_rule(self, rule):
649
- """Adds a rule to the stylesheet rules
650
- """
651
- try:
652
- source_code = ['from math import *']
653
- source_code.append(CELL_PROG.sub(r'self.data[\1][\2]', rule))
654
- self.instructions.append(compile('\n'.join(source_code),
655
- 'table.py', 'exec'))
656
- self.rules.append(rule)
657
- except SyntaxError:
658
- print "Bad Stylesheet Rule : %s [skipped]"%rule
659
-
660
-
661
- def add_rowsum_rule(self, dest_cell, row_index, start_col, end_col):
662
- """Creates and adds a rule to sum over the row at row_index from
663
- start_col to end_col.
664
- dest_cell is a tuple of two elements (x,y) of the destination cell
665
- No check is done for indexes ranges.
666
- pre:
667
- start_col >= 0
668
- end_col > start_col
669
- """
670
- cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
671
- end_col + 1)]
672
- rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
673
- self.add_rule(rule)
674
-
675
-
676
- def add_rowavg_rule(self, dest_cell, row_index, start_col, end_col):
677
- """Creates and adds a rule to make the row average (from start_col
678
- to end_col)
679
- dest_cell is a tuple of two elements (x,y) of the destination cell
680
- No check is done for indexes ranges.
681
- pre:
682
- start_col >= 0
683
- end_col > start_col
684
- """
685
- cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
686
- end_col + 1)]
687
- num = (end_col - start_col + 1)
688
- rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
689
- self.add_rule(rule)
690
-
691
-
692
- def add_colsum_rule(self, dest_cell, col_index, start_row, end_row):
693
- """Creates and adds a rule to sum over the col at col_index from
694
- start_row to end_row.
695
- dest_cell is a tuple of two elements (x,y) of the destination cell
696
- No check is done for indexes ranges.
697
- pre:
698
- start_row >= 0
699
- end_row > start_row
700
- """
701
- cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
702
- end_row + 1)]
703
- rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
704
- self.add_rule(rule)
705
-
706
-
707
- def add_colavg_rule(self, dest_cell, col_index, start_row, end_row):
708
- """Creates and adds a rule to make the col average (from start_row
709
- to end_row)
710
- dest_cell is a tuple of two elements (x,y) of the destination cell
711
- No check is done for indexes ranges.
712
- pre:
713
- start_row >= 0
714
- end_row > start_row
715
- """
716
- cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
717
- end_row + 1)]
718
- num = (end_row - start_row + 1)
719
- rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
720
- self.add_rule(rule)
721
-
722
-
723
-
724
- class TableCellRenderer:
725
- """Defines a simple text renderer
726
- """
727
-
728
- def __init__(self, **properties):
729
- """keywords should be properties with an associated boolean as value.
730
- For example :
731
- renderer = TableCellRenderer(units = True, alignment = False)
732
- An unspecified property will have a 'False' value by default.
733
- Possible properties are :
734
- alignment, unit
735
- """
736
- self.properties = properties
737
-
738
-
739
- def render_cell(self, cell_coord, table, table_style):
740
- """Renders the cell at 'cell_coord' in the table, using table_style
741
- """
742
- row_index, col_index = cell_coord
743
- cell_value = table.data[row_index][col_index]
744
- final_content = self._make_cell_content(cell_value,
745
- table_style, col_index +1)
746
- return self._render_cell_content(final_content,
747
- table_style, col_index + 1)
748
-
749
-
750
- def render_row_cell(self, row_name, table, table_style):
751
- """Renders the cell for 'row_id' row
752
- """
753
- cell_value = row_name.encode('iso-8859-1')
754
- return self._render_cell_content(cell_value, table_style, 0)
755
-
756
-
757
- def render_col_cell(self, col_name, table, table_style):
758
- """Renders the cell for 'col_id' row
759
- """
760
- cell_value = col_name.encode('iso-8859-1')
761
- col_index = table.col_names.index(col_name)
762
- return self._render_cell_content(cell_value, table_style, col_index +1)
763
-
764
-
765
-
766
- def _render_cell_content(self, content, table_style, col_index):
767
- """Makes the appropriate rendering for this cell content.
768
- Rendering properties will be searched using the
769
- *table_style.get_xxx_by_index(col_index)' methods
770
-
771
- **This method should be overridden in the derived renderer classes.**
772
- """
773
- return content
774
-
775
-
776
- def _make_cell_content(self, cell_content, table_style, col_index):
777
- """Makes the cell content (adds decoration data, like units for
778
- example)
779
- """
780
- final_content = cell_content
781
- if 'skip_zero' in self.properties:
782
- replacement_char = self.properties['skip_zero']
783
- else:
784
- replacement_char = 0
785
- if replacement_char and final_content == 0:
786
- return replacement_char
787
-
788
- try:
789
- units_on = self.properties['units']
790
- if units_on:
791
- final_content = self._add_unit(
792
- cell_content, table_style, col_index)
793
- except KeyError:
794
- pass
795
-
796
- return final_content
797
-
798
-
799
- def _add_unit(self, cell_content, table_style, col_index):
800
- """Adds unit to the cell_content if needed
801
- """
802
- unit = table_style.get_unit_by_index(col_index)
803
- return str(cell_content) + " " + unit
804
-
805
-
806
-
807
- class DocbookRenderer(TableCellRenderer):
808
- """Defines how to render a cell for a docboook table
809
- """
810
-
811
- def define_col_header(self, col_index, table_style):
812
- """Computes the colspec element according to the style
813
- """
814
- size = table_style.get_size_by_index(col_index)
815
- return '<colspec colname="c%d" colwidth="%s"/>\n' % \
816
- (col_index, size)
817
-
818
-
819
- def _render_cell_content(self, cell_content, table_style, col_index):
820
- """Makes the appropriate rendering for this cell content.
821
- Rendering properties will be searched using the
822
- table_style.get_xxx_by_index(col_index)' methods.
823
- """
824
- try:
825
- align_on = self.properties['alignment']
826
- alignment = table_style.get_alignment_by_index(col_index)
827
- if align_on:
828
- return "<entry align='%s'>%s</entry>\n" % \
829
- (alignment, cell_content)
830
- except KeyError:
831
- # KeyError <=> Default alignment
832
- return "<entry>%s</entry>\n" % cell_content
833
-
834
-
835
- class TableWriter:
836
- """A class to write tables
837
- """
838
-
839
- def __init__(self, stream, table, style, **properties):
840
- self._stream = stream
841
- self.style = style or TableStyle(table)
842
- self._table = table
843
- self.properties = properties
844
- self.renderer = None
845
-
846
-
847
- def set_style(self, style):
848
- """sets the table's associated style
849
- """
850
- self.style = style
851
-
852
-
853
- def set_renderer(self, renderer):
854
- """sets the way to render cell
855
- """
856
- self.renderer = renderer
857
-
858
-
859
- def update_properties(self, **properties):
860
- """Updates writer's properties (for cell rendering)
861
- """
862
- self.properties.update(properties)
863
-
864
-
865
- def write_table(self, title = ""):
866
- """Writes the table
867
- """
868
- raise NotImplementedError("write_table must be implemented !")
869
-
870
-
871
-
872
- class DocbookTableWriter(TableWriter):
873
- """Defines an implementation of TableWriter to write a table in Docbook
874
- """
875
-
876
- def _write_headers(self):
877
- """Writes col headers
878
- """
879
- # Define col_headers (colstpec elements)
880
- for col_index in range(len(self._table.col_names)+1):
881
- self._stream.write(self.renderer.define_col_header(col_index,
882
- self.style))
883
-
884
- self._stream.write("<thead>\n<row>\n")
885
- # XXX FIXME : write an empty entry <=> the first (__row_column) column
886
- self._stream.write('<entry></entry>\n')
887
- for col_name in self._table.col_names:
888
- self._stream.write(self.renderer.render_col_cell(
889
- col_name, self._table,
890
- self.style))
891
-
892
- self._stream.write("</row>\n</thead>\n")
893
-
894
-
895
- def _write_body(self):
896
- """Writes the table body
897
- """
898
- self._stream.write('<tbody>\n')
899
-
900
- for row_index, row in enumerate(self._table.data):
901
- self._stream.write('<row>\n')
902
- row_name = self._table.row_names[row_index]
903
- # Write the first entry (row_name)
904
- self._stream.write(self.renderer.render_row_cell(row_name,
905
- self._table,
906
- self.style))
907
-
908
- for col_index, cell in enumerate(row):
909
- self._stream.write(self.renderer.render_cell(
910
- (row_index, col_index),
911
- self._table, self.style))
912
-
913
- self._stream.write('</row>\n')
914
-
915
- self._stream.write('</tbody>\n')
916
-
917
-
918
- def write_table(self, title = ""):
919
- """Writes the table
920
- """
921
- self._stream.write('<table>\n<title>%s></title>\n'%(title))
922
- self._stream.write(
923
- '<tgroup cols="%d" align="left" colsep="1" rowsep="1">\n'%
924
- (len(self._table.col_names)+1))
925
- self._write_headers()
926
- self._write_body()
927
-
928
- self._stream.write('</tgroup>\n</table>\n')
929
-
930
-