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.
- checksums.yaml +7 -0
- data/exercism-analysis.gemspec +30 -0
- data/lib/exercism-analysis.rb +38 -0
- data/lib/exercism-analysis/adapters/adapter.rb +23 -0
- data/lib/exercism-analysis/adapters/clojure.rb +13 -0
- data/lib/exercism-analysis/adapters/go.rb +19 -0
- data/lib/exercism-analysis/adapters/javascript.rb +13 -0
- data/lib/exercism-analysis/adapters/python.rb +13 -0
- data/lib/exercism-analysis/adapters/ruby.rb +19 -0
- data/lib/exercism-analysis/analysis.rb +18 -0
- data/lib/exercism-analysis/analyzers/analyzer.rb +54 -0
- data/lib/exercism-analysis/analyzers/clojure/kibit.rb +25 -0
- data/lib/exercism-analysis/analyzers/go/golint.rb +23 -0
- data/lib/exercism-analysis/analyzers/javascript/jslint.rb +24 -0
- data/lib/exercism-analysis/analyzers/python/pylint.rb +24 -0
- data/lib/exercism-analysis/analyzers/ruby/control_flow.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/enumerable_condition.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/for_loop.rb +29 -0
- data/lib/exercism-analysis/analyzers/ruby/indentation.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/iter_mutation.rb +37 -0
- data/lib/exercism-analysis/analyzers/ruby/output.rb +20 -0
- data/lib/exercism-analysis/analyzers/ruby/range.rb +28 -0
- data/lib/exercism-analysis/analyzers/ruby/roodi.rb +19 -0
- data/lib/exercism-analysis/analyzers/ruby/send.rb +25 -0
- data/lib/exercism-analysis/analyzers/ruby/shebang.rb +23 -0
- data/lib/exercism-analysis/analyzers/ruby/tab.rb +38 -0
- data/lib/exercism-analysis/processors/call_processor.rb +39 -0
- data/lib/exercism-analysis/processors/control_flow_processor.rb +27 -0
- data/lib/exercism-analysis/processors/enumerable_condition_processor.rb +31 -0
- data/lib/exercism-analysis/processors/for_loop_processor.rb +21 -0
- data/lib/exercism-analysis/processors/indentation_processor.rb +69 -0
- data/lib/exercism-analysis/processors/iter_mutation_processor.rb +50 -0
- data/lib/exercism-analysis/processors/processor.rb +34 -0
- data/lib/exercism-analysis/processors/range_processor.rb +23 -0
- data/lib/exercism-analysis/processors/send_processor.rb +23 -0
- data/lib/exercism-analysis/templates/each_to_map.rb +29 -0
- data/lib/exercism-analysis/templates/each_to_select.rb +31 -0
- data/lib/exercism-analysis/templates/range_exclusive.rb +19 -0
- data/lib/exercism-analysis/templates/template.rb +29 -0
- data/vendor/clojure/kibit-runner/LICENSE +214 -0
- data/vendor/clojure/kibit-runner/project.clj +10 -0
- data/vendor/clojure/kibit-runner/src/kibit_runner/core.clj +17 -0
- data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT-standalone.jar +0 -0
- data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT.jar +0 -0
- data/vendor/clojure/kibit-runner/target/stale/extract-native.dependencies +1 -0
- data/vendor/go/src/github.com/golang/lint/LICENSE +27 -0
- data/vendor/go/src/github.com/golang/lint/README +59 -0
- data/vendor/go/src/github.com/golang/lint/golint/golint.go +67 -0
- data/vendor/go/src/github.com/golang/lint/lint.go +1061 -0
- data/vendor/go/src/runner/golint_runner.go +23 -0
- data/vendor/javascript/jshint_runner.js +6 -0
- data/vendor/javascript/node_modules/jshint/README.md +47 -0
- data/vendor/javascript/node_modules/jshint/bin/apply +6 -0
- data/vendor/javascript/node_modules/jshint/bin/build +36 -0
- data/vendor/javascript/node_modules/jshint/bin/changelog +36 -0
- data/vendor/javascript/node_modules/jshint/bin/jshint +3 -0
- data/vendor/javascript/node_modules/jshint/bin/land +34 -0
- data/vendor/javascript/node_modules/jshint/data/ascii-identifier-data.js +22 -0
- data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-part-only.js +1570 -0
- data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-start.js +48477 -0
- data/vendor/javascript/node_modules/jshint/dist/jshint-rhino.js +60642 -0
- data/vendor/javascript/node_modules/jshint/dist/jshint.js +60525 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/README.md +196 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/cli.js +1139 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/cat.js +17 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/command.js +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/echo.js +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/glob.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/long_desc.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/progress.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/sort.js +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/spinner.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.coffee +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/index.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/LICENSE +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/README.md +250 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/g.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/usr-local.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/glob.js +728 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/package.json +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/00-setup.js +176 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-comparison.js +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json +351 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/cwd-test.js +55 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/globstar-match.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/mark.js +118 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/new-glob-optional-options.js +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/nocase-nomagic.js +113 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/pause-resume.js +73 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/readme-issue.js +36 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root-nomount.js +39 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root.js +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/stat.js +32 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/zz-cleanup.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/package.json +70 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/LICENCE +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/README.md +33 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/index.js +86 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/LICENCE +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/README.md +45 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/index.js +5 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/package.json +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/seed.js +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/index.js +28 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/static/index.html +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/package.json +88 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/index.js +67 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/index.html +12 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/Gruntfile.js +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/LICENSE-MIT +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/README.md +75 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/lib/exit.js +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/package.json +69 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/exit_test.js +121 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stderr.txt +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout-stderr.txt +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout.txt +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stderr.txt +100 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout-stderr.txt +200 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout.txt +100 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stderr.txt +1000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout-stderr.txt +2000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout.txt +1000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/create-files.sh +8 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log-broken.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/LICENSE +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/README.md +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/CollectingHandler.js +55 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/FeedHandler.js +95 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Parser.js +337 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Stream.js +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Tokenizer.js +891 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/WritableStream.js +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/index.js +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/index.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/package.json +40 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/readme.md +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/index.js +211 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/package.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/readme.md +102 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/01-basic.json +57 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/12-text_only.json +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/23-dom-lvl1.json +121 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/tests.js +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/index.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +141 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +87 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +77 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +94 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +93 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +24 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/package.json +71 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/readme.md +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/fixture.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/helpers.js +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/legacy.js +119 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/utils.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/index.js +31 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode.js +72 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +26 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/encode.js +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/decode.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/entities.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/legacy.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/xml.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/package.json +79 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/readme.md +31 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/mocha.opts +2 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/test.js +150 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/LICENSE +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/README.md +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/duplex.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/float.patch +923 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_readable.js +944 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_transform.js +209 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_writable.js +472 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/README.md +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/float.patch +604 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +107 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/package.json +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/util.js +106 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/LICENSE +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/README.md +42 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/package.json +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/test.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/README.md +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/build/build.js +209 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/index.js +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/package.json +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/README.md +7 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/index.js +200 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/package.json +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/package.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/passthrough.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/readable.js +7 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/transform.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/writable.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/package.json +90 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/01-events.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/02-stream.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/03-feed.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Atom_Example.xml +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Attributes.html +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Basic.html +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RDF_Example.xml +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RSS_Example.xml +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/01-simple.json +44 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/02-template.json +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/03-lowercase_tags.json +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/04-cdata.json +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/05-cdata-special.json +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/06-leading-lt.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/07-self-closing.json +67 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/08-implicit-close-tags.json +59 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/09-attributes.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/10-crazy-attrib.json +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/11-script_in_script.json +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/12-long-comment-end.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/13-long-cdata-end.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/14-implicit-open-tags.json +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/15-lt-whitespace.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/16-double_attribs.json +45 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/17-numeric_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/18-legacy_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/19-named_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/20-xml_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/21-entity_in_attribute.json +38 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/22-double_brackets.json +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/23-legacy_entity_fail.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/24-special_special.json +133 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/25-empty_tag_name.json +13 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/26-not-quite-closed.json +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/27-entities_in_attributes.json +62 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/28-cdata_in_html.json +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/29-comment_edge-cases.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/30-cdata_edge-cases.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/01-rss.js +34 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/02-atom.js +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/03-rdf.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/01-basic.json +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/02-RSS.json +1093 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/03-Atom.json +644 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/04-RDF.json +1399 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/05-Attributes.json +354 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/api.js +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/README.md +218 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/minimatch.js +1061 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/package.json +57 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/brace-expand.js +33 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/caching.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/LICENSE +26 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/README.md +569 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/bin/shjs +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/global.js +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/make.js +47 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/package.json +61 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/generate-docs.js +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/run-tests.js +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/shell.js +157 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cat.js +43 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cd.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/chmod.js +208 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/common.js +203 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cp.js +201 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/dirs.js +191 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/echo.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/error.js +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/exec.js +181 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/find.js +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/grep.js +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ln.js +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ls.js +126 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mkdir.js +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mv.js +80 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/popd.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pushd.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pwd.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/rm.js +145 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/sed.js +43 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/tempdir.js +56 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/test.js +85 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/to.js +29 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/toEnd.js +29 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/which.js +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/cli.js +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/package.json +76 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/readme.md +74 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/strip-json-comments.js +64 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/README.md +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/package.json +66 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore-min.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore.js +1343 -0
- data/vendor/javascript/node_modules/jshint/package.json +80 -0
- data/vendor/javascript/node_modules/jshint/src/cli.js +731 -0
- data/vendor/javascript/node_modules/jshint/src/jshint.js +5023 -0
- data/vendor/javascript/node_modules/jshint/src/lex.js +1650 -0
- data/vendor/javascript/node_modules/jshint/src/messages.js +223 -0
- data/vendor/javascript/node_modules/jshint/src/platforms/rhino.js +115 -0
- data/vendor/javascript/node_modules/jshint/src/reg.js +38 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/checkstyle.js +81 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/default.js +34 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/jslint_xml.js +57 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/non_error.js +52 -0
- data/vendor/javascript/node_modules/jshint/src/state.js +28 -0
- data/vendor/javascript/node_modules/jshint/src/style.js +143 -0
- data/vendor/javascript/node_modules/jshint/src/vars.js +658 -0
- data/vendor/python/astroid/COPYING +339 -0
- data/vendor/python/astroid/COPYING.LESSER +510 -0
- data/vendor/python/astroid/ChangeLog +574 -0
- data/vendor/python/astroid/MANIFEST.in +9 -0
- data/vendor/python/astroid/README +56 -0
- data/vendor/python/astroid/README.Python3 +26 -0
- data/vendor/python/astroid/__init__.py +118 -0
- data/vendor/python/astroid/__init__.pyc +0 -0
- data/vendor/python/astroid/__pkginfo__.py +48 -0
- data/vendor/python/astroid/__pkginfo__.pyc +0 -0
- data/vendor/python/astroid/announce.txt +23 -0
- data/vendor/python/astroid/as_string.py +496 -0
- data/vendor/python/astroid/as_string.pyc +0 -0
- data/vendor/python/astroid/bases.py +618 -0
- data/vendor/python/astroid/bases.pyc +0 -0
- data/vendor/python/astroid/brain/py2gi.py +159 -0
- data/vendor/python/astroid/brain/py2gi.pyc +0 -0
- data/vendor/python/astroid/brain/py2mechanize.py +20 -0
- data/vendor/python/astroid/brain/py2mechanize.pyc +0 -0
- data/vendor/python/astroid/brain/py2qt4.py +25 -0
- data/vendor/python/astroid/brain/py2qt4.pyc +0 -0
- data/vendor/python/astroid/brain/py2stdlib.py +252 -0
- data/vendor/python/astroid/brain/py2stdlib.pyc +0 -0
- data/vendor/python/astroid/builder.py +238 -0
- data/vendor/python/astroid/builder.pyc +0 -0
- data/vendor/python/astroid/exceptions.py +51 -0
- data/vendor/python/astroid/exceptions.pyc +0 -0
- data/vendor/python/astroid/inference.py +393 -0
- data/vendor/python/astroid/inference.pyc +0 -0
- data/vendor/python/astroid/inspector.py +275 -0
- data/vendor/python/astroid/manager.py +336 -0
- data/vendor/python/astroid/manager.pyc +0 -0
- data/vendor/python/astroid/mixins.py +122 -0
- data/vendor/python/astroid/mixins.pyc +0 -0
- data/vendor/python/astroid/node_classes.py +928 -0
- data/vendor/python/astroid/node_classes.pyc +0 -0
- data/vendor/python/astroid/nodes.py +73 -0
- data/vendor/python/astroid/nodes.pyc +0 -0
- data/vendor/python/astroid/protocols.py +322 -0
- data/vendor/python/astroid/protocols.pyc +0 -0
- data/vendor/python/astroid/raw_building.py +361 -0
- data/vendor/python/astroid/raw_building.pyc +0 -0
- data/vendor/python/astroid/rebuilder.py +954 -0
- data/vendor/python/astroid/rebuilder.pyc +0 -0
- data/vendor/python/astroid/scoped_nodes.py +1118 -0
- data/vendor/python/astroid/scoped_nodes.pyc +0 -0
- data/vendor/python/astroid/setup.py +184 -0
- data/vendor/python/astroid/tox.ini +10 -0
- data/vendor/python/astroid/utils.py +236 -0
- data/vendor/python/astroid/utils.pyc +0 -0
- data/vendor/python/logilab/__init__.py +0 -0
- data/vendor/python/logilab/__init__.pyc +0 -0
- data/vendor/python/logilab/common/COPYING +339 -0
- data/vendor/python/logilab/common/COPYING.LESSER +510 -0
- data/vendor/python/logilab/common/ChangeLog +1517 -0
- data/vendor/python/logilab/common/MANIFEST.in +13 -0
- data/vendor/python/logilab/common/README +185 -0
- data/vendor/python/logilab/common/README.Python3 +29 -0
- data/vendor/python/logilab/common/__init__.py +171 -0
- data/vendor/python/logilab/common/__init__.pyc +0 -0
- data/vendor/python/logilab/common/__pkginfo__.py +53 -0
- data/vendor/python/logilab/common/__pkginfo__.pyc +0 -0
- data/vendor/python/logilab/common/announce.txt +25 -0
- data/vendor/python/logilab/common/bin/pytest +7 -0
- data/vendor/python/logilab/common/bin/pytest.bat +17 -0
- data/vendor/python/logilab/common/cache.py +114 -0
- data/vendor/python/logilab/common/changelog.py +236 -0
- data/vendor/python/logilab/common/changelog.pyc +0 -0
- data/vendor/python/logilab/common/clcommands.py +332 -0
- data/vendor/python/logilab/common/cli.py +208 -0
- data/vendor/python/logilab/common/compat.py +243 -0
- data/vendor/python/logilab/common/compat.pyc +0 -0
- data/vendor/python/logilab/common/configuration.py +1094 -0
- data/vendor/python/logilab/common/configuration.pyc +0 -0
- data/vendor/python/logilab/common/contexts.py +5 -0
- data/vendor/python/logilab/common/corbautils.py +117 -0
- data/vendor/python/logilab/common/daemon.py +100 -0
- data/vendor/python/logilab/common/date.py +333 -0
- data/vendor/python/logilab/common/dbf.py +229 -0
- data/vendor/python/logilab/common/debugger.py +210 -0
- data/vendor/python/logilab/common/decorators.py +281 -0
- data/vendor/python/logilab/common/decorators.pyc +0 -0
- data/vendor/python/logilab/common/deprecation.py +188 -0
- data/vendor/python/logilab/common/deprecation.pyc +0 -0
- data/vendor/python/logilab/common/fileutils.py +402 -0
- data/vendor/python/logilab/common/graph.py +276 -0
- data/vendor/python/logilab/common/graph.pyc +0 -0
- data/vendor/python/logilab/common/hg.py +130 -0
- data/vendor/python/logilab/common/interface.py +71 -0
- data/vendor/python/logilab/common/interface.pyc +0 -0
- data/vendor/python/logilab/common/logging_ext.py +193 -0
- data/vendor/python/logilab/common/modutils.py +695 -0
- data/vendor/python/logilab/common/modutils.pyc +0 -0
- data/vendor/python/logilab/common/optik_ext.py +391 -0
- data/vendor/python/logilab/common/optik_ext.pyc +0 -0
- data/vendor/python/logilab/common/optparser.py +90 -0
- data/vendor/python/logilab/common/proc.py +277 -0
- data/vendor/python/logilab/common/pyro_ext.py +180 -0
- data/vendor/python/logilab/common/pytest.py +1177 -0
- data/vendor/python/logilab/common/python-logilab-common.spec +184 -0
- data/vendor/python/logilab/common/registry.py +1113 -0
- data/vendor/python/logilab/common/setup.cfg +3 -0
- data/vendor/python/logilab/common/setup.py +189 -0
- data/vendor/python/logilab/common/shellutils.py +455 -0
- data/vendor/python/logilab/common/sphinx_ext.py +87 -0
- data/vendor/python/logilab/common/sphinxutils.py +122 -0
- data/vendor/python/logilab/common/table.py +925 -0
- data/vendor/python/logilab/common/tasksqueue.py +100 -0
- data/vendor/python/logilab/common/textutils.py +534 -0
- data/vendor/python/logilab/common/textutils.pyc +0 -0
- data/vendor/python/logilab/common/tree.py +369 -0
- data/vendor/python/logilab/common/tree.pyc +0 -0
- data/vendor/python/logilab/common/umessage.py +190 -0
- data/vendor/python/logilab/common/ureports/__init__.py +174 -0
- data/vendor/python/logilab/common/ureports/__init__.pyc +0 -0
- data/vendor/python/logilab/common/ureports/docbook_writer.py +139 -0
- data/vendor/python/logilab/common/ureports/html_writer.py +131 -0
- data/vendor/python/logilab/common/ureports/html_writer.pyc +0 -0
- data/vendor/python/logilab/common/ureports/nodes.py +201 -0
- data/vendor/python/logilab/common/ureports/nodes.pyc +0 -0
- data/vendor/python/logilab/common/ureports/text_writer.py +140 -0
- data/vendor/python/logilab/common/ureports/text_writer.pyc +0 -0
- data/vendor/python/logilab/common/urllib2ext.py +87 -0
- data/vendor/python/logilab/common/vcgutils.py +216 -0
- data/vendor/python/logilab/common/visitor.py +107 -0
- data/vendor/python/logilab/common/visitor.pyc +0 -0
- data/vendor/python/logilab/common/xmlrpcutils.py +131 -0
- data/vendor/python/logilab/common/xmlutils.py +61 -0
- data/vendor/python/pylint/CONTRIBUTORS.txt +38 -0
- data/vendor/python/pylint/COPYING +340 -0
- data/vendor/python/pylint/ChangeLog +1437 -0
- data/vendor/python/pylint/DEPENDS +3 -0
- data/vendor/python/pylint/MANIFEST.in +14 -0
- data/vendor/python/pylint/README +50 -0
- data/vendor/python/pylint/README.Python3 +37 -0
- data/vendor/python/pylint/__init__.py +44 -0
- data/vendor/python/pylint/__init__.pyc +0 -0
- data/vendor/python/pylint/__main__.py +3 -0
- data/vendor/python/pylint/__pkginfo__.py +74 -0
- data/vendor/python/pylint/__pkginfo__.pyc +0 -0
- data/vendor/python/pylint/bin/epylint +3 -0
- data/vendor/python/pylint/bin/epylint.bat +5 -0
- data/vendor/python/pylint/bin/pylint +3 -0
- data/vendor/python/pylint/bin/pylint-gui +3 -0
- data/vendor/python/pylint/bin/pylint-gui.bat +5 -0
- data/vendor/python/pylint/bin/pylint.bat +5 -0
- data/vendor/python/pylint/bin/pyreverse +3 -0
- data/vendor/python/pylint/bin/pyreverse.bat +5 -0
- data/vendor/python/pylint/bin/symilar +3 -0
- data/vendor/python/pylint/bin/symilar.bat +5 -0
- data/vendor/python/pylint/checkers/__init__.py +145 -0
- data/vendor/python/pylint/checkers/__init__.pyc +0 -0
- data/vendor/python/pylint/checkers/base.py +1141 -0
- data/vendor/python/pylint/checkers/base.pyc +0 -0
- data/vendor/python/pylint/checkers/classes.py +792 -0
- data/vendor/python/pylint/checkers/classes.pyc +0 -0
- data/vendor/python/pylint/checkers/design_analysis.py +367 -0
- data/vendor/python/pylint/checkers/design_analysis.pyc +0 -0
- data/vendor/python/pylint/checkers/exceptions.py +306 -0
- data/vendor/python/pylint/checkers/exceptions.pyc +0 -0
- data/vendor/python/pylint/checkers/format.py +943 -0
- data/vendor/python/pylint/checkers/format.pyc +0 -0
- data/vendor/python/pylint/checkers/imports.py +394 -0
- data/vendor/python/pylint/checkers/imports.pyc +0 -0
- data/vendor/python/pylint/checkers/logging.py +213 -0
- data/vendor/python/pylint/checkers/logging.pyc +0 -0
- data/vendor/python/pylint/checkers/misc.py +90 -0
- data/vendor/python/pylint/checkers/misc.pyc +0 -0
- data/vendor/python/pylint/checkers/newstyle.py +151 -0
- data/vendor/python/pylint/checkers/newstyle.pyc +0 -0
- data/vendor/python/pylint/checkers/raw_metrics.py +129 -0
- data/vendor/python/pylint/checkers/raw_metrics.pyc +0 -0
- data/vendor/python/pylint/checkers/similar.py +365 -0
- data/vendor/python/pylint/checkers/similar.pyc +0 -0
- data/vendor/python/pylint/checkers/stdlib.py +69 -0
- data/vendor/python/pylint/checkers/stdlib.pyc +0 -0
- data/vendor/python/pylint/checkers/strings.py +304 -0
- data/vendor/python/pylint/checkers/strings.pyc +0 -0
- data/vendor/python/pylint/checkers/typecheck.py +451 -0
- data/vendor/python/pylint/checkers/typecheck.pyc +0 -0
- data/vendor/python/pylint/checkers/utils.py +416 -0
- data/vendor/python/pylint/checkers/utils.pyc +0 -0
- data/vendor/python/pylint/checkers/variables.py +741 -0
- data/vendor/python/pylint/checkers/variables.pyc +0 -0
- data/vendor/python/pylint/config.py +156 -0
- data/vendor/python/pylint/config.pyc +0 -0
- data/vendor/python/pylint/epylint.py +175 -0
- data/vendor/python/pylint/gui.py +508 -0
- data/vendor/python/pylint/interfaces.py +72 -0
- data/vendor/python/pylint/interfaces.pyc +0 -0
- data/vendor/python/pylint/lint.py +1106 -0
- data/vendor/python/pylint/lint.pyc +0 -0
- data/vendor/python/pylint/pyreverse/__init__.py +5 -0
- data/vendor/python/pylint/pyreverse/diadefslib.py +233 -0
- data/vendor/python/pylint/pyreverse/diagrams.py +247 -0
- data/vendor/python/pylint/pyreverse/main.py +124 -0
- data/vendor/python/pylint/pyreverse/utils.py +131 -0
- data/vendor/python/pylint/pyreverse/writer.py +199 -0
- data/vendor/python/pylint/reporters/__init__.py +138 -0
- data/vendor/python/pylint/reporters/__init__.pyc +0 -0
- data/vendor/python/pylint/reporters/guireporter.py +28 -0
- data/vendor/python/pylint/reporters/guireporter.pyc +0 -0
- data/vendor/python/pylint/reporters/html.py +70 -0
- data/vendor/python/pylint/reporters/html.pyc +0 -0
- data/vendor/python/pylint/reporters/text.py +143 -0
- data/vendor/python/pylint/reporters/text.pyc +0 -0
- data/vendor/python/pylint/setup.cfg +3 -0
- data/vendor/python/pylint/setup.py +203 -0
- data/vendor/python/pylint/tox.ini +10 -0
- data/vendor/python/pylint/utils.py +744 -0
- data/vendor/python/pylint/utils.pyc +0 -0
- data/vendor/python/pylint_runner.py +22 -0
- metadata +675 -0
|
Binary file
|
|
@@ -0,0 +1,1118 @@
|
|
|
1
|
+
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
|
2
|
+
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
|
3
|
+
#
|
|
4
|
+
# This file is part of astroid.
|
|
5
|
+
#
|
|
6
|
+
# astroid is free software: you can redistribute it and/or modify it
|
|
7
|
+
# under the terms of the GNU Lesser General Public License as published by the
|
|
8
|
+
# Free Software Foundation, either version 2.1 of the License, or (at your
|
|
9
|
+
# option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# astroid is distributed in the hope that it will be useful, but
|
|
12
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
+
# for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
|
17
|
+
# with astroid. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
"""This module contains the classes for "scoped" node, i.e. which are opening a
|
|
19
|
+
new local scope in the language definition : Module, Class, Function (and
|
|
20
|
+
Lambda, GenExpr, DictComp and SetComp to some extent).
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import with_statement
|
|
23
|
+
|
|
24
|
+
__doctype__ = "restructuredtext en"
|
|
25
|
+
|
|
26
|
+
import sys
|
|
27
|
+
from itertools import chain
|
|
28
|
+
try:
|
|
29
|
+
from io import BytesIO
|
|
30
|
+
except ImportError:
|
|
31
|
+
from cStringIO import StringIO as BytesIO
|
|
32
|
+
|
|
33
|
+
from logilab.common.compat import builtins
|
|
34
|
+
from logilab.common.decorators import cached, cachedproperty
|
|
35
|
+
|
|
36
|
+
from astroid.exceptions import NotFoundError, \
|
|
37
|
+
AstroidBuildingException, InferenceError
|
|
38
|
+
from astroid.node_classes import Const, DelName, DelAttr, \
|
|
39
|
+
Dict, From, List, Pass, Raise, Return, Tuple, Yield, YieldFrom, \
|
|
40
|
+
LookupMixIn, const_factory as cf, unpack_infer, Name
|
|
41
|
+
from astroid.bases import NodeNG, InferenceContext, Instance,\
|
|
42
|
+
YES, Generator, UnboundMethod, BoundMethod, _infer_stmts, copy_context, \
|
|
43
|
+
BUILTINS
|
|
44
|
+
from astroid.mixins import FilterStmtsMixin
|
|
45
|
+
from astroid.bases import Statement
|
|
46
|
+
from astroid.manager import AstroidManager
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def remove_nodes(func, cls):
|
|
50
|
+
def wrapper(*args, **kwargs):
|
|
51
|
+
nodes = [n for n in func(*args, **kwargs) if not isinstance(n, cls)]
|
|
52
|
+
if not nodes:
|
|
53
|
+
raise NotFoundError()
|
|
54
|
+
return nodes
|
|
55
|
+
return wrapper
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def function_to_method(n, klass):
|
|
59
|
+
if isinstance(n, Function):
|
|
60
|
+
if n.type == 'classmethod':
|
|
61
|
+
return BoundMethod(n, klass)
|
|
62
|
+
if n.type != 'staticmethod':
|
|
63
|
+
return UnboundMethod(n)
|
|
64
|
+
return n
|
|
65
|
+
|
|
66
|
+
def std_special_attributes(self, name, add_locals=True):
|
|
67
|
+
if add_locals:
|
|
68
|
+
locals = self.locals
|
|
69
|
+
else:
|
|
70
|
+
locals = {}
|
|
71
|
+
if name == '__name__':
|
|
72
|
+
return [cf(self.name)] + locals.get(name, [])
|
|
73
|
+
if name == '__doc__':
|
|
74
|
+
return [cf(self.doc)] + locals.get(name, [])
|
|
75
|
+
if name == '__dict__':
|
|
76
|
+
return [Dict()] + locals.get(name, [])
|
|
77
|
+
raise NotFoundError(name)
|
|
78
|
+
|
|
79
|
+
MANAGER = AstroidManager()
|
|
80
|
+
def builtin_lookup(name):
|
|
81
|
+
"""lookup a name into the builtin module
|
|
82
|
+
return the list of matching statements and the astroid for the builtin
|
|
83
|
+
module
|
|
84
|
+
"""
|
|
85
|
+
builtin_astroid = MANAGER.ast_from_module(builtins)
|
|
86
|
+
if name == '__dict__':
|
|
87
|
+
return builtin_astroid, ()
|
|
88
|
+
try:
|
|
89
|
+
stmts = builtin_astroid.locals[name]
|
|
90
|
+
except KeyError:
|
|
91
|
+
stmts = ()
|
|
92
|
+
return builtin_astroid, stmts
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# TODO move this Mixin to mixins.py; problem: 'Function' in _scope_lookup
|
|
96
|
+
class LocalsDictNodeNG(LookupMixIn, NodeNG):
|
|
97
|
+
""" this class provides locals handling common to Module, Function
|
|
98
|
+
and Class nodes, including a dict like interface for direct access
|
|
99
|
+
to locals information
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
# attributes below are set by the builder module or by raw factories
|
|
103
|
+
|
|
104
|
+
# dictionary of locals with name as key and node defining the local as
|
|
105
|
+
# value
|
|
106
|
+
|
|
107
|
+
def qname(self):
|
|
108
|
+
"""return the 'qualified' name of the node, eg module.name,
|
|
109
|
+
module.class.name ...
|
|
110
|
+
"""
|
|
111
|
+
if self.parent is None:
|
|
112
|
+
return self.name
|
|
113
|
+
return '%s.%s' % (self.parent.frame().qname(), self.name)
|
|
114
|
+
|
|
115
|
+
def frame(self):
|
|
116
|
+
"""return the first parent frame node (i.e. Module, Function or Class)
|
|
117
|
+
"""
|
|
118
|
+
return self
|
|
119
|
+
|
|
120
|
+
def scope(self):
|
|
121
|
+
"""return the first node defining a new scope (i.e. Module,
|
|
122
|
+
Function, Class, Lambda but also GenExpr, DictComp and SetComp)
|
|
123
|
+
"""
|
|
124
|
+
return self
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _scope_lookup(self, node, name, offset=0):
|
|
128
|
+
"""XXX method for interfacing the scope lookup"""
|
|
129
|
+
try:
|
|
130
|
+
stmts = node._filter_stmts(self.locals[name], self, offset)
|
|
131
|
+
except KeyError:
|
|
132
|
+
stmts = ()
|
|
133
|
+
if stmts:
|
|
134
|
+
return self, stmts
|
|
135
|
+
if self.parent: # i.e. not Module
|
|
136
|
+
# nested scope: if parent scope is a function, that's fine
|
|
137
|
+
# else jump to the module
|
|
138
|
+
pscope = self.parent.scope()
|
|
139
|
+
if not pscope.is_function:
|
|
140
|
+
pscope = pscope.root()
|
|
141
|
+
return pscope.scope_lookup(node, name)
|
|
142
|
+
return builtin_lookup(name) # Module
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def set_local(self, name, stmt):
|
|
147
|
+
"""define <name> in locals (<stmt> is the node defining the name)
|
|
148
|
+
if the node is a Module node (i.e. has globals), add the name to
|
|
149
|
+
globals
|
|
150
|
+
|
|
151
|
+
if the name is already defined, ignore it
|
|
152
|
+
"""
|
|
153
|
+
#assert not stmt in self.locals.get(name, ()), (self, stmt)
|
|
154
|
+
self.locals.setdefault(name, []).append(stmt)
|
|
155
|
+
|
|
156
|
+
__setitem__ = set_local
|
|
157
|
+
|
|
158
|
+
def _append_node(self, child):
|
|
159
|
+
"""append a child, linking it in the tree"""
|
|
160
|
+
self.body.append(child)
|
|
161
|
+
child.parent = self
|
|
162
|
+
|
|
163
|
+
def add_local_node(self, child_node, name=None):
|
|
164
|
+
"""append a child which should alter locals to the given node"""
|
|
165
|
+
if name != '__class__':
|
|
166
|
+
# add __class__ node as a child will cause infinite recursion later!
|
|
167
|
+
self._append_node(child_node)
|
|
168
|
+
self.set_local(name or child_node.name, child_node)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def __getitem__(self, item):
|
|
172
|
+
"""method from the `dict` interface returning the first node
|
|
173
|
+
associated with the given name in the locals dictionary
|
|
174
|
+
|
|
175
|
+
:type item: str
|
|
176
|
+
:param item: the name of the locally defined object
|
|
177
|
+
:raises KeyError: if the name is not defined
|
|
178
|
+
"""
|
|
179
|
+
return self.locals[item][0]
|
|
180
|
+
|
|
181
|
+
def __iter__(self):
|
|
182
|
+
"""method from the `dict` interface returning an iterator on
|
|
183
|
+
`self.keys()`
|
|
184
|
+
"""
|
|
185
|
+
return iter(self.keys())
|
|
186
|
+
|
|
187
|
+
def keys(self):
|
|
188
|
+
"""method from the `dict` interface returning a tuple containing
|
|
189
|
+
locally defined names
|
|
190
|
+
"""
|
|
191
|
+
return self.locals.keys()
|
|
192
|
+
|
|
193
|
+
def values(self):
|
|
194
|
+
"""method from the `dict` interface returning a tuple containing
|
|
195
|
+
locally defined nodes which are instance of `Function` or `Class`
|
|
196
|
+
"""
|
|
197
|
+
return [self[key] for key in self.keys()]
|
|
198
|
+
|
|
199
|
+
def items(self):
|
|
200
|
+
"""method from the `dict` interface returning a list of tuple
|
|
201
|
+
containing each locally defined name with its associated node,
|
|
202
|
+
which is an instance of `Function` or `Class`
|
|
203
|
+
"""
|
|
204
|
+
return zip(self.keys(), self.values())
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def __contains__(self, name):
|
|
208
|
+
return name in self.locals
|
|
209
|
+
has_key = __contains__
|
|
210
|
+
|
|
211
|
+
# Module #####################################################################
|
|
212
|
+
|
|
213
|
+
class Module(LocalsDictNodeNG):
|
|
214
|
+
_astroid_fields = ('body',)
|
|
215
|
+
|
|
216
|
+
fromlineno = 0
|
|
217
|
+
lineno = 0
|
|
218
|
+
|
|
219
|
+
# attributes below are set by the builder module or by raw factories
|
|
220
|
+
|
|
221
|
+
# the file from which as been extracted the astroid representation. It may
|
|
222
|
+
# be None if the representation has been built from a built-in module
|
|
223
|
+
file = None
|
|
224
|
+
# Alternatively, if built from a string/bytes, this can be set
|
|
225
|
+
file_bytes = None
|
|
226
|
+
# encoding of python source file, so we can get unicode out of it (python2
|
|
227
|
+
# only)
|
|
228
|
+
file_encoding = None
|
|
229
|
+
# the module name
|
|
230
|
+
name = None
|
|
231
|
+
# boolean for astroid built from source (i.e. ast)
|
|
232
|
+
pure_python = None
|
|
233
|
+
# boolean for package module
|
|
234
|
+
package = None
|
|
235
|
+
# dictionary of globals with name as key and node defining the global
|
|
236
|
+
# as value
|
|
237
|
+
globals = None
|
|
238
|
+
|
|
239
|
+
# Future imports
|
|
240
|
+
future_imports = None
|
|
241
|
+
|
|
242
|
+
# names of python special attributes (handled by getattr impl.)
|
|
243
|
+
special_attributes = set(('__name__', '__doc__', '__file__', '__path__',
|
|
244
|
+
'__dict__'))
|
|
245
|
+
# names of module attributes available through the global scope
|
|
246
|
+
scope_attrs = set(('__name__', '__doc__', '__file__', '__path__'))
|
|
247
|
+
|
|
248
|
+
def __init__(self, name, doc, pure_python=True):
|
|
249
|
+
self.name = name
|
|
250
|
+
self.doc = doc
|
|
251
|
+
self.pure_python = pure_python
|
|
252
|
+
self.locals = self.globals = {}
|
|
253
|
+
self.body = []
|
|
254
|
+
self.future_imports = set()
|
|
255
|
+
|
|
256
|
+
@property
|
|
257
|
+
def file_stream(self):
|
|
258
|
+
if self.file_bytes is not None:
|
|
259
|
+
return BytesIO(self.file_bytes)
|
|
260
|
+
if self.file is not None:
|
|
261
|
+
return open(self.file, 'rb')
|
|
262
|
+
return None
|
|
263
|
+
|
|
264
|
+
def block_range(self, lineno):
|
|
265
|
+
"""return block line numbers.
|
|
266
|
+
|
|
267
|
+
start from the beginning whatever the given lineno
|
|
268
|
+
"""
|
|
269
|
+
return self.fromlineno, self.tolineno
|
|
270
|
+
|
|
271
|
+
def scope_lookup(self, node, name, offset=0):
|
|
272
|
+
if name in self.scope_attrs and not name in self.locals:
|
|
273
|
+
try:
|
|
274
|
+
return self, self.getattr(name)
|
|
275
|
+
except NotFoundError:
|
|
276
|
+
return self, ()
|
|
277
|
+
return self._scope_lookup(node, name, offset)
|
|
278
|
+
|
|
279
|
+
def pytype(self):
|
|
280
|
+
return '%s.module' % BUILTINS
|
|
281
|
+
|
|
282
|
+
def display_type(self):
|
|
283
|
+
return 'Module'
|
|
284
|
+
|
|
285
|
+
def getattr(self, name, context=None, ignore_locals=False):
|
|
286
|
+
if name in self.special_attributes:
|
|
287
|
+
if name == '__file__':
|
|
288
|
+
return [cf(self.file)] + self.locals.get(name, [])
|
|
289
|
+
if name == '__path__' and self.package:
|
|
290
|
+
return [List()] + self.locals.get(name, [])
|
|
291
|
+
return std_special_attributes(self, name)
|
|
292
|
+
if not ignore_locals and name in self.locals:
|
|
293
|
+
return self.locals[name]
|
|
294
|
+
if self.package:
|
|
295
|
+
try:
|
|
296
|
+
return [self.import_module(name, relative_only=True)]
|
|
297
|
+
except AstroidBuildingException:
|
|
298
|
+
raise NotFoundError(name)
|
|
299
|
+
except SyntaxError:
|
|
300
|
+
raise NotFoundError(name)
|
|
301
|
+
except Exception:# XXX pylint tests never pass here; do we need it?
|
|
302
|
+
import traceback
|
|
303
|
+
traceback.print_exc()
|
|
304
|
+
raise NotFoundError(name)
|
|
305
|
+
getattr = remove_nodes(getattr, DelName)
|
|
306
|
+
|
|
307
|
+
def igetattr(self, name, context=None):
|
|
308
|
+
"""inferred getattr"""
|
|
309
|
+
# set lookup name since this is necessary to infer on import nodes for
|
|
310
|
+
# instance
|
|
311
|
+
context = copy_context(context)
|
|
312
|
+
context.lookupname = name
|
|
313
|
+
try:
|
|
314
|
+
return _infer_stmts(self.getattr(name, context), context, frame=self)
|
|
315
|
+
except NotFoundError:
|
|
316
|
+
raise InferenceError(name)
|
|
317
|
+
|
|
318
|
+
def fully_defined(self):
|
|
319
|
+
"""return True if this module has been built from a .py file
|
|
320
|
+
and so contains a complete representation including the code
|
|
321
|
+
"""
|
|
322
|
+
return self.file is not None and self.file.endswith('.py')
|
|
323
|
+
|
|
324
|
+
def statement(self):
|
|
325
|
+
"""return the first parent node marked as statement node
|
|
326
|
+
consider a module as a statement...
|
|
327
|
+
"""
|
|
328
|
+
return self
|
|
329
|
+
|
|
330
|
+
def previous_sibling(self):
|
|
331
|
+
"""module has no sibling"""
|
|
332
|
+
return
|
|
333
|
+
|
|
334
|
+
def next_sibling(self):
|
|
335
|
+
"""module has no sibling"""
|
|
336
|
+
return
|
|
337
|
+
|
|
338
|
+
if sys.version_info < (2, 8):
|
|
339
|
+
def absolute_import_activated(self):
|
|
340
|
+
for stmt in self.locals.get('absolute_import', ()):
|
|
341
|
+
if isinstance(stmt, From) and stmt.modname == '__future__':
|
|
342
|
+
return True
|
|
343
|
+
return False
|
|
344
|
+
else:
|
|
345
|
+
absolute_import_activated = lambda self: True
|
|
346
|
+
|
|
347
|
+
def import_module(self, modname, relative_only=False, level=None):
|
|
348
|
+
"""import the given module considering self as context"""
|
|
349
|
+
if relative_only and level is None:
|
|
350
|
+
level = 0
|
|
351
|
+
absmodname = self.relative_to_absolute_name(modname, level)
|
|
352
|
+
try:
|
|
353
|
+
return MANAGER.ast_from_module_name(absmodname)
|
|
354
|
+
except AstroidBuildingException:
|
|
355
|
+
# we only want to import a sub module or package of this module,
|
|
356
|
+
# skip here
|
|
357
|
+
if relative_only:
|
|
358
|
+
raise
|
|
359
|
+
return MANAGER.ast_from_module_name(modname)
|
|
360
|
+
|
|
361
|
+
def relative_to_absolute_name(self, modname, level):
|
|
362
|
+
"""return the absolute module name for a relative import.
|
|
363
|
+
|
|
364
|
+
The relative import can be implicit or explicit.
|
|
365
|
+
"""
|
|
366
|
+
# XXX this returns non sens when called on an absolute import
|
|
367
|
+
# like 'pylint.checkers.astroid.utils'
|
|
368
|
+
# XXX doesn't return absolute name if self.name isn't absolute name
|
|
369
|
+
if self.absolute_import_activated() and level is None:
|
|
370
|
+
return modname
|
|
371
|
+
if level:
|
|
372
|
+
if self.package:
|
|
373
|
+
level = level - 1
|
|
374
|
+
package_name = self.name.rsplit('.', level)[0]
|
|
375
|
+
elif self.package:
|
|
376
|
+
package_name = self.name
|
|
377
|
+
else:
|
|
378
|
+
package_name = self.name.rsplit('.', 1)[0]
|
|
379
|
+
if package_name:
|
|
380
|
+
if not modname:
|
|
381
|
+
return package_name
|
|
382
|
+
return '%s.%s' % (package_name, modname)
|
|
383
|
+
return modname
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
def wildcard_import_names(self):
|
|
387
|
+
"""return the list of imported names when this module is 'wildcard
|
|
388
|
+
imported'
|
|
389
|
+
|
|
390
|
+
It doesn't include the '__builtins__' name which is added by the
|
|
391
|
+
current CPython implementation of wildcard imports.
|
|
392
|
+
"""
|
|
393
|
+
# take advantage of a living module if it exists
|
|
394
|
+
try:
|
|
395
|
+
living = sys.modules[self.name]
|
|
396
|
+
except KeyError:
|
|
397
|
+
pass
|
|
398
|
+
else:
|
|
399
|
+
try:
|
|
400
|
+
return living.__all__
|
|
401
|
+
except AttributeError:
|
|
402
|
+
return [name for name in living.__dict__.keys()
|
|
403
|
+
if not name.startswith('_')]
|
|
404
|
+
# else lookup the astroid
|
|
405
|
+
#
|
|
406
|
+
# We separate the different steps of lookup in try/excepts
|
|
407
|
+
# to avoid catching too many Exceptions
|
|
408
|
+
# However, we can not analyse dynamically constructed __all__
|
|
409
|
+
try:
|
|
410
|
+
all = self['__all__']
|
|
411
|
+
except KeyError:
|
|
412
|
+
return [name for name in self.keys() if not name.startswith('_')]
|
|
413
|
+
try:
|
|
414
|
+
explicit = all.assigned_stmts().next()
|
|
415
|
+
except InferenceError:
|
|
416
|
+
return [name for name in self.keys() if not name.startswith('_')]
|
|
417
|
+
except AttributeError:
|
|
418
|
+
# not an assignment node
|
|
419
|
+
# XXX infer?
|
|
420
|
+
return [name for name in self.keys() if not name.startswith('_')]
|
|
421
|
+
try:
|
|
422
|
+
# should be a Tuple/List of constant string / 1 string not allowed
|
|
423
|
+
return [const.value for const in explicit.elts]
|
|
424
|
+
except AttributeError:
|
|
425
|
+
return [name for name in self.keys() if not name.startswith('_')]
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
class ComprehensionScope(LocalsDictNodeNG):
|
|
429
|
+
def frame(self):
|
|
430
|
+
return self.parent.frame()
|
|
431
|
+
|
|
432
|
+
scope_lookup = LocalsDictNodeNG._scope_lookup
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class GenExpr(ComprehensionScope):
|
|
436
|
+
_astroid_fields = ('elt', 'generators')
|
|
437
|
+
|
|
438
|
+
def __init__(self):
|
|
439
|
+
self.locals = {}
|
|
440
|
+
self.elt = None
|
|
441
|
+
self.generators = []
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
class DictComp(ComprehensionScope):
|
|
445
|
+
_astroid_fields = ('key', 'value', 'generators')
|
|
446
|
+
|
|
447
|
+
def __init__(self):
|
|
448
|
+
self.locals = {}
|
|
449
|
+
self.key = None
|
|
450
|
+
self.value = None
|
|
451
|
+
self.generators = []
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
class SetComp(ComprehensionScope):
|
|
455
|
+
_astroid_fields = ('elt', 'generators')
|
|
456
|
+
|
|
457
|
+
def __init__(self):
|
|
458
|
+
self.locals = {}
|
|
459
|
+
self.elt = None
|
|
460
|
+
self.generators = []
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class _ListComp(NodeNG):
|
|
464
|
+
"""class representing a ListComp node"""
|
|
465
|
+
_astroid_fields = ('elt', 'generators')
|
|
466
|
+
elt = None
|
|
467
|
+
generators = None
|
|
468
|
+
|
|
469
|
+
if sys.version_info >= (3, 0):
|
|
470
|
+
class ListComp(_ListComp, ComprehensionScope):
|
|
471
|
+
"""class representing a ListComp node"""
|
|
472
|
+
def __init__(self):
|
|
473
|
+
self.locals = {}
|
|
474
|
+
else:
|
|
475
|
+
class ListComp(_ListComp):
|
|
476
|
+
"""class representing a ListComp node"""
|
|
477
|
+
|
|
478
|
+
# Function ###################################################################
|
|
479
|
+
|
|
480
|
+
def _function_type(self):
|
|
481
|
+
"""
|
|
482
|
+
Function type, possible values are:
|
|
483
|
+
method, function, staticmethod, classmethod.
|
|
484
|
+
"""
|
|
485
|
+
# Can't infer that this node is decorated
|
|
486
|
+
# with a subclass of `classmethod` where `type` is first set,
|
|
487
|
+
# so do it here.
|
|
488
|
+
if self.decorators:
|
|
489
|
+
for node in self.decorators.nodes:
|
|
490
|
+
if not isinstance(node, Name):
|
|
491
|
+
continue
|
|
492
|
+
try:
|
|
493
|
+
for infered in node.infer():
|
|
494
|
+
if not isinstance(infered, Class):
|
|
495
|
+
continue
|
|
496
|
+
for ancestor in infered.ancestors():
|
|
497
|
+
if isinstance(ancestor, Class):
|
|
498
|
+
if (ancestor.name == 'classmethod' and
|
|
499
|
+
ancestor.root().name == BUILTINS):
|
|
500
|
+
return 'classmethod'
|
|
501
|
+
elif (ancestor.name == 'staticmethod' and
|
|
502
|
+
ancestor.root().name == BUILTINS):
|
|
503
|
+
return 'staticmethod'
|
|
504
|
+
except InferenceError:
|
|
505
|
+
pass
|
|
506
|
+
return self._type
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
class Lambda(LocalsDictNodeNG, FilterStmtsMixin):
|
|
510
|
+
_astroid_fields = ('args', 'body',)
|
|
511
|
+
name = '<lambda>'
|
|
512
|
+
|
|
513
|
+
# function's type, 'function' | 'method' | 'staticmethod' | 'classmethod'
|
|
514
|
+
type = 'function'
|
|
515
|
+
|
|
516
|
+
def __init__(self):
|
|
517
|
+
self.locals = {}
|
|
518
|
+
self.args = []
|
|
519
|
+
self.body = []
|
|
520
|
+
|
|
521
|
+
def pytype(self):
|
|
522
|
+
if 'method' in self.type:
|
|
523
|
+
return '%s.instancemethod' % BUILTINS
|
|
524
|
+
return '%s.function' % BUILTINS
|
|
525
|
+
|
|
526
|
+
def display_type(self):
|
|
527
|
+
if 'method' in self.type:
|
|
528
|
+
return 'Method'
|
|
529
|
+
return 'Function'
|
|
530
|
+
|
|
531
|
+
def callable(self):
|
|
532
|
+
return True
|
|
533
|
+
|
|
534
|
+
def argnames(self):
|
|
535
|
+
"""return a list of argument names"""
|
|
536
|
+
if self.args.args: # maybe None with builtin functions
|
|
537
|
+
names = _rec_get_names(self.args.args)
|
|
538
|
+
else:
|
|
539
|
+
names = []
|
|
540
|
+
if self.args.vararg:
|
|
541
|
+
names.append(self.args.vararg)
|
|
542
|
+
if self.args.kwarg:
|
|
543
|
+
names.append(self.args.kwarg)
|
|
544
|
+
return names
|
|
545
|
+
|
|
546
|
+
def infer_call_result(self, caller, context=None):
|
|
547
|
+
"""infer what a function is returning when called"""
|
|
548
|
+
return self.body.infer(context)
|
|
549
|
+
|
|
550
|
+
def scope_lookup(self, node, name, offset=0):
|
|
551
|
+
if node in self.args.defaults or node in self.args.kw_defaults:
|
|
552
|
+
frame = self.parent.frame()
|
|
553
|
+
# line offset to avoid that def func(f=func) resolve the default
|
|
554
|
+
# value to the defined function
|
|
555
|
+
offset = -1
|
|
556
|
+
else:
|
|
557
|
+
# check this is not used in function decorators
|
|
558
|
+
frame = self
|
|
559
|
+
return frame._scope_lookup(node, name, offset)
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
class Function(Statement, Lambda):
|
|
563
|
+
_astroid_fields = ('decorators', 'args', 'body')
|
|
564
|
+
|
|
565
|
+
special_attributes = set(('__name__', '__doc__', '__dict__'))
|
|
566
|
+
is_function = True
|
|
567
|
+
# attributes below are set by the builder module or by raw factories
|
|
568
|
+
blockstart_tolineno = None
|
|
569
|
+
decorators = None
|
|
570
|
+
_type = "function"
|
|
571
|
+
type = cachedproperty(_function_type)
|
|
572
|
+
|
|
573
|
+
def __init__(self, name, doc):
|
|
574
|
+
self.locals = {}
|
|
575
|
+
self.args = []
|
|
576
|
+
self.body = []
|
|
577
|
+
self.decorators = None
|
|
578
|
+
self.name = name
|
|
579
|
+
self.doc = doc
|
|
580
|
+
self.extra_decorators = []
|
|
581
|
+
self.instance_attrs = {}
|
|
582
|
+
|
|
583
|
+
def set_line_info(self, lastchild):
|
|
584
|
+
self.fromlineno = self.lineno
|
|
585
|
+
# lineno is the line number of the first decorator, we want the def statement lineno
|
|
586
|
+
if self.decorators is not None:
|
|
587
|
+
self.fromlineno += sum(node.tolineno - node.lineno + 1
|
|
588
|
+
for node in self.decorators.nodes)
|
|
589
|
+
if self.args.fromlineno < self.fromlineno:
|
|
590
|
+
self.args.fromlineno = self.fromlineno
|
|
591
|
+
self.tolineno = lastchild.tolineno
|
|
592
|
+
self.blockstart_tolineno = self.args.tolineno
|
|
593
|
+
|
|
594
|
+
def block_range(self, lineno):
|
|
595
|
+
"""return block line numbers.
|
|
596
|
+
|
|
597
|
+
start from the "def" position whatever the given lineno
|
|
598
|
+
"""
|
|
599
|
+
return self.fromlineno, self.tolineno
|
|
600
|
+
|
|
601
|
+
def getattr(self, name, context=None):
|
|
602
|
+
"""this method doesn't look in the instance_attrs dictionary since it's
|
|
603
|
+
done by an Instance proxy at inference time.
|
|
604
|
+
"""
|
|
605
|
+
if name == '__module__':
|
|
606
|
+
return [cf(self.root().qname())]
|
|
607
|
+
if name in self.instance_attrs:
|
|
608
|
+
return self.instance_attrs[name]
|
|
609
|
+
return std_special_attributes(self, name, False)
|
|
610
|
+
|
|
611
|
+
def is_method(self):
|
|
612
|
+
"""return true if the function node should be considered as a method"""
|
|
613
|
+
# check we are defined in a Class, because this is usually expected
|
|
614
|
+
# (e.g. pylint...) when is_method() return True
|
|
615
|
+
return self.type != 'function' and isinstance(self.parent.frame(), Class)
|
|
616
|
+
|
|
617
|
+
def decoratornames(self):
|
|
618
|
+
"""return a list of decorator qualified names"""
|
|
619
|
+
result = set()
|
|
620
|
+
decoratornodes = []
|
|
621
|
+
if self.decorators is not None:
|
|
622
|
+
decoratornodes += self.decorators.nodes
|
|
623
|
+
decoratornodes += self.extra_decorators
|
|
624
|
+
for decnode in decoratornodes:
|
|
625
|
+
for infnode in decnode.infer():
|
|
626
|
+
result.add(infnode.qname())
|
|
627
|
+
return result
|
|
628
|
+
decoratornames = cached(decoratornames)
|
|
629
|
+
|
|
630
|
+
def is_bound(self):
|
|
631
|
+
"""return true if the function is bound to an Instance or a class"""
|
|
632
|
+
return self.type == 'classmethod'
|
|
633
|
+
|
|
634
|
+
def is_abstract(self, pass_is_abstract=True):
|
|
635
|
+
"""Returns True if the method is abstract.
|
|
636
|
+
|
|
637
|
+
A method is considered abstract if
|
|
638
|
+
- the only statement is 'raise NotImplementedError', or
|
|
639
|
+
- the only statement is 'pass' and pass_is_abstract is True, or
|
|
640
|
+
- the method is annotated with abc.astractproperty/abc.abstractmethod
|
|
641
|
+
"""
|
|
642
|
+
if self.decorators:
|
|
643
|
+
for node in self.decorators.nodes:
|
|
644
|
+
try:
|
|
645
|
+
infered = node.infer().next()
|
|
646
|
+
except InferenceError:
|
|
647
|
+
continue
|
|
648
|
+
if infered and infered.qname() in ('abc.abstractproperty',
|
|
649
|
+
'abc.abstractmethod'):
|
|
650
|
+
return True
|
|
651
|
+
|
|
652
|
+
for child_node in self.body:
|
|
653
|
+
if isinstance(child_node, Raise):
|
|
654
|
+
if child_node.raises_not_implemented():
|
|
655
|
+
return True
|
|
656
|
+
if pass_is_abstract and isinstance(child_node, Pass):
|
|
657
|
+
return True
|
|
658
|
+
return False
|
|
659
|
+
# empty function is the same as function with a single "pass" statement
|
|
660
|
+
if pass_is_abstract:
|
|
661
|
+
return True
|
|
662
|
+
|
|
663
|
+
def is_generator(self):
|
|
664
|
+
"""return true if this is a generator function"""
|
|
665
|
+
# XXX should be flagged, not computed
|
|
666
|
+
try:
|
|
667
|
+
return self.nodes_of_class((Yield, YieldFrom),
|
|
668
|
+
skip_klass=(Function, Lambda)).next()
|
|
669
|
+
except StopIteration:
|
|
670
|
+
return False
|
|
671
|
+
|
|
672
|
+
def infer_call_result(self, caller, context=None):
|
|
673
|
+
"""infer what a function is returning when called"""
|
|
674
|
+
if self.is_generator():
|
|
675
|
+
yield Generator()
|
|
676
|
+
return
|
|
677
|
+
returns = self.nodes_of_class(Return, skip_klass=Function)
|
|
678
|
+
for returnnode in returns:
|
|
679
|
+
if returnnode.value is None:
|
|
680
|
+
yield Const(None)
|
|
681
|
+
else:
|
|
682
|
+
try:
|
|
683
|
+
for infered in returnnode.value.infer(context):
|
|
684
|
+
yield infered
|
|
685
|
+
except InferenceError:
|
|
686
|
+
yield YES
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
def _rec_get_names(args, names=None):
|
|
690
|
+
"""return a list of all argument names"""
|
|
691
|
+
if names is None:
|
|
692
|
+
names = []
|
|
693
|
+
for arg in args:
|
|
694
|
+
if isinstance(arg, Tuple):
|
|
695
|
+
_rec_get_names(arg.elts, names)
|
|
696
|
+
else:
|
|
697
|
+
names.append(arg.name)
|
|
698
|
+
return names
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
# Class ######################################################################
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
def _is_metaclass(klass):
|
|
705
|
+
""" Return if the given class can be
|
|
706
|
+
used as a metaclass.
|
|
707
|
+
"""
|
|
708
|
+
if klass.name == 'type':
|
|
709
|
+
return True
|
|
710
|
+
for base in klass.bases:
|
|
711
|
+
try:
|
|
712
|
+
for baseobj in base.infer():
|
|
713
|
+
if isinstance(baseobj, Instance):
|
|
714
|
+
# not abstract
|
|
715
|
+
return False
|
|
716
|
+
if baseobj is YES:
|
|
717
|
+
continue
|
|
718
|
+
if baseobj is klass:
|
|
719
|
+
continue
|
|
720
|
+
if not isinstance(baseobj, Class):
|
|
721
|
+
continue
|
|
722
|
+
if baseobj._type == 'metaclass':
|
|
723
|
+
return True
|
|
724
|
+
if _is_metaclass(baseobj):
|
|
725
|
+
return True
|
|
726
|
+
except InferenceError:
|
|
727
|
+
continue
|
|
728
|
+
return False
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
def _class_type(klass, ancestors=None):
|
|
732
|
+
"""return a Class node type to differ metaclass, interface and exception
|
|
733
|
+
from 'regular' classes
|
|
734
|
+
"""
|
|
735
|
+
# XXX we have to store ancestors in case we have a ancestor loop
|
|
736
|
+
if klass._type is not None:
|
|
737
|
+
return klass._type
|
|
738
|
+
if _is_metaclass(klass):
|
|
739
|
+
klass._type = 'metaclass'
|
|
740
|
+
elif klass.name.endswith('Interface'):
|
|
741
|
+
klass._type = 'interface'
|
|
742
|
+
elif klass.name.endswith('Exception'):
|
|
743
|
+
klass._type = 'exception'
|
|
744
|
+
else:
|
|
745
|
+
if ancestors is None:
|
|
746
|
+
ancestors = set()
|
|
747
|
+
if klass in ancestors:
|
|
748
|
+
# XXX we are in loop ancestors, and have found no type
|
|
749
|
+
klass._type = 'class'
|
|
750
|
+
return 'class'
|
|
751
|
+
ancestors.add(klass)
|
|
752
|
+
# print >> sys.stderr, '_class_type', repr(klass)
|
|
753
|
+
for base in klass.ancestors(recurs=False):
|
|
754
|
+
name = _class_type(base, ancestors)
|
|
755
|
+
if name != 'class':
|
|
756
|
+
if name == 'metaclass' and not _is_metaclass(klass):
|
|
757
|
+
# don't propagate it if the current class
|
|
758
|
+
# can't be a metaclass
|
|
759
|
+
continue
|
|
760
|
+
klass._type = base.type
|
|
761
|
+
break
|
|
762
|
+
if klass._type is None:
|
|
763
|
+
klass._type = 'class'
|
|
764
|
+
return klass._type
|
|
765
|
+
|
|
766
|
+
def _iface_hdlr(iface_node):
|
|
767
|
+
"""a handler function used by interfaces to handle suspicious
|
|
768
|
+
interface nodes
|
|
769
|
+
"""
|
|
770
|
+
return True
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
class Class(Statement, LocalsDictNodeNG, FilterStmtsMixin):
|
|
774
|
+
|
|
775
|
+
# some of the attributes below are set by the builder module or
|
|
776
|
+
# by a raw factories
|
|
777
|
+
|
|
778
|
+
# a dictionary of class instances attributes
|
|
779
|
+
_astroid_fields = ('decorators', 'bases', 'body') # name
|
|
780
|
+
|
|
781
|
+
decorators = None
|
|
782
|
+
special_attributes = set(('__name__', '__doc__', '__dict__', '__module__',
|
|
783
|
+
'__bases__', '__mro__', '__subclasses__'))
|
|
784
|
+
blockstart_tolineno = None
|
|
785
|
+
|
|
786
|
+
_type = None
|
|
787
|
+
type = property(_class_type,
|
|
788
|
+
doc="class'type, possible values are 'class' | "
|
|
789
|
+
"'metaclass' | 'interface' | 'exception'")
|
|
790
|
+
|
|
791
|
+
def __init__(self, name, doc):
|
|
792
|
+
self.instance_attrs = {}
|
|
793
|
+
self.locals = {}
|
|
794
|
+
self.bases = []
|
|
795
|
+
self.body = []
|
|
796
|
+
self.name = name
|
|
797
|
+
self.doc = doc
|
|
798
|
+
|
|
799
|
+
def _newstyle_impl(self, context=None):
|
|
800
|
+
if context is None:
|
|
801
|
+
context = InferenceContext()
|
|
802
|
+
if self._newstyle is not None:
|
|
803
|
+
return self._newstyle
|
|
804
|
+
for base in self.ancestors(recurs=False, context=context):
|
|
805
|
+
if base._newstyle_impl(context):
|
|
806
|
+
self._newstyle = True
|
|
807
|
+
break
|
|
808
|
+
if self._newstyle is None:
|
|
809
|
+
self._newstyle = False
|
|
810
|
+
return self._newstyle
|
|
811
|
+
|
|
812
|
+
_newstyle = None
|
|
813
|
+
newstyle = property(_newstyle_impl,
|
|
814
|
+
doc="boolean indicating if it's a new style class"
|
|
815
|
+
"or not")
|
|
816
|
+
|
|
817
|
+
def set_line_info(self, lastchild):
|
|
818
|
+
self.fromlineno = self.lineno
|
|
819
|
+
self.blockstart_tolineno = self.bases and self.bases[-1].tolineno or self.fromlineno
|
|
820
|
+
if lastchild is not None:
|
|
821
|
+
self.tolineno = lastchild.tolineno
|
|
822
|
+
# else this is a class with only a docstring, then tolineno is (should be) already ok
|
|
823
|
+
|
|
824
|
+
def block_range(self, lineno):
|
|
825
|
+
"""return block line numbers.
|
|
826
|
+
|
|
827
|
+
start from the "class" position whatever the given lineno
|
|
828
|
+
"""
|
|
829
|
+
return self.fromlineno, self.tolineno
|
|
830
|
+
|
|
831
|
+
def pytype(self):
|
|
832
|
+
if self.newstyle:
|
|
833
|
+
return '%s.type' % BUILTINS
|
|
834
|
+
return '%s.classobj' % BUILTINS
|
|
835
|
+
|
|
836
|
+
def display_type(self):
|
|
837
|
+
return 'Class'
|
|
838
|
+
|
|
839
|
+
def callable(self):
|
|
840
|
+
return True
|
|
841
|
+
|
|
842
|
+
def infer_call_result(self, caller, context=None):
|
|
843
|
+
"""infer what a class is returning when called"""
|
|
844
|
+
yield Instance(self)
|
|
845
|
+
|
|
846
|
+
def scope_lookup(self, node, name, offset=0):
|
|
847
|
+
if node in self.bases:
|
|
848
|
+
frame = self.parent.frame()
|
|
849
|
+
# line offset to avoid that class A(A) resolve the ancestor to
|
|
850
|
+
# the defined class
|
|
851
|
+
offset = -1
|
|
852
|
+
else:
|
|
853
|
+
frame = self
|
|
854
|
+
return frame._scope_lookup(node, name, offset)
|
|
855
|
+
|
|
856
|
+
# list of parent class as a list of string (i.e. names as they appear
|
|
857
|
+
# in the class definition) XXX bw compat
|
|
858
|
+
def basenames(self):
|
|
859
|
+
return [bnode.as_string() for bnode in self.bases]
|
|
860
|
+
basenames = property(basenames)
|
|
861
|
+
|
|
862
|
+
def ancestors(self, recurs=True, context=None):
|
|
863
|
+
"""return an iterator on the node base classes in a prefixed
|
|
864
|
+
depth first order
|
|
865
|
+
|
|
866
|
+
:param recurs:
|
|
867
|
+
boolean indicating if it should recurse or return direct
|
|
868
|
+
ancestors only
|
|
869
|
+
"""
|
|
870
|
+
# FIXME: should be possible to choose the resolution order
|
|
871
|
+
# XXX inference make infinite loops possible here (see BaseTransformer
|
|
872
|
+
# manipulation in the builder module for instance)
|
|
873
|
+
yielded = set([self])
|
|
874
|
+
if context is None:
|
|
875
|
+
context = InferenceContext()
|
|
876
|
+
for stmt in self.bases:
|
|
877
|
+
with context.restore_path():
|
|
878
|
+
try:
|
|
879
|
+
for baseobj in stmt.infer(context):
|
|
880
|
+
if not isinstance(baseobj, Class):
|
|
881
|
+
if isinstance(baseobj, Instance):
|
|
882
|
+
baseobj = baseobj._proxied
|
|
883
|
+
else:
|
|
884
|
+
# duh ?
|
|
885
|
+
continue
|
|
886
|
+
if baseobj in yielded:
|
|
887
|
+
continue # cf xxx above
|
|
888
|
+
yielded.add(baseobj)
|
|
889
|
+
yield baseobj
|
|
890
|
+
if recurs:
|
|
891
|
+
for grandpa in baseobj.ancestors(True, context):
|
|
892
|
+
if grandpa in yielded:
|
|
893
|
+
continue # cf xxx above
|
|
894
|
+
yielded.add(grandpa)
|
|
895
|
+
yield grandpa
|
|
896
|
+
except InferenceError:
|
|
897
|
+
# XXX log error ?
|
|
898
|
+
continue
|
|
899
|
+
|
|
900
|
+
def local_attr_ancestors(self, name, context=None):
|
|
901
|
+
"""return an iterator on astroid representation of parent classes
|
|
902
|
+
which have <name> defined in their locals
|
|
903
|
+
"""
|
|
904
|
+
for astroid in self.ancestors(context=context):
|
|
905
|
+
if name in astroid:
|
|
906
|
+
yield astroid
|
|
907
|
+
|
|
908
|
+
def instance_attr_ancestors(self, name, context=None):
|
|
909
|
+
"""return an iterator on astroid representation of parent classes
|
|
910
|
+
which have <name> defined in their instance attribute dictionary
|
|
911
|
+
"""
|
|
912
|
+
for astroid in self.ancestors(context=context):
|
|
913
|
+
if name in astroid.instance_attrs:
|
|
914
|
+
yield astroid
|
|
915
|
+
|
|
916
|
+
def has_base(self, node):
|
|
917
|
+
return node in self.bases
|
|
918
|
+
|
|
919
|
+
def local_attr(self, name, context=None):
|
|
920
|
+
"""return the list of assign node associated to name in this class
|
|
921
|
+
locals or in its parents
|
|
922
|
+
|
|
923
|
+
:raises `NotFoundError`:
|
|
924
|
+
if no attribute with this name has been find in this class or
|
|
925
|
+
its parent classes
|
|
926
|
+
"""
|
|
927
|
+
try:
|
|
928
|
+
return self.locals[name]
|
|
929
|
+
except KeyError:
|
|
930
|
+
# get if from the first parent implementing it if any
|
|
931
|
+
for class_node in self.local_attr_ancestors(name, context):
|
|
932
|
+
return class_node.locals[name]
|
|
933
|
+
raise NotFoundError(name)
|
|
934
|
+
local_attr = remove_nodes(local_attr, DelAttr)
|
|
935
|
+
|
|
936
|
+
def instance_attr(self, name, context=None):
|
|
937
|
+
"""return the astroid nodes associated to name in this class instance
|
|
938
|
+
attributes dictionary and in its parents
|
|
939
|
+
|
|
940
|
+
:raises `NotFoundError`:
|
|
941
|
+
if no attribute with this name has been find in this class or
|
|
942
|
+
its parent classes
|
|
943
|
+
"""
|
|
944
|
+
values = self.instance_attrs.get(name, [])
|
|
945
|
+
# get all values from parents
|
|
946
|
+
for class_node in self.instance_attr_ancestors(name, context):
|
|
947
|
+
values += class_node.instance_attrs[name]
|
|
948
|
+
if not values:
|
|
949
|
+
raise NotFoundError(name)
|
|
950
|
+
return values
|
|
951
|
+
instance_attr = remove_nodes(instance_attr, DelAttr)
|
|
952
|
+
|
|
953
|
+
def instanciate_class(self):
|
|
954
|
+
"""return Instance of Class node, else return self"""
|
|
955
|
+
return Instance(self)
|
|
956
|
+
|
|
957
|
+
def getattr(self, name, context=None):
|
|
958
|
+
"""this method doesn't look in the instance_attrs dictionary since it's
|
|
959
|
+
done by an Instance proxy at inference time.
|
|
960
|
+
|
|
961
|
+
It may return a YES object if the attribute has not been actually
|
|
962
|
+
found but a __getattr__ or __getattribute__ method is defined
|
|
963
|
+
"""
|
|
964
|
+
values = self.locals.get(name, [])
|
|
965
|
+
if name in self.special_attributes:
|
|
966
|
+
if name == '__module__':
|
|
967
|
+
return [cf(self.root().qname())] + values
|
|
968
|
+
# FIXME: do we really need the actual list of ancestors?
|
|
969
|
+
# returning [Tuple()] + values don't break any test
|
|
970
|
+
# this is ticket http://www.logilab.org/ticket/52785
|
|
971
|
+
# XXX need proper meta class handling + MRO implementation
|
|
972
|
+
if name == '__bases__' or (name == '__mro__' and self.newstyle):
|
|
973
|
+
node = Tuple()
|
|
974
|
+
node.items = self.ancestors(recurs=True, context=context)
|
|
975
|
+
return [node] + values
|
|
976
|
+
return std_special_attributes(self, name)
|
|
977
|
+
# don't modify the list in self.locals!
|
|
978
|
+
values = list(values)
|
|
979
|
+
for classnode in self.ancestors(recurs=True, context=context):
|
|
980
|
+
values += classnode.locals.get(name, [])
|
|
981
|
+
if not values:
|
|
982
|
+
raise NotFoundError(name)
|
|
983
|
+
return values
|
|
984
|
+
|
|
985
|
+
def igetattr(self, name, context=None):
|
|
986
|
+
"""inferred getattr, need special treatment in class to handle
|
|
987
|
+
descriptors
|
|
988
|
+
"""
|
|
989
|
+
# set lookup name since this is necessary to infer on import nodes for
|
|
990
|
+
# instance
|
|
991
|
+
context = copy_context(context)
|
|
992
|
+
context.lookupname = name
|
|
993
|
+
try:
|
|
994
|
+
for infered in _infer_stmts(self.getattr(name, context), context,
|
|
995
|
+
frame=self):
|
|
996
|
+
# yield YES object instead of descriptors when necessary
|
|
997
|
+
if not isinstance(infered, Const) and isinstance(infered, Instance):
|
|
998
|
+
try:
|
|
999
|
+
infered._proxied.getattr('__get__', context)
|
|
1000
|
+
except NotFoundError:
|
|
1001
|
+
yield infered
|
|
1002
|
+
else:
|
|
1003
|
+
yield YES
|
|
1004
|
+
else:
|
|
1005
|
+
yield function_to_method(infered, self)
|
|
1006
|
+
except NotFoundError:
|
|
1007
|
+
if not name.startswith('__') and self.has_dynamic_getattr(context):
|
|
1008
|
+
# class handle some dynamic attributes, return a YES object
|
|
1009
|
+
yield YES
|
|
1010
|
+
else:
|
|
1011
|
+
raise InferenceError(name)
|
|
1012
|
+
|
|
1013
|
+
def has_dynamic_getattr(self, context=None):
|
|
1014
|
+
"""return True if the class has a custom __getattr__ or
|
|
1015
|
+
__getattribute__ method
|
|
1016
|
+
"""
|
|
1017
|
+
# need to explicitly handle optparse.Values (setattr is not detected)
|
|
1018
|
+
if self.name == 'Values' and self.root().name == 'optparse':
|
|
1019
|
+
return True
|
|
1020
|
+
try:
|
|
1021
|
+
self.getattr('__getattr__', context)
|
|
1022
|
+
return True
|
|
1023
|
+
except NotFoundError:
|
|
1024
|
+
#if self.newstyle: XXX cause an infinite recursion error
|
|
1025
|
+
try:
|
|
1026
|
+
getattribute = self.getattr('__getattribute__', context)[0]
|
|
1027
|
+
if getattribute.root().name != BUILTINS:
|
|
1028
|
+
# class has a custom __getattribute__ defined
|
|
1029
|
+
return True
|
|
1030
|
+
except NotFoundError:
|
|
1031
|
+
pass
|
|
1032
|
+
return False
|
|
1033
|
+
|
|
1034
|
+
def methods(self):
|
|
1035
|
+
"""return an iterator on all methods defined in the class and
|
|
1036
|
+
its ancestors
|
|
1037
|
+
"""
|
|
1038
|
+
done = {}
|
|
1039
|
+
for astroid in chain(iter((self,)), self.ancestors()):
|
|
1040
|
+
for meth in astroid.mymethods():
|
|
1041
|
+
if meth.name in done:
|
|
1042
|
+
continue
|
|
1043
|
+
done[meth.name] = None
|
|
1044
|
+
yield meth
|
|
1045
|
+
|
|
1046
|
+
def mymethods(self):
|
|
1047
|
+
"""return an iterator on all methods defined in the class"""
|
|
1048
|
+
for member in self.values():
|
|
1049
|
+
if isinstance(member, Function):
|
|
1050
|
+
yield member
|
|
1051
|
+
|
|
1052
|
+
def interfaces(self, herited=True, handler_func=_iface_hdlr):
|
|
1053
|
+
"""return an iterator on interfaces implemented by the given
|
|
1054
|
+
class node
|
|
1055
|
+
"""
|
|
1056
|
+
# FIXME: what if __implements__ = (MyIFace, MyParent.__implements__)...
|
|
1057
|
+
try:
|
|
1058
|
+
implements = Instance(self).getattr('__implements__')[0]
|
|
1059
|
+
except NotFoundError:
|
|
1060
|
+
return
|
|
1061
|
+
if not herited and not implements.frame() is self:
|
|
1062
|
+
return
|
|
1063
|
+
found = set()
|
|
1064
|
+
missing = False
|
|
1065
|
+
for iface in unpack_infer(implements):
|
|
1066
|
+
if iface is YES:
|
|
1067
|
+
missing = True
|
|
1068
|
+
continue
|
|
1069
|
+
if not iface in found and handler_func(iface):
|
|
1070
|
+
found.add(iface)
|
|
1071
|
+
yield iface
|
|
1072
|
+
if missing:
|
|
1073
|
+
raise InferenceError()
|
|
1074
|
+
|
|
1075
|
+
_metaclass = None
|
|
1076
|
+
def _explicit_metaclass(self):
|
|
1077
|
+
""" Return the explicit defined metaclass
|
|
1078
|
+
for the current class.
|
|
1079
|
+
|
|
1080
|
+
An explicit defined metaclass is defined
|
|
1081
|
+
either by passing the ``metaclass`` keyword argument
|
|
1082
|
+
in the class definition line (Python 3) or by
|
|
1083
|
+
having a ``__metaclass__`` class attribute.
|
|
1084
|
+
"""
|
|
1085
|
+
if self._metaclass:
|
|
1086
|
+
# Expects this from Py3k TreeRebuilder
|
|
1087
|
+
try:
|
|
1088
|
+
return next(node for node in self._metaclass.infer()
|
|
1089
|
+
if node is not YES)
|
|
1090
|
+
except (InferenceError, StopIteration):
|
|
1091
|
+
return
|
|
1092
|
+
|
|
1093
|
+
try:
|
|
1094
|
+
meta = self.getattr('__metaclass__')[0]
|
|
1095
|
+
except NotFoundError:
|
|
1096
|
+
return
|
|
1097
|
+
try:
|
|
1098
|
+
infered = meta.infer().next()
|
|
1099
|
+
except InferenceError:
|
|
1100
|
+
return
|
|
1101
|
+
if infered is YES: # don't expose this
|
|
1102
|
+
return None
|
|
1103
|
+
return infered
|
|
1104
|
+
|
|
1105
|
+
def metaclass(self):
|
|
1106
|
+
""" Return the metaclass of this class.
|
|
1107
|
+
|
|
1108
|
+
If this class does not define explicitly a metaclass,
|
|
1109
|
+
then the first defined metaclass in ancestors will be used
|
|
1110
|
+
instead.
|
|
1111
|
+
"""
|
|
1112
|
+
klass = self._explicit_metaclass()
|
|
1113
|
+
if klass is None:
|
|
1114
|
+
for parent in self.ancestors():
|
|
1115
|
+
klass = parent.metaclass()
|
|
1116
|
+
if klass is not None:
|
|
1117
|
+
break
|
|
1118
|
+
return klass
|