exercism-analysis 0.1.1

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 (579) hide show
  1. checksums.yaml +7 -0
  2. data/exercism-analysis.gemspec +30 -0
  3. data/lib/exercism-analysis.rb +38 -0
  4. data/lib/exercism-analysis/adapters/adapter.rb +23 -0
  5. data/lib/exercism-analysis/adapters/clojure.rb +13 -0
  6. data/lib/exercism-analysis/adapters/go.rb +19 -0
  7. data/lib/exercism-analysis/adapters/javascript.rb +13 -0
  8. data/lib/exercism-analysis/adapters/python.rb +13 -0
  9. data/lib/exercism-analysis/adapters/ruby.rb +19 -0
  10. data/lib/exercism-analysis/analysis.rb +18 -0
  11. data/lib/exercism-analysis/analyzers/analyzer.rb +54 -0
  12. data/lib/exercism-analysis/analyzers/clojure/kibit.rb +25 -0
  13. data/lib/exercism-analysis/analyzers/go/golint.rb +23 -0
  14. data/lib/exercism-analysis/analyzers/javascript/jslint.rb +24 -0
  15. data/lib/exercism-analysis/analyzers/python/pylint.rb +24 -0
  16. data/lib/exercism-analysis/analyzers/ruby/control_flow.rb +21 -0
  17. data/lib/exercism-analysis/analyzers/ruby/enumerable_condition.rb +21 -0
  18. data/lib/exercism-analysis/analyzers/ruby/for_loop.rb +29 -0
  19. data/lib/exercism-analysis/analyzers/ruby/indentation.rb +21 -0
  20. data/lib/exercism-analysis/analyzers/ruby/iter_mutation.rb +37 -0
  21. data/lib/exercism-analysis/analyzers/ruby/output.rb +20 -0
  22. data/lib/exercism-analysis/analyzers/ruby/range.rb +28 -0
  23. data/lib/exercism-analysis/analyzers/ruby/roodi.rb +19 -0
  24. data/lib/exercism-analysis/analyzers/ruby/send.rb +25 -0
  25. data/lib/exercism-analysis/analyzers/ruby/shebang.rb +23 -0
  26. data/lib/exercism-analysis/analyzers/ruby/tab.rb +38 -0
  27. data/lib/exercism-analysis/processors/call_processor.rb +39 -0
  28. data/lib/exercism-analysis/processors/control_flow_processor.rb +27 -0
  29. data/lib/exercism-analysis/processors/enumerable_condition_processor.rb +31 -0
  30. data/lib/exercism-analysis/processors/for_loop_processor.rb +21 -0
  31. data/lib/exercism-analysis/processors/indentation_processor.rb +69 -0
  32. data/lib/exercism-analysis/processors/iter_mutation_processor.rb +50 -0
  33. data/lib/exercism-analysis/processors/processor.rb +34 -0
  34. data/lib/exercism-analysis/processors/range_processor.rb +23 -0
  35. data/lib/exercism-analysis/processors/send_processor.rb +23 -0
  36. data/lib/exercism-analysis/templates/each_to_map.rb +29 -0
  37. data/lib/exercism-analysis/templates/each_to_select.rb +31 -0
  38. data/lib/exercism-analysis/templates/range_exclusive.rb +19 -0
  39. data/lib/exercism-analysis/templates/template.rb +29 -0
  40. data/vendor/clojure/kibit-runner/LICENSE +214 -0
  41. data/vendor/clojure/kibit-runner/project.clj +10 -0
  42. data/vendor/clojure/kibit-runner/src/kibit_runner/core.clj +17 -0
  43. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT-standalone.jar +0 -0
  44. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT.jar +0 -0
  45. data/vendor/clojure/kibit-runner/target/stale/extract-native.dependencies +1 -0
  46. data/vendor/go/src/github.com/golang/lint/LICENSE +27 -0
  47. data/vendor/go/src/github.com/golang/lint/README +59 -0
  48. data/vendor/go/src/github.com/golang/lint/golint/golint.go +67 -0
  49. data/vendor/go/src/github.com/golang/lint/lint.go +1061 -0
  50. data/vendor/go/src/runner/golint_runner.go +23 -0
  51. data/vendor/javascript/jshint_runner.js +6 -0
  52. data/vendor/javascript/node_modules/jshint/README.md +47 -0
  53. data/vendor/javascript/node_modules/jshint/bin/apply +6 -0
  54. data/vendor/javascript/node_modules/jshint/bin/build +36 -0
  55. data/vendor/javascript/node_modules/jshint/bin/changelog +36 -0
  56. data/vendor/javascript/node_modules/jshint/bin/jshint +3 -0
  57. data/vendor/javascript/node_modules/jshint/bin/land +34 -0
  58. data/vendor/javascript/node_modules/jshint/data/ascii-identifier-data.js +22 -0
  59. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-part-only.js +1570 -0
  60. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-start.js +48477 -0
  61. data/vendor/javascript/node_modules/jshint/dist/jshint-rhino.js +60642 -0
  62. data/vendor/javascript/node_modules/jshint/dist/jshint.js +60525 -0
  63. data/vendor/javascript/node_modules/jshint/node_modules/cli/README.md +196 -0
  64. data/vendor/javascript/node_modules/jshint/node_modules/cli/cli.js +1139 -0
  65. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/cat.js +17 -0
  66. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/command.js +16 -0
  67. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/echo.js +54 -0
  68. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/glob.js +6 -0
  69. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/long_desc.js +20 -0
  70. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/progress.js +11 -0
  71. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/sort.js +18 -0
  72. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/spinner.js +9 -0
  73. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.coffee +27 -0
  74. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.js +25 -0
  75. data/vendor/javascript/node_modules/jshint/node_modules/cli/index.js +1 -0
  76. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/LICENSE +27 -0
  77. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/README.md +250 -0
  78. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/g.js +9 -0
  79. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/usr-local.js +9 -0
  80. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/glob.js +728 -0
  81. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  82. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/README.md +42 -0
  83. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  84. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  85. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json +51 -0
  86. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/test.js +25 -0
  87. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/package.json +58 -0
  88. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/00-setup.js +176 -0
  89. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-comparison.js +63 -0
  90. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json +351 -0
  91. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/cwd-test.js +55 -0
  92. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/globstar-match.js +19 -0
  93. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/mark.js +118 -0
  94. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/new-glob-optional-options.js +10 -0
  95. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/nocase-nomagic.js +113 -0
  96. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/pause-resume.js +73 -0
  97. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/readme-issue.js +36 -0
  98. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root-nomount.js +39 -0
  99. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root.js +46 -0
  100. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/stat.js +32 -0
  101. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/zz-cleanup.js +11 -0
  102. data/vendor/javascript/node_modules/jshint/node_modules/cli/package.json +70 -0
  103. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/LICENCE +19 -0
  104. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/README.md +33 -0
  105. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/index.js +86 -0
  106. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/LICENCE +19 -0
  107. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/README.md +45 -0
  108. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/index.js +5 -0
  109. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/package.json +89 -0
  110. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/seed.js +16 -0
  111. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/index.js +28 -0
  112. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/static/index.html +10 -0
  113. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/package.json +88 -0
  114. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/index.js +67 -0
  115. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/index.html +12 -0
  116. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/test-adapter.js +53 -0
  117. data/vendor/javascript/node_modules/jshint/node_modules/exit/Gruntfile.js +48 -0
  118. data/vendor/javascript/node_modules/jshint/node_modules/exit/LICENSE-MIT +22 -0
  119. data/vendor/javascript/node_modules/jshint/node_modules/exit/README.md +75 -0
  120. data/vendor/javascript/node_modules/jshint/node_modules/exit/lib/exit.js +41 -0
  121. data/vendor/javascript/node_modules/jshint/node_modules/exit/package.json +69 -0
  122. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/exit_test.js +121 -0
  123. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stderr.txt +10 -0
  124. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout-stderr.txt +20 -0
  125. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout.txt +10 -0
  126. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stderr.txt +100 -0
  127. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout-stderr.txt +200 -0
  128. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout.txt +100 -0
  129. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stderr.txt +1000 -0
  130. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout-stderr.txt +2000 -0
  131. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout.txt +1000 -0
  132. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/create-files.sh +8 -0
  133. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log-broken.js +23 -0
  134. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log.js +25 -0
  135. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/LICENSE +18 -0
  136. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/README.md +83 -0
  137. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/CollectingHandler.js +55 -0
  138. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/FeedHandler.js +95 -0
  139. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Parser.js +337 -0
  140. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js +27 -0
  141. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Stream.js +35 -0
  142. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Tokenizer.js +891 -0
  143. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/WritableStream.js +21 -0
  144. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/index.js +68 -0
  145. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/LICENSE +11 -0
  146. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/index.js +14 -0
  147. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/package.json +40 -0
  148. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/readme.md +1 -0
  149. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/LICENSE +11 -0
  150. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/index.js +211 -0
  151. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/package.json +68 -0
  152. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/readme.md +102 -0
  153. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/01-basic.json +57 -0
  154. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
  155. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
  156. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
  157. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
  158. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
  159. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
  160. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
  161. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
  162. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
  163. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
  164. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/12-text_only.json +11 -0
  165. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
  166. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
  167. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
  168. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
  169. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
  170. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
  171. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
  172. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
  173. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
  174. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
  175. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/23-dom-lvl1.json +121 -0
  176. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/tests.js +58 -0
  177. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/LICENSE +11 -0
  178. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/index.js +14 -0
  179. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +141 -0
  180. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +87 -0
  181. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +77 -0
  182. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +94 -0
  183. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +93 -0
  184. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +24 -0
  185. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/package.json +71 -0
  186. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/readme.md +1 -0
  187. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/fixture.js +6 -0
  188. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/helpers.js +89 -0
  189. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/legacy.js +119 -0
  190. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/utils.js +9 -0
  191. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/LICENSE +11 -0
  192. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/index.js +31 -0
  193. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode.js +72 -0
  194. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +26 -0
  195. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/encode.js +48 -0
  196. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/decode.json +1 -0
  197. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/entities.json +1 -0
  198. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/legacy.json +1 -0
  199. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/xml.json +1 -0
  200. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/package.json +79 -0
  201. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/readme.md +31 -0
  202. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/mocha.opts +2 -0
  203. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/test.js +150 -0
  204. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/LICENSE +18 -0
  205. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/README.md +15 -0
  206. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/duplex.js +1 -0
  207. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/float.patch +923 -0
  208. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
  209. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
  210. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_readable.js +944 -0
  211. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_transform.js +209 -0
  212. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_writable.js +472 -0
  213. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/README.md +3 -0
  214. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/float.patch +604 -0
  215. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +107 -0
  216. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/package.json +53 -0
  217. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/util.js +106 -0
  218. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/LICENSE +16 -0
  219. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/README.md +42 -0
  220. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits.js +1 -0
  221. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +23 -0
  222. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/package.json +51 -0
  223. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/test.js +25 -0
  224. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/README.md +54 -0
  225. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/build/build.js +209 -0
  226. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
  227. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/index.js +3 -0
  228. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/package.json +54 -0
  229. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +20 -0
  230. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/README.md +7 -0
  231. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/index.js +200 -0
  232. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/package.json +53 -0
  233. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/package.json +68 -0
  234. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/passthrough.js +1 -0
  235. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/readable.js +7 -0
  236. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/transform.js +1 -0
  237. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/writable.js +1 -0
  238. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/package.json +90 -0
  239. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/01-events.js +9 -0
  240. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/02-stream.js +23 -0
  241. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/03-feed.js +19 -0
  242. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Atom_Example.xml +25 -0
  243. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Attributes.html +16 -0
  244. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Basic.html +1 -0
  245. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RDF_Example.xml +63 -0
  246. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RSS_Example.xml +48 -0
  247. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/01-simple.json +44 -0
  248. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/02-template.json +63 -0
  249. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/03-lowercase_tags.json +46 -0
  250. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/04-cdata.json +50 -0
  251. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/05-cdata-special.json +35 -0
  252. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/06-leading-lt.json +16 -0
  253. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/07-self-closing.json +67 -0
  254. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/08-implicit-close-tags.json +59 -0
  255. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/09-attributes.json +68 -0
  256. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/10-crazy-attrib.json +52 -0
  257. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/11-script_in_script.json +54 -0
  258. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/12-long-comment-end.json +20 -0
  259. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/13-long-cdata-end.json +22 -0
  260. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/14-implicit-open-tags.json +27 -0
  261. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/15-lt-whitespace.json +16 -0
  262. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/16-double_attribs.json +45 -0
  263. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/17-numeric_entities.json +16 -0
  264. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/18-legacy_entities.json +16 -0
  265. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/19-named_entities.json +16 -0
  266. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/20-xml_entities.json +16 -0
  267. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/21-entity_in_attribute.json +38 -0
  268. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/22-double_brackets.json +41 -0
  269. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/23-legacy_entity_fail.json +16 -0
  270. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/24-special_special.json +133 -0
  271. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/25-empty_tag_name.json +13 -0
  272. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/26-not-quite-closed.json +35 -0
  273. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/27-entities_in_attributes.json +62 -0
  274. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/28-cdata_in_html.json +9 -0
  275. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/29-comment_edge-cases.json +18 -0
  276. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/30-cdata_edge-cases.json +22 -0
  277. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/01-rss.js +34 -0
  278. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/02-atom.js +18 -0
  279. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/03-rdf.js +20 -0
  280. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/01-basic.json +83 -0
  281. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/02-RSS.json +1093 -0
  282. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/03-Atom.json +644 -0
  283. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/04-RDF.json +1399 -0
  284. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/05-Attributes.json +354 -0
  285. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/api.js +63 -0
  286. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js +83 -0
  287. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/LICENSE +23 -0
  288. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/README.md +218 -0
  289. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/minimatch.js +1061 -0
  290. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
  291. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  292. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  293. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
  294. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json +50 -0
  295. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
  296. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  297. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  298. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  299. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  300. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  301. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json +58 -0
  302. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  303. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  304. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/package.json +57 -0
  305. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/basic.js +399 -0
  306. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/brace-expand.js +33 -0
  307. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/caching.js +14 -0
  308. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/defaults.js +274 -0
  309. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  310. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/LICENSE +26 -0
  311. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/README.md +569 -0
  312. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/bin/shjs +51 -0
  313. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/global.js +3 -0
  314. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/make.js +47 -0
  315. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/package.json +61 -0
  316. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/generate-docs.js +21 -0
  317. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/run-tests.js +50 -0
  318. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/shell.js +157 -0
  319. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cat.js +43 -0
  320. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cd.js +19 -0
  321. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/chmod.js +208 -0
  322. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/common.js +203 -0
  323. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cp.js +201 -0
  324. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/dirs.js +191 -0
  325. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/echo.js +20 -0
  326. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/error.js +10 -0
  327. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/exec.js +181 -0
  328. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/find.js +51 -0
  329. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/grep.js +52 -0
  330. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ln.js +53 -0
  331. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ls.js +126 -0
  332. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mkdir.js +68 -0
  333. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mv.js +80 -0
  334. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/popd.js +1 -0
  335. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pushd.js +1 -0
  336. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pwd.js +11 -0
  337. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/rm.js +145 -0
  338. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/sed.js +43 -0
  339. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/tempdir.js +56 -0
  340. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/test.js +85 -0
  341. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/to.js +29 -0
  342. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/toEnd.js +29 -0
  343. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/which.js +83 -0
  344. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/cli.js +41 -0
  345. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/package.json +76 -0
  346. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/readme.md +74 -0
  347. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/strip-json-comments.js +64 -0
  348. data/vendor/javascript/node_modules/jshint/node_modules/underscore/LICENSE +23 -0
  349. data/vendor/javascript/node_modules/jshint/node_modules/underscore/README.md +22 -0
  350. data/vendor/javascript/node_modules/jshint/node_modules/underscore/package.json +66 -0
  351. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore-min.js +6 -0
  352. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore.js +1343 -0
  353. data/vendor/javascript/node_modules/jshint/package.json +80 -0
  354. data/vendor/javascript/node_modules/jshint/src/cli.js +731 -0
  355. data/vendor/javascript/node_modules/jshint/src/jshint.js +5023 -0
  356. data/vendor/javascript/node_modules/jshint/src/lex.js +1650 -0
  357. data/vendor/javascript/node_modules/jshint/src/messages.js +223 -0
  358. data/vendor/javascript/node_modules/jshint/src/platforms/rhino.js +115 -0
  359. data/vendor/javascript/node_modules/jshint/src/reg.js +38 -0
  360. data/vendor/javascript/node_modules/jshint/src/reporters/checkstyle.js +81 -0
  361. data/vendor/javascript/node_modules/jshint/src/reporters/default.js +34 -0
  362. data/vendor/javascript/node_modules/jshint/src/reporters/jslint_xml.js +57 -0
  363. data/vendor/javascript/node_modules/jshint/src/reporters/non_error.js +52 -0
  364. data/vendor/javascript/node_modules/jshint/src/state.js +28 -0
  365. data/vendor/javascript/node_modules/jshint/src/style.js +143 -0
  366. data/vendor/javascript/node_modules/jshint/src/vars.js +658 -0
  367. data/vendor/python/astroid/COPYING +339 -0
  368. data/vendor/python/astroid/COPYING.LESSER +510 -0
  369. data/vendor/python/astroid/ChangeLog +574 -0
  370. data/vendor/python/astroid/MANIFEST.in +9 -0
  371. data/vendor/python/astroid/README +56 -0
  372. data/vendor/python/astroid/README.Python3 +26 -0
  373. data/vendor/python/astroid/__init__.py +118 -0
  374. data/vendor/python/astroid/__init__.pyc +0 -0
  375. data/vendor/python/astroid/__pkginfo__.py +48 -0
  376. data/vendor/python/astroid/__pkginfo__.pyc +0 -0
  377. data/vendor/python/astroid/announce.txt +23 -0
  378. data/vendor/python/astroid/as_string.py +496 -0
  379. data/vendor/python/astroid/as_string.pyc +0 -0
  380. data/vendor/python/astroid/bases.py +618 -0
  381. data/vendor/python/astroid/bases.pyc +0 -0
  382. data/vendor/python/astroid/brain/py2gi.py +159 -0
  383. data/vendor/python/astroid/brain/py2gi.pyc +0 -0
  384. data/vendor/python/astroid/brain/py2mechanize.py +20 -0
  385. data/vendor/python/astroid/brain/py2mechanize.pyc +0 -0
  386. data/vendor/python/astroid/brain/py2qt4.py +25 -0
  387. data/vendor/python/astroid/brain/py2qt4.pyc +0 -0
  388. data/vendor/python/astroid/brain/py2stdlib.py +252 -0
  389. data/vendor/python/astroid/brain/py2stdlib.pyc +0 -0
  390. data/vendor/python/astroid/builder.py +238 -0
  391. data/vendor/python/astroid/builder.pyc +0 -0
  392. data/vendor/python/astroid/exceptions.py +51 -0
  393. data/vendor/python/astroid/exceptions.pyc +0 -0
  394. data/vendor/python/astroid/inference.py +393 -0
  395. data/vendor/python/astroid/inference.pyc +0 -0
  396. data/vendor/python/astroid/inspector.py +275 -0
  397. data/vendor/python/astroid/manager.py +336 -0
  398. data/vendor/python/astroid/manager.pyc +0 -0
  399. data/vendor/python/astroid/mixins.py +122 -0
  400. data/vendor/python/astroid/mixins.pyc +0 -0
  401. data/vendor/python/astroid/node_classes.py +928 -0
  402. data/vendor/python/astroid/node_classes.pyc +0 -0
  403. data/vendor/python/astroid/nodes.py +73 -0
  404. data/vendor/python/astroid/nodes.pyc +0 -0
  405. data/vendor/python/astroid/protocols.py +322 -0
  406. data/vendor/python/astroid/protocols.pyc +0 -0
  407. data/vendor/python/astroid/raw_building.py +361 -0
  408. data/vendor/python/astroid/raw_building.pyc +0 -0
  409. data/vendor/python/astroid/rebuilder.py +954 -0
  410. data/vendor/python/astroid/rebuilder.pyc +0 -0
  411. data/vendor/python/astroid/scoped_nodes.py +1118 -0
  412. data/vendor/python/astroid/scoped_nodes.pyc +0 -0
  413. data/vendor/python/astroid/setup.py +184 -0
  414. data/vendor/python/astroid/tox.ini +10 -0
  415. data/vendor/python/astroid/utils.py +236 -0
  416. data/vendor/python/astroid/utils.pyc +0 -0
  417. data/vendor/python/logilab/__init__.py +0 -0
  418. data/vendor/python/logilab/__init__.pyc +0 -0
  419. data/vendor/python/logilab/common/COPYING +339 -0
  420. data/vendor/python/logilab/common/COPYING.LESSER +510 -0
  421. data/vendor/python/logilab/common/ChangeLog +1517 -0
  422. data/vendor/python/logilab/common/MANIFEST.in +13 -0
  423. data/vendor/python/logilab/common/README +185 -0
  424. data/vendor/python/logilab/common/README.Python3 +29 -0
  425. data/vendor/python/logilab/common/__init__.py +171 -0
  426. data/vendor/python/logilab/common/__init__.pyc +0 -0
  427. data/vendor/python/logilab/common/__pkginfo__.py +53 -0
  428. data/vendor/python/logilab/common/__pkginfo__.pyc +0 -0
  429. data/vendor/python/logilab/common/announce.txt +25 -0
  430. data/vendor/python/logilab/common/bin/pytest +7 -0
  431. data/vendor/python/logilab/common/bin/pytest.bat +17 -0
  432. data/vendor/python/logilab/common/cache.py +114 -0
  433. data/vendor/python/logilab/common/changelog.py +236 -0
  434. data/vendor/python/logilab/common/changelog.pyc +0 -0
  435. data/vendor/python/logilab/common/clcommands.py +332 -0
  436. data/vendor/python/logilab/common/cli.py +208 -0
  437. data/vendor/python/logilab/common/compat.py +243 -0
  438. data/vendor/python/logilab/common/compat.pyc +0 -0
  439. data/vendor/python/logilab/common/configuration.py +1094 -0
  440. data/vendor/python/logilab/common/configuration.pyc +0 -0
  441. data/vendor/python/logilab/common/contexts.py +5 -0
  442. data/vendor/python/logilab/common/corbautils.py +117 -0
  443. data/vendor/python/logilab/common/daemon.py +100 -0
  444. data/vendor/python/logilab/common/date.py +333 -0
  445. data/vendor/python/logilab/common/dbf.py +229 -0
  446. data/vendor/python/logilab/common/debugger.py +210 -0
  447. data/vendor/python/logilab/common/decorators.py +281 -0
  448. data/vendor/python/logilab/common/decorators.pyc +0 -0
  449. data/vendor/python/logilab/common/deprecation.py +188 -0
  450. data/vendor/python/logilab/common/deprecation.pyc +0 -0
  451. data/vendor/python/logilab/common/fileutils.py +402 -0
  452. data/vendor/python/logilab/common/graph.py +276 -0
  453. data/vendor/python/logilab/common/graph.pyc +0 -0
  454. data/vendor/python/logilab/common/hg.py +130 -0
  455. data/vendor/python/logilab/common/interface.py +71 -0
  456. data/vendor/python/logilab/common/interface.pyc +0 -0
  457. data/vendor/python/logilab/common/logging_ext.py +193 -0
  458. data/vendor/python/logilab/common/modutils.py +695 -0
  459. data/vendor/python/logilab/common/modutils.pyc +0 -0
  460. data/vendor/python/logilab/common/optik_ext.py +391 -0
  461. data/vendor/python/logilab/common/optik_ext.pyc +0 -0
  462. data/vendor/python/logilab/common/optparser.py +90 -0
  463. data/vendor/python/logilab/common/proc.py +277 -0
  464. data/vendor/python/logilab/common/pyro_ext.py +180 -0
  465. data/vendor/python/logilab/common/pytest.py +1177 -0
  466. data/vendor/python/logilab/common/python-logilab-common.spec +184 -0
  467. data/vendor/python/logilab/common/registry.py +1113 -0
  468. data/vendor/python/logilab/common/setup.cfg +3 -0
  469. data/vendor/python/logilab/common/setup.py +189 -0
  470. data/vendor/python/logilab/common/shellutils.py +455 -0
  471. data/vendor/python/logilab/common/sphinx_ext.py +87 -0
  472. data/vendor/python/logilab/common/sphinxutils.py +122 -0
  473. data/vendor/python/logilab/common/table.py +925 -0
  474. data/vendor/python/logilab/common/tasksqueue.py +100 -0
  475. data/vendor/python/logilab/common/textutils.py +534 -0
  476. data/vendor/python/logilab/common/textutils.pyc +0 -0
  477. data/vendor/python/logilab/common/tree.py +369 -0
  478. data/vendor/python/logilab/common/tree.pyc +0 -0
  479. data/vendor/python/logilab/common/umessage.py +190 -0
  480. data/vendor/python/logilab/common/ureports/__init__.py +174 -0
  481. data/vendor/python/logilab/common/ureports/__init__.pyc +0 -0
  482. data/vendor/python/logilab/common/ureports/docbook_writer.py +139 -0
  483. data/vendor/python/logilab/common/ureports/html_writer.py +131 -0
  484. data/vendor/python/logilab/common/ureports/html_writer.pyc +0 -0
  485. data/vendor/python/logilab/common/ureports/nodes.py +201 -0
  486. data/vendor/python/logilab/common/ureports/nodes.pyc +0 -0
  487. data/vendor/python/logilab/common/ureports/text_writer.py +140 -0
  488. data/vendor/python/logilab/common/ureports/text_writer.pyc +0 -0
  489. data/vendor/python/logilab/common/urllib2ext.py +87 -0
  490. data/vendor/python/logilab/common/vcgutils.py +216 -0
  491. data/vendor/python/logilab/common/visitor.py +107 -0
  492. data/vendor/python/logilab/common/visitor.pyc +0 -0
  493. data/vendor/python/logilab/common/xmlrpcutils.py +131 -0
  494. data/vendor/python/logilab/common/xmlutils.py +61 -0
  495. data/vendor/python/pylint/CONTRIBUTORS.txt +38 -0
  496. data/vendor/python/pylint/COPYING +340 -0
  497. data/vendor/python/pylint/ChangeLog +1437 -0
  498. data/vendor/python/pylint/DEPENDS +3 -0
  499. data/vendor/python/pylint/MANIFEST.in +14 -0
  500. data/vendor/python/pylint/README +50 -0
  501. data/vendor/python/pylint/README.Python3 +37 -0
  502. data/vendor/python/pylint/__init__.py +44 -0
  503. data/vendor/python/pylint/__init__.pyc +0 -0
  504. data/vendor/python/pylint/__main__.py +3 -0
  505. data/vendor/python/pylint/__pkginfo__.py +74 -0
  506. data/vendor/python/pylint/__pkginfo__.pyc +0 -0
  507. data/vendor/python/pylint/bin/epylint +3 -0
  508. data/vendor/python/pylint/bin/epylint.bat +5 -0
  509. data/vendor/python/pylint/bin/pylint +3 -0
  510. data/vendor/python/pylint/bin/pylint-gui +3 -0
  511. data/vendor/python/pylint/bin/pylint-gui.bat +5 -0
  512. data/vendor/python/pylint/bin/pylint.bat +5 -0
  513. data/vendor/python/pylint/bin/pyreverse +3 -0
  514. data/vendor/python/pylint/bin/pyreverse.bat +5 -0
  515. data/vendor/python/pylint/bin/symilar +3 -0
  516. data/vendor/python/pylint/bin/symilar.bat +5 -0
  517. data/vendor/python/pylint/checkers/__init__.py +145 -0
  518. data/vendor/python/pylint/checkers/__init__.pyc +0 -0
  519. data/vendor/python/pylint/checkers/base.py +1141 -0
  520. data/vendor/python/pylint/checkers/base.pyc +0 -0
  521. data/vendor/python/pylint/checkers/classes.py +792 -0
  522. data/vendor/python/pylint/checkers/classes.pyc +0 -0
  523. data/vendor/python/pylint/checkers/design_analysis.py +367 -0
  524. data/vendor/python/pylint/checkers/design_analysis.pyc +0 -0
  525. data/vendor/python/pylint/checkers/exceptions.py +306 -0
  526. data/vendor/python/pylint/checkers/exceptions.pyc +0 -0
  527. data/vendor/python/pylint/checkers/format.py +943 -0
  528. data/vendor/python/pylint/checkers/format.pyc +0 -0
  529. data/vendor/python/pylint/checkers/imports.py +394 -0
  530. data/vendor/python/pylint/checkers/imports.pyc +0 -0
  531. data/vendor/python/pylint/checkers/logging.py +213 -0
  532. data/vendor/python/pylint/checkers/logging.pyc +0 -0
  533. data/vendor/python/pylint/checkers/misc.py +90 -0
  534. data/vendor/python/pylint/checkers/misc.pyc +0 -0
  535. data/vendor/python/pylint/checkers/newstyle.py +151 -0
  536. data/vendor/python/pylint/checkers/newstyle.pyc +0 -0
  537. data/vendor/python/pylint/checkers/raw_metrics.py +129 -0
  538. data/vendor/python/pylint/checkers/raw_metrics.pyc +0 -0
  539. data/vendor/python/pylint/checkers/similar.py +365 -0
  540. data/vendor/python/pylint/checkers/similar.pyc +0 -0
  541. data/vendor/python/pylint/checkers/stdlib.py +69 -0
  542. data/vendor/python/pylint/checkers/stdlib.pyc +0 -0
  543. data/vendor/python/pylint/checkers/strings.py +304 -0
  544. data/vendor/python/pylint/checkers/strings.pyc +0 -0
  545. data/vendor/python/pylint/checkers/typecheck.py +451 -0
  546. data/vendor/python/pylint/checkers/typecheck.pyc +0 -0
  547. data/vendor/python/pylint/checkers/utils.py +416 -0
  548. data/vendor/python/pylint/checkers/utils.pyc +0 -0
  549. data/vendor/python/pylint/checkers/variables.py +741 -0
  550. data/vendor/python/pylint/checkers/variables.pyc +0 -0
  551. data/vendor/python/pylint/config.py +156 -0
  552. data/vendor/python/pylint/config.pyc +0 -0
  553. data/vendor/python/pylint/epylint.py +175 -0
  554. data/vendor/python/pylint/gui.py +508 -0
  555. data/vendor/python/pylint/interfaces.py +72 -0
  556. data/vendor/python/pylint/interfaces.pyc +0 -0
  557. data/vendor/python/pylint/lint.py +1106 -0
  558. data/vendor/python/pylint/lint.pyc +0 -0
  559. data/vendor/python/pylint/pyreverse/__init__.py +5 -0
  560. data/vendor/python/pylint/pyreverse/diadefslib.py +233 -0
  561. data/vendor/python/pylint/pyreverse/diagrams.py +247 -0
  562. data/vendor/python/pylint/pyreverse/main.py +124 -0
  563. data/vendor/python/pylint/pyreverse/utils.py +131 -0
  564. data/vendor/python/pylint/pyreverse/writer.py +199 -0
  565. data/vendor/python/pylint/reporters/__init__.py +138 -0
  566. data/vendor/python/pylint/reporters/__init__.pyc +0 -0
  567. data/vendor/python/pylint/reporters/guireporter.py +28 -0
  568. data/vendor/python/pylint/reporters/guireporter.pyc +0 -0
  569. data/vendor/python/pylint/reporters/html.py +70 -0
  570. data/vendor/python/pylint/reporters/html.pyc +0 -0
  571. data/vendor/python/pylint/reporters/text.py +143 -0
  572. data/vendor/python/pylint/reporters/text.pyc +0 -0
  573. data/vendor/python/pylint/setup.cfg +3 -0
  574. data/vendor/python/pylint/setup.py +203 -0
  575. data/vendor/python/pylint/tox.ini +10 -0
  576. data/vendor/python/pylint/utils.py +744 -0
  577. data/vendor/python/pylint/utils.pyc +0 -0
  578. data/vendor/python/pylint_runner.py +22 -0
  579. metadata +675 -0
