bee_python 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,749 +0,0 @@
1
- # Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
2
- # Copyright (c) 2009-2010 Arista Networks, Inc.
3
- # http://www.logilab.fr/ -- mailto:contact@logilab.fr
4
- # This program is free software; you can redistribute it and/or modify it under
5
- # the terms of the GNU General Public License as published by the Free Software
6
- # Foundation; either version 2 of the License, or (at your option) any later
7
- # version.
8
- #
9
- # This program is distributed in the hope that it will be useful, but WITHOUT
10
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License along with
14
- # this program; if not, write to the Free Software Foundation, Inc.,
15
- # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
- """basic checker for Python code"""
17
-
18
-
19
- from logilab import astng
20
- from logilab.common.compat import any
21
- from logilab.common.ureports import Table
22
- from logilab.astng import are_exclusive
23
-
24
- from pylint.interfaces import IASTNGChecker
25
- from pylint.reporters import diff_string
26
- from pylint.checkers import BaseChecker, EmptyReport
27
-
28
-
29
- import re
30
-
31
- # regex for class/function/variable/constant name
32
- CLASS_NAME_RGX = re.compile('[A-Z_][a-zA-Z0-9]+$')
33
- MOD_NAME_RGX = re.compile('(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$')
34
- CONST_NAME_RGX = re.compile('(([A-Z_][A-Z0-9_]*)|(__.*__))$')
35
- COMP_VAR_RGX = re.compile('[A-Za-z_][A-Za-z0-9_]*$')
36
- DEFAULT_NAME_RGX = re.compile('[a-z_][a-z0-9_]{2,30}$')
37
- # do not require a doc string on system methods
38
- NO_REQUIRED_DOC_RGX = re.compile('__.*__')
39
-
40
- del re
41
-
42
- def in_loop(node):
43
- """return True if the node is inside a kind of for loop"""
44
- parent = node.parent
45
- while parent is not None:
46
- if isinstance(parent, (astng.For, astng.ListComp, astng.GenExpr)):
47
- return True
48
- parent = parent.parent
49
- return False
50
-
51
- def in_nested_list(nested_list, obj):
52
- """return true if the object is an element of <nested_list> or of a nested
53
- list
54
- """
55
- for elmt in nested_list:
56
- if isinstance(elmt, (list, tuple)):
57
- if in_nested_list(elmt, obj):
58
- return True
59
- elif elmt == obj:
60
- return True
61
- return False
62
-
63
- def report_by_type_stats(sect, stats, old_stats):
64
- """make a report of
65
-
66
- * percentage of different types documented
67
- * percentage of different types with a bad name
68
- """
69
- # percentage of different types documented and/or with a bad name
70
- nice_stats = {}
71
- for node_type in ('module', 'class', 'method', 'function'):
72
- try:
73
- total = stats[node_type]
74
- except KeyError:
75
- raise EmptyReport()
76
- nice_stats[node_type] = {}
77
- if total != 0:
78
- try:
79
- documented = total - stats['undocumented_'+node_type]
80
- percent = (documented * 100.) / total
81
- nice_stats[node_type]['percent_documented'] = '%.2f' % percent
82
- except KeyError:
83
- nice_stats[node_type]['percent_documented'] = 'NC'
84
- try:
85
- percent = (stats['badname_'+node_type] * 100.) / total
86
- nice_stats[node_type]['percent_badname'] = '%.2f' % percent
87
- except KeyError:
88
- nice_stats[node_type]['percent_badname'] = 'NC'
89
- lines = ('type', 'number', 'old number', 'difference',
90
- '%documented', '%badname')
91
- for node_type in ('module', 'class', 'method', 'function'):
92
- new = stats[node_type]
93
- old = old_stats.get(node_type, None)
94
- if old is not None:
95
- diff_str = diff_string(old, new)
96
- else:
97
- old, diff_str = 'NC', 'NC'
98
- lines += (node_type, str(new), str(old), diff_str,
99
- nice_stats[node_type].get('percent_documented', '0'),
100
- nice_stats[node_type].get('percent_badname', '0'))
101
- sect.append(Table(children=lines, cols=6, rheaders=1))
102
-
103
- class _BasicChecker(BaseChecker):
104
- __implements__ = IASTNGChecker
105
- name = 'basic'
106
-
107
- class BasicErrorChecker(_BasicChecker):
108
- msgs = {
109
- 'E0100': ('__init__ method is a generator',
110
- 'Used when the special class method __init__ is turned into a '
111
- 'generator by a yield in its body.'),
112
- 'E0101': ('Explicit return in __init__',
113
- 'Used when the special class method __init__ has an explicit \
114
- return value.'),
115
- 'E0102': ('%s already defined line %s',
116
- 'Used when a function / class / method is redefined.'),
117
- 'E0103': ('%r not properly in loop',
118
- 'Used when break or continue keywords are used outside a loop.'),
119
-
120
- 'E0104': ('Return outside function',
121
- 'Used when a "return" statement is found outside a function or '
122
- 'method.'),
123
- 'E0105': ('Yield outside function',
124
- 'Used when a "yield" statement is found outside a function or '
125
- 'method.'),
126
- 'E0106': ('Return with argument inside generator',
127
- 'Used when a "return" statement with an argument is found '
128
- 'outside in a generator function or method (e.g. with some '
129
- '"yield" statements).'),
130
- 'E0107': ("Use of the non-existent %s operator",
131
- "Used when you attempt to use the C-style pre-increment or"
132
- "pre-decrement operator -- and ++, which doesn't exist in Python."),
133
- }
134
-
135
- def __init__(self, linter):
136
- _BasicChecker.__init__(self, linter)
137
- self._returns = None
138
-
139
- def open(self):
140
- self._returns = []
141
-
142
- def visit_class(self, node):
143
- self._check_redefinition('class', node)
144
-
145
- def visit_function(self, node):
146
- self._returns.append([])
147
- self._check_redefinition(node.is_method() and 'method' or 'function', node)
148
-
149
- def leave_function(self, node):
150
- """most of the work is done here on close:
151
- checks for max returns, branch, return in __init__
152
- """
153
- returns = self._returns.pop()
154
- if node.is_method() and node.name == '__init__':
155
- if node.is_generator():
156
- self.add_message('E0100', node=node)
157
- else:
158
- values = [r.value for r in returns]
159
- if [v for v in values if not (v is None or
160
- (isinstance(v, astng.Const) and v.value is None)
161
- or (isinstance(v, astng.Name) and v.name == 'None'))]:
162
- self.add_message('E0101', node=node)
163
- elif node.is_generator():
164
- # make sure we don't mix non-None returns and yields
165
- for retnode in returns:
166
- if isinstance(retnode, astng.Return) and \
167
- isinstance(retnode.value, astng.Const) and \
168
- retnode.value.value is not None:
169
- self.add_message('E0106', node=node,
170
- line=retnode.fromlineno)
171
-
172
- def visit_return(self, node):
173
- # if self._returns is empty, we're outside a function
174
- if not self._returns:
175
- self.add_message('E0104', node=node)
176
- return
177
- self._returns[-1].append(node)
178
-
179
- def visit_yield(self, node):
180
- # if self._returns is empty, we're outside a function
181
- if not self._returns:
182
- self.add_message('E0105', node=node)
183
- return
184
- self._returns[-1].append(node)
185
-
186
- def visit_continue(self, node):
187
- self._check_in_loop(node, 'continue')
188
-
189
- def visit_break(self, node):
190
- self._check_in_loop(node, 'break')
191
-
192
- def visit_unaryop(self, node):
193
- """check use of the non-existent ++ adn -- operator operator"""
194
- if ((node.op in '+-') and
195
- isinstance(node.operand, astng.UnaryOp) and
196
- (node.operand.op == node.op)):
197
- self.add_message('E0107', node=node, args=node.op*2)
198
-
199
- def _check_in_loop(self, node, node_name):
200
- """check that a node is inside a for or while loop"""
201
- _node = node.parent
202
- while _node:
203
- if isinstance(_node, (astng.For, astng.While)):
204
- break
205
- _node = _node.parent
206
- else:
207
- self.add_message('E0103', node=node, args=node_name)
208
-
209
- def _check_redefinition(self, redeftype, node):
210
- """check for redefinition of a function / method / class name"""
211
- defined_self = node.parent.frame()[node.name]
212
- if defined_self is not node and not are_exclusive(node, defined_self):
213
- self.add_message('E0102', node=node,
214
- args=(redeftype, defined_self.fromlineno))
215
-
216
-
217
-
218
- class BasicChecker(_BasicChecker):
219
- """checks for :
220
- * doc strings
221
- * modules / classes / functions / methods / arguments / variables name
222
- * number of arguments, local variables, branches, returns and statements in
223
- functions, methods
224
- * required module attributes
225
- * dangerous default values as arguments
226
- * redefinition of function / method / class
227
- * uses of the global statement
228
- """
229
-
230
- __implements__ = IASTNGChecker
231
-
232
- name = 'basic'
233
- msgs = {
234
- 'W0101': ('Unreachable code',
235
- 'Used when there is some code behind a "return" or "raise" \
236
- statement, which will never be accessed.'),
237
- 'W0102': ('Dangerous default value %s as argument',
238
- 'Used when a mutable value as list or dictionary is detected in \
239
- a default value for an argument.'),
240
- 'W0104': ('Statement seems to have no effect',
241
- 'Used when a statement doesn\'t have (or at least seems to) \
242
- any effect.'),
243
- 'W0105': ('String statement has no effect',
244
- 'Used when a string is used as a statement (which of course \
245
- has no effect). This is a particular case of W0104 with its \
246
- own message so you can easily disable it if you\'re using \
247
- those strings as documentation, instead of comments.'),
248
- 'W0108': ('Lambda may not be necessary',
249
- 'Used when the body of a lambda expression is a function call \
250
- on the same argument list as the lambda itself; such lambda \
251
- expressions are in all but a few cases replaceable with the \
252
- function being called in the body of the lambda.'),
253
- 'W0109': ("Duplicate key %r in dictionary",
254
- "Used when a dictionary expression binds the same key multiple \
255
- times."),
256
- 'W0122': ('Use of the exec statement',
257
- 'Used when you use the "exec" statement, to discourage its \
258
- usage. That doesn\'t mean you can not use it !'),
259
-
260
- 'W0141': ('Used builtin function %r',
261
- 'Used when a black listed builtin function is used (see the '
262
- 'bad-function option). Usual black listed functions are the ones '
263
- 'like map, or filter , where Python offers now some cleaner '
264
- 'alternative like list comprehension.'),
265
- 'W0142': ('Used * or ** magic',
266
- 'Used when a function or method is called using `*args` or '
267
- '`**kwargs` to dispatch arguments. This doesn\'t improve '
268
- 'readability and should be used with care.'),
269
- 'W0150': ("%s statement in finally block may swallow exception",
270
- "Used when a break or a return statement is found inside the \
271
- finally clause of a try...finally block: the exceptions raised \
272
- in the try clause will be silently swallowed instead of being \
273
- re-raised."),
274
- 'W0199': ('Assert called on a 2-uple. Did you mean \'assert x,y\'?',
275
- 'A call of assert on a tuple will always evaluate to true if '
276
- 'the tuple is not empty, and will always evaluate to false if '
277
- 'it is.'),
278
-
279
- 'C0121': ('Missing required attribute "%s"', # W0103
280
- 'Used when an attribute required for modules is missing.'),
281
-
282
- }
283
-
284
- options = (('required-attributes',
285
- {'default' : (), 'type' : 'csv',
286
- 'metavar' : '<attributes>',
287
- 'help' : 'Required attributes for module, separated by a '
288
- 'comma'}
289
- ),
290
- ('bad-functions',
291
- {'default' : ('map', 'filter', 'apply', 'input'),
292
- 'type' :'csv', 'metavar' : '<builtin function names>',
293
- 'help' : 'List of builtins function names that should not be '
294
- 'used, separated by a comma'}
295
- ),
296
- )
297
- reports = ( ('RP0101', 'Statistics by type', report_by_type_stats), )
298
-
299
- def __init__(self, linter):
300
- _BasicChecker.__init__(self, linter)
301
- self.stats = None
302
- self._tryfinallys = None
303
-
304
- def open(self):
305
- """initialize visit variables and statistics
306
- """
307
- self._tryfinallys = []
308
- self.stats = self.linter.add_stats(module=0, function=0,
309
- method=0, class_=0)
310
-
311
- def visit_module(self, node):
312
- """check module name, docstring and required arguments
313
- """
314
- self.stats['module'] += 1
315
- self._check_required_attributes(node, self.config.required_attributes)
316
-
317
- def visit_class(self, node):
318
- """check module name, docstring and redefinition
319
- increment branch counter
320
- """
321
- self.stats['class'] += 1
322
-
323
- def visit_discard(self, node):
324
- """check for various kind of statements without effect"""
325
- expr = node.value
326
- if isinstance(expr, astng.Const) and isinstance(expr.value, basestring):
327
- # treat string statement in a separated message
328
- self.add_message('W0105', node=node)
329
- return
330
- # ignore if this is :
331
- # * a function call (can't predicate side effects)
332
- # * the unique children of a try/except body
333
- # * a yield (which are wrapped by a discard node in _ast XXX)
334
- if not (any(expr.nodes_of_class((astng.CallFunc, astng.Yield)))
335
- or isinstance(node.parent, astng.TryExcept) and node.parent.body == [node]):
336
- self.add_message('W0104', node=node)
337
-
338
- def visit_lambda(self, node):
339
- """check whether or not the lambda is suspicious
340
- """
341
- # if the body of the lambda is a call expression with the same
342
- # argument list as the lambda itself, then the lambda is
343
- # possibly unnecessary and at least suspicious.
344
- if node.args.defaults:
345
- # If the arguments of the lambda include defaults, then a
346
- # judgment cannot be made because there is no way to check
347
- # that the defaults defined by the lambda are the same as
348
- # the defaults defined by the function called in the body
349
- # of the lambda.
350
- return
351
- call = node.body
352
- if not isinstance(call, astng.CallFunc):
353
- # The body of the lambda must be a function call expression
354
- # for the lambda to be unnecessary.
355
- return
356
- # XXX are lambda still different with astng >= 0.18 ?
357
- # *args and **kwargs need to be treated specially, since they
358
- # are structured differently between the lambda and the function
359
- # call (in the lambda they appear in the args.args list and are
360
- # indicated as * and ** by two bits in the lambda's flags, but
361
- # in the function call they are omitted from the args list and
362
- # are indicated by separate attributes on the function call node).
363
- ordinary_args = list(node.args.args)
364
- if node.args.kwarg:
365
- if (not call.kwargs
366
- or not isinstance(call.kwargs, astng.Name)
367
- or node.args.kwarg != call.kwargs.name):
368
- return
369
- elif call.kwargs:
370
- return
371
- if node.args.vararg:
372
- if (not call.starargs
373
- or not isinstance(call.starargs, astng.Name)
374
- or node.args.vararg != call.starargs.name):
375
- return
376
- elif call.starargs:
377
- return
378
- # The "ordinary" arguments must be in a correspondence such that:
379
- # ordinary_args[i].name == call.args[i].name.
380
- if len(ordinary_args) != len(call.args):
381
- return
382
- for i in xrange(len(ordinary_args)):
383
- if not isinstance(call.args[i], astng.Name):
384
- return
385
- if node.args.args[i].name != call.args[i].name:
386
- return
387
- self.add_message('W0108', line=node.fromlineno, node=node)
388
-
389
- def visit_function(self, node):
390
- """check function name, docstring, arguments, redefinition,
391
- variable names, max locals
392
- """
393
- self.stats[node.is_method() and 'method' or 'function'] += 1
394
- # check default arguments'value
395
- self._check_defaults(node)
396
-
397
- def visit_return(self, node):
398
- """1 - check is the node has a right sibling (if so, that's some
399
- unreachable code)
400
- 2 - check is the node is inside the finally clause of a try...finally
401
- block
402
- """
403
- self._check_unreachable(node)
404
- # Is it inside final body of a try...finally bloc ?
405
- self._check_not_in_finally(node, 'return', (astng.Function,))
406
-
407
- def visit_continue(self, node):
408
- """check is the node has a right sibling (if so, that's some unreachable
409
- code)
410
- """
411
- self._check_unreachable(node)
412
-
413
- def visit_break(self, node):
414
- """1 - check is the node has a right sibling (if so, that's some
415
- unreachable code)
416
- 2 - check is the node is inside the finally clause of a try...finally
417
- block
418
- """
419
- # 1 - Is it right sibling ?
420
- self._check_unreachable(node)
421
- # 2 - Is it inside final body of a try...finally bloc ?
422
- self._check_not_in_finally(node, 'break', (astng.For, astng.While,))
423
-
424
- def visit_raise(self, node):
425
- """check is the node has a right sibling (if so, that's some unreachable
426
- code)
427
- """
428
- self._check_unreachable(node)
429
-
430
- def visit_exec(self, node):
431
- """just print a warning on exec statements"""
432
- self.add_message('W0122', node=node)
433
-
434
- def visit_callfunc(self, node):
435
- """visit a CallFunc node -> check if this is not a blacklisted builtin
436
- call and check for * or ** use
437
- """
438
- if isinstance(node.func, astng.Name):
439
- name = node.func.name
440
- # ignore the name if it's not a builtin (i.e. not defined in the
441
- # locals nor globals scope)
442
- if not (node.frame().has_key(name) or
443
- node.root().has_key(name)):
444
- if name in self.config.bad_functions:
445
- self.add_message('W0141', node=node, args=name)
446
- if node.starargs or node.kwargs:
447
- scope = node.scope()
448
- if isinstance(scope, astng.Function):
449
- toprocess = [(n, vn) for (n, vn) in ((node.starargs, scope.args.vararg),
450
- (node.kwargs, scope.args.kwarg)) if n]
451
- if toprocess:
452
- for cfnode, fargname in toprocess[:]:
453
- if getattr(cfnode, 'name', None) == fargname:
454
- toprocess.remove((cfnode, fargname))
455
- if not toprocess:
456
- return # W0142 can be skipped
457
- self.add_message('W0142', node=node.func)
458
-
459
- def visit_assert(self, node):
460
- """check the use of an assert statement on a tuple."""
461
- if node.fail is None and isinstance(node.test, astng.Tuple) and \
462
- len(node.test.elts) == 2:
463
- self.add_message('W0199', line=node.fromlineno, node=node)
464
-
465
- def visit_dict(self, node):
466
- """check duplicate key in dictionary"""
467
- keys = set()
468
- for k, v in node.items:
469
- if isinstance(k, astng.Const):
470
- key = k.value
471
- if key in keys:
472
- self.add_message('W0109', node=node, args=key)
473
- keys.add(key)
474
-
475
- def visit_tryfinally(self, node):
476
- """update try...finally flag"""
477
- self._tryfinallys.append(node)
478
-
479
- def leave_tryfinally(self, node):
480
- """update try...finally flag"""
481
- self._tryfinallys.pop()
482
-
483
-
484
- def _check_unreachable(self, node):
485
- """check unreachable code"""
486
- unreach_stmt = node.next_sibling()
487
- if unreach_stmt is not None:
488
- self.add_message('W0101', node=unreach_stmt)
489
-
490
- def _check_defaults(self, node):
491
- """check for dangerous default values as arguments"""
492
- for default in node.args.defaults:
493
- try:
494
- value = default.infer().next()
495
- except astng.InferenceError:
496
- continue
497
- if isinstance(value, (astng.Dict, astng.List)):
498
- if value is default:
499
- msg = default.as_string()
500
- else:
501
- msg = '%s (%s)' % (default.as_string(), value.as_string())
502
- self.add_message('W0102', node=node, args=(msg,))
503
-
504
- def _check_required_attributes(self, node, attributes):
505
- """check for required attributes"""
506
- for attr in attributes:
507
- if not node.has_key(attr):
508
- self.add_message('C0121', node=node, args=attr)
509
-
510
- def _check_not_in_finally(self, node, node_name, breaker_classes=()):
511
- """check that a node is not inside a finally clause of a
512
- try...finally statement.
513
- If we found before a try...finally bloc a parent which its type is
514
- in breaker_classes, we skip the whole check."""
515
- # if self._tryfinallys is empty, we're not a in try...finally bloc
516
- if not self._tryfinallys:
517
- return
518
- # the node could be a grand-grand...-children of the try...finally
519
- _parent = node.parent
520
- _node = node
521
- while _parent and not isinstance(_parent, breaker_classes):
522
- if hasattr(_parent, 'finalbody') and _node in _parent.finalbody:
523
- self.add_message('W0150', node=node, args=node_name)
524
- return
525
- _node = _parent
526
- _parent = _node.parent
527
-
528
-
529
-
530
- class NameChecker(_BasicChecker):
531
- msgs = {
532
- 'C0102': ('Black listed name "%s"',
533
- 'Used when the name is listed in the black list (unauthorized \
534
- names).'),
535
- 'C0103': ('Invalid name "%s" (should match %s)',
536
- 'Used when the name doesn\'t match the regular expression \
537
- associated to its type (constant, variable, class...).'),
538
-
539
- }
540
- options = (('module-rgx',
541
- {'default' : MOD_NAME_RGX,
542
- 'type' :'regexp', 'metavar' : '<regexp>',
543
- 'help' : 'Regular expression which should only match correct '
544
- 'module names'}
545
- ),
546
- ('const-rgx',
547
- {'default' : CONST_NAME_RGX,
548
- 'type' :'regexp', 'metavar' : '<regexp>',
549
- 'help' : 'Regular expression which should only match correct '
550
- 'module level names'}
551
- ),
552
- ('class-rgx',
553
- {'default' : CLASS_NAME_RGX,
554
- 'type' :'regexp', 'metavar' : '<regexp>',
555
- 'help' : 'Regular expression which should only match correct '
556
- 'class names'}
557
- ),
558
- ('function-rgx',
559
- {'default' : DEFAULT_NAME_RGX,
560
- 'type' :'regexp', 'metavar' : '<regexp>',
561
- 'help' : 'Regular expression which should only match correct '
562
- 'function names'}
563
- ),
564
- ('method-rgx',
565
- {'default' : DEFAULT_NAME_RGX,
566
- 'type' :'regexp', 'metavar' : '<regexp>',
567
- 'help' : 'Regular expression which should only match correct '
568
- 'method names'}
569
- ),
570
- ('attr-rgx',
571
- {'default' : DEFAULT_NAME_RGX,
572
- 'type' :'regexp', 'metavar' : '<regexp>',
573
- 'help' : 'Regular expression which should only match correct '
574
- 'instance attribute names'}
575
- ),
576
- ('argument-rgx',
577
- {'default' : DEFAULT_NAME_RGX,
578
- 'type' :'regexp', 'metavar' : '<regexp>',
579
- 'help' : 'Regular expression which should only match correct '
580
- 'argument names'}),
581
- ('variable-rgx',
582
- {'default' : DEFAULT_NAME_RGX,
583
- 'type' :'regexp', 'metavar' : '<regexp>',
584
- 'help' : 'Regular expression which should only match correct '
585
- 'variable names'}
586
- ),
587
- ('inlinevar-rgx',
588
- {'default' : COMP_VAR_RGX,
589
- 'type' :'regexp', 'metavar' : '<regexp>',
590
- 'help' : 'Regular expression which should only match correct '
591
- 'list comprehension / generator expression variable \
592
- names'}
593
- ),
594
- # XXX use set
595
- ('good-names',
596
- {'default' : ('i', 'j', 'k', 'ex', 'Run', '_'),
597
- 'type' :'csv', 'metavar' : '<names>',
598
- 'help' : 'Good variable names which should always be accepted,'
599
- ' separated by a comma'}
600
- ),
601
- ('bad-names',
602
- {'default' : ('foo', 'bar', 'baz', 'toto', 'tutu', 'tata'),
603
- 'type' :'csv', 'metavar' : '<names>',
604
- 'help' : 'Bad variable names which should always be refused, '
605
- 'separated by a comma'}
606
- ),
607
- )
608
-
609
- def open(self):
610
- self.stats = self.linter.add_stats(badname_module=0,
611
- badname_class=0, badname_function=0,
612
- badname_method=0, badname_attr=0,
613
- badname_const=0,
614
- badname_variable=0,
615
- badname_inlinevar=0,
616
- badname_argument=0)
617
-
618
- def visit_module(self, node):
619
- self._check_name('module', node.name.split('.')[-1], node)
620
-
621
- def visit_class(self, node):
622
- self._check_name('class', node.name, node)
623
- for attr, anodes in node.instance_attrs.items():
624
- self._check_name('attr', attr, anodes[0])
625
-
626
- def visit_function(self, node):
627
- self._check_name(node.is_method() and 'method' or 'function',
628
- node.name, node)
629
- # check arguments name
630
- args = node.args.args
631
- if args is not None:
632
- self._recursive_check_names(args, node)
633
-
634
- def visit_assname(self, node):
635
- """check module level assigned names"""
636
- frame = node.frame()
637
- ass_type = node.ass_type()
638
- if isinstance(ass_type, (astng.Comprehension, astng.Comprehension)):
639
- self._check_name('inlinevar', node.name, node)
640
- elif isinstance(frame, astng.Module):
641
- if isinstance(ass_type, astng.Assign) and not in_loop(ass_type):
642
- self._check_name('const', node.name, node)
643
- elif isinstance(frame, astng.Function):
644
- # global introduced variable aren't in the function locals
645
- if node.name in frame:
646
- self._check_name('variable', node.name, node)
647
-
648
- def _recursive_check_names(self, args, node):
649
- """check names in a possibly recursive list <arg>"""
650
- for arg in args:
651
- #if type(arg) is type(''):
652
- if isinstance(arg, astng.AssName):
653
- self._check_name('argument', arg.name, node)
654
- else:
655
- self._recursive_check_names(arg.elts, node)
656
-
657
- def _check_name(self, node_type, name, node):
658
- """check for a name using the type's regexp"""
659
- if name in self.config.good_names:
660
- return
661
- if name in self.config.bad_names:
662
- self.stats['badname_' + node_type] += 1
663
- self.add_message('C0102', node=node, args=name)
664
- return
665
- regexp = getattr(self.config, node_type + '_rgx')
666
- if regexp.match(name) is None:
667
- self.add_message('C0103', node=node, args=(name, regexp.pattern))
668
- self.stats['badname_' + node_type] += 1
669
-
670
-
671
-
672
- class DocStringChecker(_BasicChecker):
673
- msgs = {
674
- 'C0111': ('Missing docstring', # W0131
675
- 'Used when a module, function, class or method has no docstring.\
676
- Some special methods like __init__ doesn\'t necessary require a \
677
- docstring.'),
678
- 'C0112': ('Empty docstring', # W0132
679
- 'Used when a module, function, class or method has an empty \
680
- docstring (it would be too easy ;).'),
681
- }
682
- options = (('no-docstring-rgx',
683
- {'default' : NO_REQUIRED_DOC_RGX,
684
- 'type' : 'regexp', 'metavar' : '<regexp>',
685
- 'help' : 'Regular expression which should only match '
686
- 'functions or classes name which do not require a '
687
- 'docstring'}
688
- ),
689
- )
690
-
691
- def open(self):
692
- self.stats = self.linter.add_stats(undocumented_module=0,
693
- undocumented_function=0,
694
- undocumented_method=0,
695
- undocumented_class=0)
696
-
697
- def visit_module(self, node):
698
- self._check_docstring('module', node)
699
-
700
- def visit_class(self, node):
701
- if self.config.no_docstring_rgx.match(node.name) is None:
702
- self._check_docstring('class', node)
703
-
704
- def visit_function(self, node):
705
- if self.config.no_docstring_rgx.match(node.name) is None:
706
- ftype = node.is_method() and 'method' or 'function'
707
- if isinstance(node.parent.frame(), astng.Class):
708
- overridden = False
709
- # check if node is from a method overridden by its ancestor
710
- for ancestor in node.parent.frame().ancestors():
711
- if node.name in ancestor and \
712
- isinstance(ancestor[node.name], astng.Function):
713
- overridden = True
714
- break
715
- if not overridden:
716
- self._check_docstring(ftype, node)
717
- else:
718
- self._check_docstring(ftype, node)
719
-
720
- def _check_docstring(self, node_type, node):
721
- """check the node has a non empty docstring"""
722
- docstring = node.doc
723
- if docstring is None:
724
- self.stats['undocumented_'+node_type] += 1
725
- self.add_message('C0111', node=node)
726
- elif not docstring.strip():
727
- self.stats['undocumented_'+node_type] += 1
728
- self.add_message('C0112', node=node)
729
-
730
-
731
- class PassChecker(_BasicChecker):
732
- """check is the pass statement is really necessary"""
733
- msgs = {'W0107': ('Unnecessary pass statement',
734
- 'Used when a "pass" statement that can be avoided is '
735
- 'encountered.)'),
736
- }
737
-
738
- def visit_pass(self, node):
739
- if len(node.parent.child_sequence(node)) > 1:
740
- self.add_message('W0107', node=node)
741
-
742
-
743
- def register(linter):
744
- """required method to auto register this checker"""
745
- linter.register_checker(BasicErrorChecker(linter))
746
- linter.register_checker(BasicChecker(linter))
747
- linter.register_checker(NameChecker(linter))
748
- linter.register_checker(DocStringChecker(linter))
749
- linter.register_checker(PassChecker(linter))