@@ -0,0 +1,193 @@
1
+ # -*- coding: utf-8 -*-
2
+ # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
3
+ # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
4
+ #
5
+ # This file is part of logilab-common.
6
+ #
7
+ # logilab-common is free software: you can redistribute it and/or modify it under
8
+ # the terms of the GNU Lesser General Public License as published by the Free
9
+ # Software Foundation, either version 2.1 of the License, or (at your option) any
10
+ # later version.
11
+ #
12
+ # logilab-common is distributed in the hope that it will be useful, but WITHOUT
13
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15
+ # details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License along
18
+ # with logilab-common. If not, see <http://www.gnu.org/licenses/>.
19
+ """Extends the logging module from the standard library."""
20
+
21
+ __docformat__ = "restructuredtext en"
22
+
23
+ import os
24
+ import sys
25
+ import logging
26
+
27
+ from logilab.common.textutils import colorize_ansi
28
+
29
+
30
+ def set_log_methods(cls, logger):
31
+ """bind standard logger's methods as methods on the class"""
32
+ cls.__logger = logger
33
+ for attr in ('debug', 'info', 'warning', 'error', 'critical', 'exception'):
34
+ setattr(cls, attr, getattr(logger, attr))
35
+
36
+
37
+ def xxx_cyan(record):
38
+ if 'XXX' in record.message:
39
+ return 'cyan'
40
+
41
+ class ColorFormatter(logging.Formatter):
42
+ """
43
+ A color Formatter for the logging standard module.
44
+
45
+ By default, colorize CRITICAL and ERROR in red, WARNING in orange, INFO in
46
+ green and DEBUG in yellow.
47
+
48
+ self.colors is customizable via the 'color' constructor argument (dictionary).
49
+
50
+ self.colorfilters is a list of functions that get the LogRecord
51
+ and return a color name or None.
52
+ """
53
+
54
+ def __init__(self, fmt=None, datefmt=None, colors=None):
55
+ logging.Formatter.__init__(self, fmt, datefmt)
56
+ self.colorfilters = []
57
+ self.colors = {'CRITICAL': 'red',
58
+ 'ERROR': 'red',
59
+ 'WARNING': 'magenta',
60
+ 'INFO': 'green',
61
+ 'DEBUG': 'yellow',
62
+ }
63
+ if colors is not None:
64
+ assert isinstance(colors, dict)
65
+ self.colors.update(colors)
66
+
67
+ def format(self, record):
68
+ msg = logging.Formatter.format(self, record)
69
+ if record.levelname in self.colors:
70
+ color = self.colors[record.levelname]
71
+ return colorize_ansi(msg, color)
72
+ else:
73
+ for cf in self.colorfilters:
74
+ color = cf(record)
75
+ if color:
76
+ return colorize_ansi(msg, color)
77
+ return msg
78
+
79
+ def set_color_formatter(logger=None, **kw):
80
+ """
81
+ Install a color formatter on the 'logger'. If not given, it will
82
+ defaults to the default logger.
83
+
84
+ Any additional keyword will be passed as-is to the ColorFormatter
85
+ constructor.
86
+ """
87
+ if logger is None:
88
+ logger = logging.getLogger()
89
+ if not logger.handlers:
90
+ logging.basicConfig()
91
+ format_msg = logger.handlers[0].formatter._fmt
92
+ fmt = ColorFormatter(format_msg, **kw)
93
+ fmt.colorfilters.append(xxx_cyan)
94
+ logger.handlers[0].setFormatter(fmt)
95
+
96
+
97
+ LOG_FORMAT = '%(asctime)s - (%(name)s) %(levelname)s: %(message)s'
98
+ LOG_DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
99
+
100
+ def get_handler(debug=False, syslog=False, logfile=None, rotation_parameters=None):
101
+ """get an apropriate handler according to given parameters"""
102
+ if os.environ.get('APYCOT_ROOT'):
103
+ handler = logging.StreamHandler(sys.stdout)
104
+ if debug:
105
+ handler = logging.StreamHandler()
106
+ elif logfile is None:
107
+ if syslog:
108
+ from logging import handlers
109
+ handler = handlers.SysLogHandler()
110
+ else:
111
+ handler = logging.StreamHandler()
112
+ else:
113
+ try:
114
+ if rotation_parameters is None:
115
+ if os.name == 'posix' and sys.version_info >= (2, 6):
116
+ from logging.handlers import WatchedFileHandler
117
+ handler = WatchedFileHandler(logfile)
118
+ else:
119
+ handler = logging.FileHandler(logfile)
120
+ else:
121
+ from logging.handlers import TimedRotatingFileHandler
122
+ handler = TimedRotatingFileHandler(
123
+ logfile, **rotation_parameters)
124
+ except IOError:
125
+ handler = logging.StreamHandler()
126
+ return handler
127
+
128
+ def get_threshold(debug=False, logthreshold=None):
129
+ if logthreshold is None:
130
+ if debug:
131
+ logthreshold = logging.DEBUG
132
+ else:
133
+ logthreshold = logging.ERROR
134
+ elif isinstance(logthreshold, basestring):
135
+ logthreshold = getattr(logging, THRESHOLD_MAP.get(logthreshold,
136
+ logthreshold))
137
+ return logthreshold
138
+
139
+ def _colorable_terminal():
140
+ isatty = hasattr(sys.__stdout__, 'isatty') and sys.__stdout__.isatty()
141
+ if not isatty:
142
+ return False
143
+ if os.name == 'nt':
144
+ try:
145
+ from colorama import init as init_win32_colors
146
+ except ImportError:
147
+ return False
148
+ init_win32_colors()
149
+ return True
150
+
151
+ def get_formatter(logformat=LOG_FORMAT, logdateformat=LOG_DATE_FORMAT):
152
+ if _colorable_terminal():
153
+ fmt = ColorFormatter(logformat, logdateformat)
154
+ def col_fact(record):
155
+ if 'XXX' in record.message:
156
+ return 'cyan'
157
+ if 'kick' in record.message:
158
+ return 'red'
159
+ fmt.colorfilters.append(col_fact)
160
+ else:
161
+ fmt = logging.Formatter(logformat, logdateformat)
162
+ return fmt
163
+
164
+ def init_log(debug=False, syslog=False, logthreshold=None, logfile=None,
165
+ logformat=LOG_FORMAT, logdateformat=LOG_DATE_FORMAT, fmt=None,
166
+ rotation_parameters=None, handler=None):
167
+ """init the log service"""
168
+ logger = logging.getLogger()
169
+ if handler is None:
170
+ handler = get_handler(debug, syslog, logfile, rotation_parameters)
171
+ # only addHandler and removeHandler method while I would like a setHandler
172
+ # method, so do it this way :$
173
+ logger.handlers = [handler]
174
+ logthreshold = get_threshold(debug, logthreshold)
175
+ logger.setLevel(logthreshold)
176
+ if fmt is None:
177
+ if debug:
178
+ fmt = get_formatter(logformat=logformat, logdateformat=logdateformat)
179
+ else:
180
+ fmt = logging.Formatter(logformat, logdateformat)
181
+ handler.setFormatter(fmt)
182
+ return handler
183
+
184
+ # map logilab.common.logger thresholds to logging thresholds
185
+ THRESHOLD_MAP = {'LOG_DEBUG': 'DEBUG',
186
+ 'LOG_INFO': 'INFO',
187
+ 'LOG_NOTICE': 'INFO',
188
+ 'LOG_WARN': 'WARNING',
189
+ 'LOG_WARNING': 'WARNING',
190
+ 'LOG_ERR': 'ERROR',
191
+ 'LOG_ERROR': 'ERROR',
192
+ 'LOG_CRIT': 'CRITICAL',
193
+ }
@@ -0,0 +1,695 @@
1
+ # -*- coding: utf-8 -*-
2
+ # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
3
+ # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
4
+ #
5
+ # This file is part of logilab-common.
6
+ #
7
+ # logilab-common is free software: you can redistribute it and/or modify it under
8
+ # the terms of the GNU Lesser General Public License as published by the Free
9
+ # Software Foundation, either version 2.1 of the License, or (at your option) any
10
+ # later version.
11
+ #
12
+ # logilab-common is distributed in the hope that it will be useful, but WITHOUT
13
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15
+ # details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public License along
18
+ # with logilab-common. If not, see <http://www.gnu.org/licenses/>.
19
+ """Python modules manipulation utility functions.
20
+
21
+ :type PY_SOURCE_EXTS: tuple(str)
22
+ :var PY_SOURCE_EXTS: list of possible python source file extension
23
+
24
+ :type STD_LIB_DIR: str
25
+ :var STD_LIB_DIR: directory where standard modules are located
26
+
27
+ :type BUILTIN_MODULES: dict
28
+ :var BUILTIN_MODULES: dictionary with builtin module names has key
29
+ """
30
+ from __future__ import with_statement
31
+
32
+ __docformat__ = "restructuredtext en"
33
+
34
+ import sys
35
+ import os
36
+ from os.path import splitext, join, abspath, isdir, dirname, exists, basename
37
+ from imp import find_module, load_module, C_BUILTIN, PY_COMPILED, PKG_DIRECTORY
38
+ from distutils.sysconfig import get_config_var, get_python_lib, get_python_version
39
+ from distutils.errors import DistutilsPlatformError
40
+
41
+ try:
42
+ import zipimport
43
+ except ImportError:
44
+ zipimport = None
45
+
46
+ ZIPFILE = object()
47
+
48
+ from logilab.common import STD_BLACKLIST, _handle_blacklist
49
+
50
+ # Notes about STD_LIB_DIR
51
+ # Consider arch-specific installation for STD_LIB_DIR definition
52
+ # :mod:`distutils.sysconfig` contains to much hardcoded values to rely on
53
+ #
54
+ # :see: `Problems with /usr/lib64 builds <http://bugs.python.org/issue1294959>`_
55
+ # :see: `FHS <http://www.pathname.com/fhs/pub/fhs-2.3.html#LIBLTQUALGTALTERNATEFORMATESSENTIAL>`_
56
+ if sys.platform.startswith('win'):
57
+ PY_SOURCE_EXTS = ('py', 'pyw')
58
+ PY_COMPILED_EXTS = ('dll', 'pyd')
59
+ else:
60
+ PY_SOURCE_EXTS = ('py',)
61
+ PY_COMPILED_EXTS = ('so',)
62
+
63
+ try:
64
+ STD_LIB_DIR = get_python_lib(standard_lib=1)
65
+ # get_python_lib(standard_lib=1) is not available on pypy, set STD_LIB_DIR to
66
+ # non-valid path, see https://bugs.pypy.org/issue1164
67
+ except DistutilsPlatformError:
68
+ STD_LIB_DIR = '//'
69
+
70
+ EXT_LIB_DIR = get_python_lib()
71
+
72
+ BUILTIN_MODULES = dict(zip(sys.builtin_module_names,
73
+ [1]*len(sys.builtin_module_names)))
74
+
75
+
76
+ class NoSourceFile(Exception):
77
+ """exception raised when we are not able to get a python
78
+ source file for a precompiled file
79
+ """
80
+
81
+ class LazyObject(object):
82
+ def __init__(self, module, obj):
83
+ self.module = module
84
+ self.obj = obj
85
+ self._imported = None
86
+
87
+ def _getobj(self):
88
+ if self._imported is None:
89
+ self._imported = getattr(load_module_from_name(self.module),
90
+ self.obj)
91
+ return self._imported
92
+
93
+ def __getattribute__(self, attr):
94
+ try:
95
+ return super(LazyObject, self).__getattribute__(attr)
96
+ except AttributeError, ex:
97
+ return getattr(self._getobj(), attr)
98
+
99
+ def __call__(self, *args, **kwargs):
100
+ return self._getobj()(*args, **kwargs)
101
+
102
+
103
+ def load_module_from_name(dotted_name, path=None, use_sys=1):
104
+ """Load a Python module from its name.
105
+
106
+ :type dotted_name: str
107
+ :param dotted_name: python name of a module or package
108
+
109
+ :type path: list or None
110
+ :param path:
111
+ optional list of path where the module or package should be
112
+ searched (use sys.path if nothing or None is given)
113
+
114
+ :type use_sys: bool
115
+ :param use_sys:
116
+ boolean indicating whether the sys.modules dictionary should be
117
+ used or not
118
+
119
+
120
+ :raise ImportError: if the module or package is not found
121
+
122
+ :rtype: module
123
+ :return: the loaded module
124
+ """
125
+ return load_module_from_modpath(dotted_name.split('.'), path, use_sys)
126
+
127
+
128
+ def load_module_from_modpath(parts, path=None, use_sys=1):
129
+ """Load a python module from its splitted name.
130
+
131
+ :type parts: list(str) or tuple(str)
132
+ :param parts:
133
+ python name of a module or package splitted on '.'
134
+
135
+ :type path: list or None
136
+ :param path:
137
+ optional list of path where the module or package should be
138
+ searched (use sys.path if nothing or None is given)
139
+
140
+ :type use_sys: bool
141
+ :param use_sys:
142
+ boolean indicating whether the sys.modules dictionary should be used or not
143
+
144
+ :raise ImportError: if the module or package is not found
145
+
146
+ :rtype: module
147
+ :return: the loaded module
148
+ """
149
+ if use_sys:
150
+ try:
151
+ return sys.modules['.'.join(parts)]
152
+ except KeyError:
153
+ pass
154
+ modpath = []
155
+ prevmodule = None
156
+ for part in parts:
157
+ modpath.append(part)
158
+ curname = '.'.join(modpath)
159
+ module = None
160
+ if len(modpath) != len(parts):
161
+ # even with use_sys=False, should try to get outer packages from sys.modules
162
+ module = sys.modules.get(curname)
163
+ elif use_sys:
164
+ # because it may have been indirectly loaded through a parent
165
+ module = sys.modules.get(curname)
166
+ if module is None:
167
+ mp_file, mp_filename, mp_desc = find_module(part, path)
168
+ module = load_module(curname, mp_file, mp_filename, mp_desc)
169
+ if prevmodule:
170
+ setattr(prevmodule, part, module)
171
+ _file = getattr(module, '__file__', '')
172
+ if not _file and len(modpath) != len(parts):
173
+ raise ImportError('no module in %s' % '.'.join(parts[len(modpath):]) )
174
+ path = [dirname( _file )]
175
+ prevmodule = module
176
+ return module
177
+
178
+
179
+ def load_module_from_file(filepath, path=None, use_sys=1, extrapath=None):
180
+ """Load a Python module from it's path.
181
+
182
+ :type filepath: str
183
+ :param filepath: path to the python module or package
184
+
185
+ :type path: list or None
186
+ :param path:
187
+ optional list of path where the module or package should be
188
+ searched (use sys.path if nothing or None is given)
189
+
190
+ :type use_sys: bool
191
+ :param use_sys:
192
+ boolean indicating whether the sys.modules dictionary should be
193
+ used or not
194
+
195
+
196
+ :raise ImportError: if the module or package is not found
197
+
198
+ :rtype: module
199
+ :return: the loaded module
200
+ """
201
+ modpath = modpath_from_file(filepath, extrapath)
202
+ return load_module_from_modpath(modpath, path, use_sys)
203
+
204
+
205
+ def _check_init(path, mod_path):
206
+ """check there are some __init__.py all along the way"""
207
+ for part in mod_path:
208
+ path = join(path, part)
209
+ if not _has_init(path):
210
+ return False
211
+ return True
212
+
213
+
214
+ def modpath_from_file(filename, extrapath=None):
215
+ """given a file path return the corresponding splitted module's name
216
+ (i.e name of a module or package splitted on '.')
217
+
218
+ :type filename: str
219
+ :param filename: file's path for which we want the module's name
220
+
221
+ :type extrapath: dict
222
+ :param extrapath:
223
+ optional extra search path, with path as key and package name for the path
224
+ as value. This is usually useful to handle package splitted in multiple
225
+ directories using __path__ trick.
226
+
227
+
228
+ :raise ImportError:
229
+ if the corresponding module's name has not been found
230
+
231
+ :rtype: list(str)
232
+ :return: the corresponding splitted module's name
233
+ """
234
+ base = splitext(abspath(filename))[0]
235
+ if extrapath is not None:
236
+ for path_ in extrapath:
237
+ path = abspath(path_)
238
+ if path and base[:len(path)] == path:
239
+ submodpath = [pkg for pkg in base[len(path):].split(os.sep)
240
+ if pkg]
241
+ if _check_init(path, submodpath[:-1]):
242
+ return extrapath[path_].split('.') + submodpath
243
+ for path in sys.path:
244
+ path = abspath(path)
245
+ if path and base.startswith(path):
246
+ modpath = [pkg for pkg in base[len(path):].split(os.sep) if pkg]
247
+ if _check_init(path, modpath[:-1]):
248
+ return modpath
249
+ raise ImportError('Unable to find module for %s in %s' % (
250
+ filename, ', \n'.join(sys.path)))
251
+
252
+
253
+
254
+ def file_from_modpath(modpath, path=None, context_file=None):
255
+ """given a mod path (i.e. splitted module / package name), return the
256
+ corresponding file, giving priority to source file over precompiled
257
+ file if it exists
258
+
259
+ :type modpath: list or tuple
260
+ :param modpath:
261
+ splitted module's name (i.e name of a module or package splitted
262
+ on '.')
263
+ (this means explicit relative imports that start with dots have
264
+ empty strings in this list!)
265
+
266
+ :type path: list or None
267
+ :param path:
268
+ optional list of path where the module or package should be
269
+ searched (use sys.path if nothing or None is given)
270
+
271
+ :type context_file: str or None
272
+ :param context_file:
273
+ context file to consider, necessary if the identifier has been
274
+ introduced using a relative import unresolvable in the actual
275
+ context (i.e. modutils)
276
+
277
+ :raise ImportError: if there is no such module in the directory
278
+
279
+ :rtype: str or None
280
+ :return:
281
+ the path to the module's file or None if it's an integrated
282
+ builtin module such as 'sys'
283
+ """
284
+ if context_file is not None:
285
+ context = dirname(context_file)
286
+ else:
287
+ context = context_file
288
+ if modpath[0] == 'xml':
289
+ # handle _xmlplus
290
+ try:
291
+ return _file_from_modpath(['_xmlplus'] + modpath[1:], path, context)
292
+ except ImportError:
293
+ return _file_from_modpath(modpath, path, context)
294
+ elif modpath == ['os', 'path']:
295
+ # FIXME: currently ignoring search_path...
296
+ return os.path.__file__
297
+ return _file_from_modpath(modpath, path, context)
298
+
299
+
300
+
301
+ def get_module_part(dotted_name, context_file=None):
302
+ """given a dotted name return the module part of the name :
303
+
304
+ >>> get_module_part('logilab.common.modutils.get_module_part')
305
+ 'logilab.common.modutils'
306
+
307
+ :type dotted_name: str
308
+ :param dotted_name: full name of the identifier we are interested in
309
+
310
+ :type context_file: str or None
311
+ :param context_file:
312
+ context file to consider, necessary if the identifier has been
313
+ introduced using a relative import unresolvable in the actual
314
+ context (i.e. modutils)
315
+
316
+
317
+ :raise ImportError: if there is no such module in the directory
318
+
319
+ :rtype: str or None
320
+ :return:
321
+ the module part of the name or None if we have not been able at
322
+ all to import the given name
323
+
324
+ XXX: deprecated, since it doesn't handle package precedence over module
325
+ (see #10066)
326
+ """
327
+ # os.path trick
328
+ if dotted_name.startswith('os.path'):
329
+ return 'os.path'
330
+ parts = dotted_name.split('.')
331
+ if context_file is not None:
332
+ # first check for builtin module which won't be considered latter
333
+ # in that case (path != None)
334
+ if parts[0] in BUILTIN_MODULES:
335
+ if len(parts) > 2:
336
+ raise ImportError(dotted_name)
337
+ return parts[0]
338
+ # don't use += or insert, we want a new list to be created !
339
+ path = None
340
+ starti = 0
341
+ if parts[0] == '':
342
+ assert context_file is not None, \
343
+ 'explicit relative import, but no context_file?'
344
+ path = [] # prevent resolving the import non-relatively
345
+ starti = 1
346
+ while parts[starti] == '': # for all further dots: change context
347
+ starti += 1
348
+ context_file = dirname(context_file)
349
+ for i in range(starti, len(parts)):
350
+ try:
351
+ file_from_modpath(parts[starti:i+1],
352
+ path=path, context_file=context_file)
353
+ except ImportError:
354
+ if not i >= max(1, len(parts) - 2):
355
+ raise
356
+ return '.'.join(parts[:i])
357
+ return dotted_name
358
+
359
+
360
+ def get_modules(package, src_directory, blacklist=STD_BLACKLIST):
361
+ """given a package directory return a list of all available python
362
+ modules in the package and its subpackages
363
+
364
+ :type package: str
365
+ :param package: the python name for the package
366
+
367
+ :type src_directory: str
368
+ :param src_directory:
369
+ path of the directory corresponding to the package
370
+
371
+ :type blacklist: list or tuple
372
+ :param blacklist:
373
+ optional list of files or directory to ignore, default to
374
+ the value of `logilab.common.STD_BLACKLIST`
375
+
376
+ :rtype: list
377
+ :return:
378
+ the list of all available python modules in the package and its
379
+ subpackages
380
+ """
381
+ modules = []
382
+ for directory, dirnames, filenames in os.walk(src_directory):
383
+ _handle_blacklist(blacklist, dirnames, filenames)
384
+ # check for __init__.py
385
+ if not '__init__.py' in filenames:
386
+ dirnames[:] = ()
387
+ continue
388
+ if directory != src_directory:
389
+ dir_package = directory[len(src_directory):].replace(os.sep, '.')
390
+ modules.append(package + dir_package)
391
+ for filename in filenames:
392
+ if _is_python_file(filename) and filename != '__init__.py':
393
+ src = join(directory, filename)
394
+ module = package + src[len(src_directory):-3]
395
+ modules.append(module.replace(os.sep, '.'))
396
+ return modules
397
+
398
+
399
+
400
+ def get_module_files(src_directory, blacklist=STD_BLACKLIST):
401
+ """given a package directory return a list of all available python
402
+ module's files in the package and its subpackages
403
+
404
+ :type src_directory: str
405
+ :param src_directory:
406
+ path of the directory corresponding to the package
407
+
408
+ :type blacklist: list or tuple
409
+ :param blacklist:
410
+ optional list of files or directory to ignore, default to the value of
411
+ `logilab.common.STD_BLACKLIST`
412
+
413
+ :rtype: list
414
+ :return:
415
+ the list of all available python module's files in the package and
416
+ its subpackages
417
+ """
418
+ files = []
419
+ for directory, dirnames, filenames in os.walk(src_directory):
420
+ _handle_blacklist(blacklist, dirnames, filenames)
421
+ # check for __init__.py
422
+ if not '__init__.py' in filenames:
423
+ dirnames[:] = ()
424
+ continue
425
+ for filename in filenames:
426
+ if _is_python_file(filename):
427
+ src = join(directory, filename)
428
+ files.append(src)
429
+ return files
430
+
431
+
432
+ def get_source_file(filename, include_no_ext=False):
433
+ """given a python module's file name return the matching source file
434
+ name (the filename will be returned identically if it's a already an
435
+ absolute path to a python source file...)
436
+
437
+ :type filename: str
438
+ :param filename: python module's file name
439
+
440
+
441
+ :raise NoSourceFile: if no source file exists on the file system
442
+
443
+ :rtype: str
444
+ :return: the absolute path of the source file if it exists
445
+ """
446
+ base, orig_ext = splitext(abspath(filename))
447
+ for ext in PY_SOURCE_EXTS:
448
+ source_path = '%s.%s' % (base, ext)
449
+ if exists(source_path):
450
+ return source_path
451
+ if include_no_ext and not orig_ext and exists(base):
452
+ return base
453
+ raise NoSourceFile(filename)
454
+
455
+
456
+ def cleanup_sys_modules(directories):
457
+ """remove submodules of `directories` from `sys.modules`"""
458
+ for modname, module in sys.modules.items():
459
+ modfile = getattr(module, '__file__', None)
460
+ if modfile:
461
+ for directory in directories:
462
+ if modfile.startswith(directory):
463
+ del sys.modules[modname]
464
+ break
465
+
466
+
467
+ def is_python_source(filename):
468
+ """
469
+ rtype: bool
470
+ return: True if the filename is a python source file
471
+ """
472
+ return splitext(filename)[1][1:] in PY_SOURCE_EXTS
473
+
474
+
475
+
476
+ def is_standard_module(modname, std_path=(STD_LIB_DIR,)):
477
+ """try to guess if a module is a standard python module (by default,
478
+ see `std_path` parameter's description)
479
+
480
+ :type modname: str
481
+ :param modname: name of the module we are interested in
482
+
483
+ :type std_path: list(str) or tuple(str)
484
+ :param std_path: list of path considered has standard
485
+
486
+
487
+ :rtype: bool
488
+ :return:
489
+ true if the module:
490
+ - is located on the path listed in one of the directory in `std_path`
491
+ - is a built-in module
492
+ """
493
+ modname = modname.split('.')[0]
494
+ try:
495
+ filename = file_from_modpath([modname])
496
+ except ImportError, ex:
497
+ # import failed, i'm probably not so wrong by supposing it's
498
+ # not standard...
499
+ return 0
500
+ # modules which are not living in a file are considered standard
501
+ # (sys and __builtin__ for instance)
502
+ if filename is None:
503
+ return 1
504
+ filename = abspath(filename)
505
+ if filename.startswith(EXT_LIB_DIR):
506
+ return 0
507
+ for path in std_path:
508
+ if filename.startswith(abspath(path)):
509
+ return 1
510
+ return False
511
+
512
+
513
+
514
+ def is_relative(modname, from_file):
515
+ """return true if the given module name is relative to the given
516
+ file name
517
+
518
+ :type modname: str
519
+ :param modname: name of the module we are interested in
520
+
521
+ :type from_file: str
522
+ :param from_file:
523
+ path of the module from which modname has been imported
524
+
525
+ :rtype: bool
526
+ :return:
527
+ true if the module has been imported relatively to `from_file`
528
+ """
529
+ if not isdir(from_file):
530
+ from_file = dirname(from_file)
531
+ if from_file in sys.path:
532
+ return False
533
+ try:
534
+ find_module(modname.split('.')[0], [from_file])
535
+ return True
536
+ except ImportError:
537
+ return False
538
+
539
+
540
+ # internal only functions #####################################################
541
+
542
+ def _file_from_modpath(modpath, path=None, context=None):
543
+ """given a mod path (i.e. splitted module / package name), return the
544
+ corresponding file
545
+
546
+ this function is used internally, see `file_from_modpath`'s
547
+ documentation for more information
548
+ """
549
+ assert len(modpath) > 0
550
+ if context is not None:
551
+ try:
552
+ mtype, mp_filename = _module_file(modpath, [context])
553
+ except ImportError:
554
+ mtype, mp_filename = _module_file(modpath, path)
555
+ else:
556
+ mtype, mp_filename = _module_file(modpath, path)
557
+ if mtype == PY_COMPILED:
558
+ try:
559
+ return get_source_file(mp_filename)
560
+ except NoSourceFile:
561
+ return mp_filename
562
+ elif mtype == C_BUILTIN:
563
+ # integrated builtin module
564
+ return None
565
+ elif mtype == PKG_DIRECTORY:
566
+ mp_filename = _has_init(mp_filename)
567
+ return mp_filename
568
+
569
+ def _search_zip(modpath, pic):
570
+ for filepath, importer in pic.items():
571
+ if importer is not None:
572
+ if importer.find_module(modpath[0]):
573
+ if not importer.find_module('/'.join(modpath)):
574
+ raise ImportError('No module named %s in %s/%s' % (
575
+ '.'.join(modpath[1:]), filepath, modpath))
576
+ return ZIPFILE, abspath(filepath) + '/' + '/'.join(modpath), filepath
577
+ raise ImportError('No module named %s' % '.'.join(modpath))
578
+
579
+ try:
580
+ import pkg_resources
581
+ except ImportError:
582
+ pkg_resources = None
583
+
584
+ def _module_file(modpath, path=None):
585
+ """get a module type / file path
586
+
587
+ :type modpath: list or tuple
588
+ :param modpath:
589
+ splitted module's name (i.e name of a module or package splitted
590
+ on '.'), with leading empty strings for explicit relative import
591
+
592
+ :type path: list or None
593
+ :param path:
594
+ optional list of path where the module or package should be
595
+ searched (use sys.path if nothing or None is given)
596
+
597
+
598
+ :rtype: tuple(int, str)
599
+ :return: the module type flag and the file path for a module
600
+ """
601
+ # egg support compat
602
+ try:
603
+ pic = sys.path_importer_cache
604
+ _path = (path is None and sys.path or path)
605
+ for __path in _path:
606
+ if not __path in pic:
607
+ try:
608
+ pic[__path] = zipimport.zipimporter(__path)
609
+ except zipimport.ZipImportError:
610
+ pic[__path] = None
611
+ checkeggs = True
612
+ except AttributeError:
613
+ checkeggs = False
614
+ # pkg_resources support (aka setuptools namespace packages)
615
+ if pkg_resources is not None and modpath[0] in pkg_resources._namespace_packages and len(modpath) > 1:
616
+ # setuptools has added into sys.modules a module object with proper
617
+ # __path__, get back information from there
618
+ module = sys.modules[modpath.pop(0)]
619
+ path = module.__path__
620
+ imported = []
621
+ while modpath:
622
+ modname = modpath[0]
623
+ # take care to changes in find_module implementation wrt builtin modules
624
+ #
625
+ # Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
626
+ # >>> imp.find_module('posix')
627
+ # (None, 'posix', ('', '', 6))
628
+ #
629
+ # Python 3.3.1 (default, Apr 26 2013, 12:08:46)
630
+ # >>> imp.find_module('posix')
631
+ # (None, None, ('', '', 6))
632
+ try:
633
+ _, mp_filename, mp_desc = find_module(modname, path)
634
+ except ImportError:
635
+ if checkeggs:
636
+ return _search_zip(modpath, pic)[:2]
637
+ raise
638
+ else:
639
+ if checkeggs and mp_filename:
640
+ fullabspath = [abspath(x) for x in _path]
641
+ try:
642
+ pathindex = fullabspath.index(dirname(abspath(mp_filename)))
643
+ emtype, emp_filename, zippath = _search_zip(modpath, pic)
644
+ if pathindex > _path.index(zippath):
645
+ # an egg takes priority
646
+ return emtype, emp_filename
647
+ except ValueError:
648
+ # XXX not in _path
649
+ pass
650
+ except ImportError:
651
+ pass
652
+ checkeggs = False
653
+ imported.append(modpath.pop(0))
654
+ mtype = mp_desc[2]
655
+ if modpath:
656
+ if mtype != PKG_DIRECTORY:
657
+ raise ImportError('No module %s in %s' % ('.'.join(modpath),
658
+ '.'.join(imported)))
659
+ # XXX guess if package is using pkgutil.extend_path by looking for
660
+ # those keywords in the first four Kbytes
661
+ try:
662
+ with open(join(mp_filename, '__init__.py')) as stream:
663
+ data = stream.read(4096)
664
+ except IOError:
665
+ path = [mp_filename]
666
+ else:
667
+ if 'pkgutil' in data and 'extend_path' in data:
668
+ # extend_path is called, search sys.path for module/packages
669
+ # of this name see pkgutil.extend_path documentation
670
+ path = [join(p, *imported) for p in sys.path
671
+ if isdir(join(p, *imported))]
672
+ else:
673
+ path = [mp_filename]
674
+ return mtype, mp_filename
675
+
676
+ def _is_python_file(filename):
677
+ """return true if the given filename should be considered as a python file
678
+
679
+ .pyc and .pyo are ignored
680
+ """
681
+ for ext in ('.py', '.so', '.pyd', '.pyw'):
682
+ if filename.endswith(ext):
683
+ return True
684
+ return False
685
+
686
+
687
+ def _has_init(directory):
688
+ """if the given directory has a valid __init__ file, return its path,
689
+ else return None
690
+ """
691
+ mod_or_pack = join(directory, '__init__')
692
+ for ext in PY_SOURCE_EXTS + ('pyc', 'pyo'):
693
+ if exists(mod_or_pack + '.' + ext):
694
+ return mod_or_pack + '.' + ext
695
+ return None