exercism-analysis 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,87 @@
|
|
1
|
+
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
+
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
+
#
|
4
|
+
# This file is part of logilab-common.
|
5
|
+
#
|
6
|
+
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
+
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
+
# later version.
|
10
|
+
#
|
11
|
+
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
+
# details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
+
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
from logilab.common.decorators import monkeypatch
|
19
|
+
|
20
|
+
from sphinx.ext import autodoc
|
21
|
+
|
22
|
+
class DocstringOnlyModuleDocumenter(autodoc.ModuleDocumenter):
|
23
|
+
objtype = 'docstring'
|
24
|
+
def format_signature(self):
|
25
|
+
pass
|
26
|
+
def add_directive_header(self, sig):
|
27
|
+
pass
|
28
|
+
def document_members(self, all_members=False):
|
29
|
+
pass
|
30
|
+
|
31
|
+
def resolve_name(self, modname, parents, path, base):
|
32
|
+
if modname is not None:
|
33
|
+
return modname, parents + [base]
|
34
|
+
return (path or '') + base, []
|
35
|
+
|
36
|
+
|
37
|
+
#autodoc.add_documenter(DocstringOnlyModuleDocumenter)
|
38
|
+
|
39
|
+
def setup(app):
|
40
|
+
app.add_autodocumenter(DocstringOnlyModuleDocumenter)
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
from sphinx.ext.autodoc import (ViewList, Options, AutodocReporter, nodes,
|
45
|
+
assemble_option_dict, nested_parse_with_titles)
|
46
|
+
|
47
|
+
@monkeypatch(autodoc.AutoDirective)
|
48
|
+
def run(self):
|
49
|
+
self.filename_set = set() # a set of dependent filenames
|
50
|
+
self.reporter = self.state.document.reporter
|
51
|
+
self.env = self.state.document.settings.env
|
52
|
+
self.warnings = []
|
53
|
+
self.result = ViewList()
|
54
|
+
|
55
|
+
# find out what documenter to call
|
56
|
+
objtype = self.name[4:]
|
57
|
+
doc_class = self._registry[objtype]
|
58
|
+
# process the options with the selected documenter's option_spec
|
59
|
+
self.genopt = Options(assemble_option_dict(
|
60
|
+
self.options.items(), doc_class.option_spec))
|
61
|
+
# generate the output
|
62
|
+
documenter = doc_class(self, self.arguments[0])
|
63
|
+
documenter.generate(more_content=self.content)
|
64
|
+
if not self.result:
|
65
|
+
return self.warnings
|
66
|
+
|
67
|
+
# record all filenames as dependencies -- this will at least
|
68
|
+
# partially make automatic invalidation possible
|
69
|
+
for fn in self.filename_set:
|
70
|
+
self.env.note_dependency(fn)
|
71
|
+
|
72
|
+
# use a custom reporter that correctly assigns lines to source
|
73
|
+
# filename/description and lineno
|
74
|
+
old_reporter = self.state.memo.reporter
|
75
|
+
self.state.memo.reporter = AutodocReporter(self.result,
|
76
|
+
self.state.memo.reporter)
|
77
|
+
if self.name in ('automodule', 'autodocstring'):
|
78
|
+
node = nodes.section()
|
79
|
+
# necessary so that the child nodes get the right source/line set
|
80
|
+
node.document = self.state.document
|
81
|
+
nested_parse_with_titles(self.state, self.result, node)
|
82
|
+
else:
|
83
|
+
node = nodes.paragraph()
|
84
|
+
node.document = self.state.document
|
85
|
+
self.state.nested_parse(self.result, 0, node)
|
86
|
+
self.state.memo.reporter = old_reporter
|
87
|
+
return self.warnings + node.children
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
+
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
+
#
|
4
|
+
# This file is part of logilab-common.
|
5
|
+
#
|
6
|
+
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
+
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
+
# later version.
|
10
|
+
#
|
11
|
+
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
+
# details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
+
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
"""Sphinx utils
|
19
|
+
|
20
|
+
ModuleGenerator: Generate a file that lists all the modules of a list of
|
21
|
+
packages in order to pull all the docstring.
|
22
|
+
This should not be used in a makefile to systematically generate sphinx
|
23
|
+
documentation!
|
24
|
+
|
25
|
+
Typical usage:
|
26
|
+
|
27
|
+
>>> from logilab.common.sphinxutils import ModuleGenerator
|
28
|
+
>>> mgen = ModuleGenerator('logilab common', '/home/adim/src/logilab/common')
|
29
|
+
>>> mgen.generate('api_logilab_common.rst', exclude_dirs=('test',))
|
30
|
+
"""
|
31
|
+
|
32
|
+
import os, sys
|
33
|
+
import os.path as osp
|
34
|
+
import inspect
|
35
|
+
|
36
|
+
from logilab.common import STD_BLACKLIST
|
37
|
+
from logilab.common.shellutils import globfind
|
38
|
+
from logilab.common.modutils import load_module_from_file, modpath_from_file
|
39
|
+
|
40
|
+
def module_members(module):
|
41
|
+
members = []
|
42
|
+
for name, value in inspect.getmembers(module):
|
43
|
+
if getattr(value, '__module__', None) == module.__name__:
|
44
|
+
members.append( (name, value) )
|
45
|
+
return sorted(members)
|
46
|
+
|
47
|
+
|
48
|
+
def class_members(klass):
|
49
|
+
return sorted([name for name in vars(klass)
|
50
|
+
if name not in ('__doc__', '__module__',
|
51
|
+
'__dict__', '__weakref__')])
|
52
|
+
|
53
|
+
class ModuleGenerator:
|
54
|
+
file_header = """.. -*- coding: utf-8 -*-\n\n%s\n"""
|
55
|
+
module_def = """
|
56
|
+
:mod:`%s`
|
57
|
+
=======%s
|
58
|
+
|
59
|
+
.. automodule:: %s
|
60
|
+
:members: %s
|
61
|
+
"""
|
62
|
+
class_def = """
|
63
|
+
|
64
|
+
.. autoclass:: %s
|
65
|
+
:members: %s
|
66
|
+
|
67
|
+
"""
|
68
|
+
|
69
|
+
def __init__(self, project_title, code_dir):
|
70
|
+
self.title = project_title
|
71
|
+
self.code_dir = osp.abspath(code_dir)
|
72
|
+
|
73
|
+
def generate(self, dest_file, exclude_dirs=STD_BLACKLIST):
|
74
|
+
"""make the module file"""
|
75
|
+
self.fn = open(dest_file, 'w')
|
76
|
+
num = len(self.title) + 6
|
77
|
+
title = "=" * num + "\n %s API\n" % self.title + "=" * num
|
78
|
+
self.fn.write(self.file_header % title)
|
79
|
+
self.gen_modules(exclude_dirs=exclude_dirs)
|
80
|
+
self.fn.close()
|
81
|
+
|
82
|
+
def gen_modules(self, exclude_dirs):
|
83
|
+
"""generate all modules"""
|
84
|
+
for module in self.find_modules(exclude_dirs):
|
85
|
+
modname = module.__name__
|
86
|
+
classes = []
|
87
|
+
modmembers = []
|
88
|
+
for objname, obj in module_members(module):
|
89
|
+
if inspect.isclass(obj):
|
90
|
+
classmembers = class_members(obj)
|
91
|
+
classes.append( (objname, classmembers) )
|
92
|
+
else:
|
93
|
+
modmembers.append(objname)
|
94
|
+
self.fn.write(self.module_def % (modname, '=' * len(modname),
|
95
|
+
modname,
|
96
|
+
', '.join(modmembers)))
|
97
|
+
for klass, members in classes:
|
98
|
+
self.fn.write(self.class_def % (klass, ', '.join(members)))
|
99
|
+
|
100
|
+
def find_modules(self, exclude_dirs):
|
101
|
+
basepath = osp.dirname(self.code_dir)
|
102
|
+
basedir = osp.basename(basepath) + osp.sep
|
103
|
+
if basedir not in sys.path:
|
104
|
+
sys.path.insert(1, basedir)
|
105
|
+
for filepath in globfind(self.code_dir, '*.py', exclude_dirs):
|
106
|
+
if osp.basename(filepath) in ('setup.py', '__pkginfo__.py'):
|
107
|
+
continue
|
108
|
+
try:
|
109
|
+
module = load_module_from_file(filepath)
|
110
|
+
except: # module might be broken or magic
|
111
|
+
dotted_path = modpath_from_file(filepath)
|
112
|
+
module = type('.'.join(dotted_path), (), {}) # mock it
|
113
|
+
yield module
|
114
|
+
|
115
|
+
|
116
|
+
if __name__ == '__main__':
|
117
|
+
# example :
|
118
|
+
title, code_dir, outfile = sys.argv[1:]
|
119
|
+
generator = ModuleGenerator(title, code_dir)
|
120
|
+
# XXX modnames = ['logilab']
|
121
|
+
generator.generate(outfile, ('test', 'tests', 'examples',
|
122
|
+
'data', 'doc', '.hg', 'migration'))
|
@@ -0,0 +1,925 @@
|
|
1
|
+
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
+
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
+
#
|
4
|
+
# This file is part of logilab-common.
|
5
|
+
#
|
6
|
+
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
+
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
+
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
+
# later version.
|
10
|
+
#
|
11
|
+
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
+
# details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
+
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
"""Table management module."""
|
19
|
+
__docformat__ = "restructuredtext en"
|
20
|
+
|
21
|
+
|
22
|
+
class Table(object):
|
23
|
+
"""Table defines a data table with column and row names.
|
24
|
+
inv:
|
25
|
+
len(self.data) <= len(self.row_names)
|
26
|
+
forall(self.data, lambda x: len(x) <= len(self.col_names))
|
27
|
+
"""
|
28
|
+
|
29
|
+
def __init__(self, default_value=0, col_names=None, row_names=None):
|
30
|
+
self.col_names = []
|
31
|
+
self.row_names = []
|
32
|
+
self.data = []
|
33
|
+
self.default_value = default_value
|
34
|
+
if col_names:
|
35
|
+
self.create_columns(col_names)
|
36
|
+
if row_names:
|
37
|
+
self.create_rows(row_names)
|
38
|
+
|
39
|
+
def _next_row_name(self):
|
40
|
+
return 'row%s' % (len(self.row_names)+1)
|
41
|
+
|
42
|
+
def __iter__(self):
|
43
|
+
return iter(self.data)
|
44
|
+
|
45
|
+
def __eq__(self, other):
|
46
|
+
if other is None:
|
47
|
+
return False
|
48
|
+
else:
|
49
|
+
return list(self) == list(other)
|
50
|
+
|
51
|
+
__hash__ = object.__hash__
|
52
|
+
|
53
|
+
def __ne__(self, other):
|
54
|
+
return not self == other
|
55
|
+
|
56
|
+
def __len__(self):
|
57
|
+
return len(self.row_names)
|
58
|
+
|
59
|
+
## Rows / Columns creation #################################################
|
60
|
+
def create_rows(self, row_names):
|
61
|
+
"""Appends row_names to the list of existing rows
|
62
|
+
"""
|
63
|
+
self.row_names.extend(row_names)
|
64
|
+
for row_name in row_names:
|
65
|
+
self.data.append([self.default_value]*len(self.col_names))
|
66
|
+
|
67
|
+
def create_columns(self, col_names):
|
68
|
+
"""Appends col_names to the list of existing columns
|
69
|
+
"""
|
70
|
+
for col_name in col_names:
|
71
|
+
self.create_column(col_name)
|
72
|
+
|
73
|
+
def create_row(self, row_name=None):
|
74
|
+
"""Creates a rowname to the row_names list
|
75
|
+
"""
|
76
|
+
row_name = row_name or self._next_row_name()
|
77
|
+
self.row_names.append(row_name)
|
78
|
+
self.data.append([self.default_value]*len(self.col_names))
|
79
|
+
|
80
|
+
|
81
|
+
def create_column(self, col_name):
|
82
|
+
"""Creates a colname to the col_names list
|
83
|
+
"""
|
84
|
+
self.col_names.append(col_name)
|
85
|
+
for row in self.data:
|
86
|
+
row.append(self.default_value)
|
87
|
+
|
88
|
+
## Sort by column ##########################################################
|
89
|
+
def sort_by_column_id(self, col_id, method = 'asc'):
|
90
|
+
"""Sorts the table (in-place) according to data stored in col_id
|
91
|
+
"""
|
92
|
+
try:
|
93
|
+
col_index = self.col_names.index(col_id)
|
94
|
+
self.sort_by_column_index(col_index, method)
|
95
|
+
except ValueError:
|
96
|
+
raise KeyError("Col (%s) not found in table" % (col_id))
|
97
|
+
|
98
|
+
|
99
|
+
def sort_by_column_index(self, col_index, method = 'asc'):
|
100
|
+
"""Sorts the table 'in-place' according to data stored in col_index
|
101
|
+
|
102
|
+
method should be in ('asc', 'desc')
|
103
|
+
"""
|
104
|
+
sort_list = sorted([(row[col_index], row, row_name)
|
105
|
+
for row, row_name in zip(self.data, self.row_names)])
|
106
|
+
# Sorting sort_list will sort according to col_index
|
107
|
+
# If we want reverse sort, then reverse list
|
108
|
+
if method.lower() == 'desc':
|
109
|
+
sort_list.reverse()
|
110
|
+
|
111
|
+
# Rebuild data / row names
|
112
|
+
self.data = []
|
113
|
+
self.row_names = []
|
114
|
+
for val, row, row_name in sort_list:
|
115
|
+
self.data.append(row)
|
116
|
+
self.row_names.append(row_name)
|
117
|
+
|
118
|
+
def groupby(self, colname, *others):
|
119
|
+
"""builds indexes of data
|
120
|
+
:returns: nested dictionaries pointing to actual rows
|
121
|
+
"""
|
122
|
+
groups = {}
|
123
|
+
colnames = (colname,) + others
|
124
|
+
col_indexes = [self.col_names.index(col_id) for col_id in colnames]
|
125
|
+
for row in self.data:
|
126
|
+
ptr = groups
|
127
|
+
for col_index in col_indexes[:-1]:
|
128
|
+
ptr = ptr.setdefault(row[col_index], {})
|
129
|
+
ptr = ptr.setdefault(row[col_indexes[-1]],
|
130
|
+
Table(default_value=self.default_value,
|
131
|
+
col_names=self.col_names))
|
132
|
+
ptr.append_row(tuple(row))
|
133
|
+
return groups
|
134
|
+
|
135
|
+
def select(self, colname, value):
|
136
|
+
grouped = self.groupby(colname)
|
137
|
+
try:
|
138
|
+
return grouped[value]
|
139
|
+
except KeyError:
|
140
|
+
return []
|
141
|
+
|
142
|
+
def remove(self, colname, value):
|
143
|
+
col_index = self.col_names.index(colname)
|
144
|
+
for row in self.data[:]:
|
145
|
+
if row[col_index] == value:
|
146
|
+
self.data.remove(row)
|
147
|
+
|
148
|
+
|
149
|
+
## The 'setter' part #######################################################
|
150
|
+
def set_cell(self, row_index, col_index, data):
|
151
|
+
"""sets value of cell 'row_indew', 'col_index' to data
|
152
|
+
"""
|
153
|
+
self.data[row_index][col_index] = data
|
154
|
+
|
155
|
+
|
156
|
+
def set_cell_by_ids(self, row_id, col_id, data):
|
157
|
+
"""sets value of cell mapped by row_id and col_id to data
|
158
|
+
Raises a KeyError if row_id or col_id are not found in the table
|
159
|
+
"""
|
160
|
+
try:
|
161
|
+
row_index = self.row_names.index(row_id)
|
162
|
+
except ValueError:
|
163
|
+
raise KeyError("Row (%s) not found in table" % (row_id))
|
164
|
+
else:
|
165
|
+
try:
|
166
|
+
col_index = self.col_names.index(col_id)
|
167
|
+
self.data[row_index][col_index] = data
|
168
|
+
except ValueError:
|
169
|
+
raise KeyError("Column (%s) not found in table" % (col_id))
|
170
|
+
|
171
|
+
|
172
|
+
def set_row(self, row_index, row_data):
|
173
|
+
"""sets the 'row_index' row
|
174
|
+
pre:
|
175
|
+
type(row_data) == types.ListType
|
176
|
+
len(row_data) == len(self.col_names)
|
177
|
+
"""
|
178
|
+
self.data[row_index] = row_data
|
179
|
+
|
180
|
+
|
181
|
+
def set_row_by_id(self, row_id, row_data):
|
182
|
+
"""sets the 'row_id' column
|
183
|
+
pre:
|
184
|
+
type(row_data) == types.ListType
|
185
|
+
len(row_data) == len(self.row_names)
|
186
|
+
Raises a KeyError if row_id is not found
|
187
|
+
"""
|
188
|
+
try:
|
189
|
+
row_index = self.row_names.index(row_id)
|
190
|
+
self.set_row(row_index, row_data)
|
191
|
+
except ValueError:
|
192
|
+
raise KeyError('Row (%s) not found in table' % (row_id))
|
193
|
+
|
194
|
+
|
195
|
+
def append_row(self, row_data, row_name=None):
|
196
|
+
"""Appends a row to the table
|
197
|
+
pre:
|
198
|
+
type(row_data) == types.ListType
|
199
|
+
len(row_data) == len(self.col_names)
|
200
|
+
"""
|
201
|
+
row_name = row_name or self._next_row_name()
|
202
|
+
self.row_names.append(row_name)
|
203
|
+
self.data.append(row_data)
|
204
|
+
return len(self.data) - 1
|
205
|
+
|
206
|
+
def insert_row(self, index, row_data, row_name=None):
|
207
|
+
"""Appends row_data before 'index' in the table. To make 'insert'
|
208
|
+
behave like 'list.insert', inserting in an out of range index will
|
209
|
+
insert row_data to the end of the list
|
210
|
+
pre:
|
211
|
+
type(row_data) == types.ListType
|
212
|
+
len(row_data) == len(self.col_names)
|
213
|
+
"""
|
214
|
+
row_name = row_name or self._next_row_name()
|
215
|
+
self.row_names.insert(index, row_name)
|
216
|
+
self.data.insert(index, row_data)
|
217
|
+
|
218
|
+
|
219
|
+
def delete_row(self, index):
|
220
|
+
"""Deletes the 'index' row in the table, and returns it.
|
221
|
+
Raises an IndexError if index is out of range
|
222
|
+
"""
|
223
|
+
self.row_names.pop(index)
|
224
|
+
return self.data.pop(index)
|
225
|
+
|
226
|
+
|
227
|
+
def delete_row_by_id(self, row_id):
|
228
|
+
"""Deletes the 'row_id' row in the table.
|
229
|
+
Raises a KeyError if row_id was not found.
|
230
|
+
"""
|
231
|
+
try:
|
232
|
+
row_index = self.row_names.index(row_id)
|
233
|
+
self.delete_row(row_index)
|
234
|
+
except ValueError:
|
235
|
+
raise KeyError('Row (%s) not found in table' % (row_id))
|
236
|
+
|
237
|
+
|
238
|
+
def set_column(self, col_index, col_data):
|
239
|
+
"""sets the 'col_index' column
|
240
|
+
pre:
|
241
|
+
type(col_data) == types.ListType
|
242
|
+
len(col_data) == len(self.row_names)
|
243
|
+
"""
|
244
|
+
|
245
|
+
for row_index, cell_data in enumerate(col_data):
|
246
|
+
self.data[row_index][col_index] = cell_data
|
247
|
+
|
248
|
+
|
249
|
+
def set_column_by_id(self, col_id, col_data):
|
250
|
+
"""sets the 'col_id' column
|
251
|
+
pre:
|
252
|
+
type(col_data) == types.ListType
|
253
|
+
len(col_data) == len(self.col_names)
|
254
|
+
Raises a KeyError if col_id is not found
|
255
|
+
"""
|
256
|
+
try:
|
257
|
+
col_index = self.col_names.index(col_id)
|
258
|
+
self.set_column(col_index, col_data)
|
259
|
+
except ValueError:
|
260
|
+
raise KeyError('Column (%s) not found in table' % (col_id))
|
261
|
+
|
262
|
+
|
263
|
+
def append_column(self, col_data, col_name):
|
264
|
+
"""Appends the 'col_index' column
|
265
|
+
pre:
|
266
|
+
type(col_data) == types.ListType
|
267
|
+
len(col_data) == len(self.row_names)
|
268
|
+
"""
|
269
|
+
self.col_names.append(col_name)
|
270
|
+
for row_index, cell_data in enumerate(col_data):
|
271
|
+
self.data[row_index].append(cell_data)
|
272
|
+
|
273
|
+
|
274
|
+
def insert_column(self, index, col_data, col_name):
|
275
|
+
"""Appends col_data before 'index' in the table. To make 'insert'
|
276
|
+
behave like 'list.insert', inserting in an out of range index will
|
277
|
+
insert col_data to the end of the list
|
278
|
+
pre:
|
279
|
+
type(col_data) == types.ListType
|
280
|
+
len(col_data) == len(self.row_names)
|
281
|
+
"""
|
282
|
+
self.col_names.insert(index, col_name)
|
283
|
+
for row_index, cell_data in enumerate(col_data):
|
284
|
+
self.data[row_index].insert(index, cell_data)
|
285
|
+
|
286
|
+
|
287
|
+
def delete_column(self, index):
|
288
|
+
"""Deletes the 'index' column in the table, and returns it.
|
289
|
+
Raises an IndexError if index is out of range
|
290
|
+
"""
|
291
|
+
self.col_names.pop(index)
|
292
|
+
return [row.pop(index) for row in self.data]
|
293
|
+
|
294
|
+
|
295
|
+
def delete_column_by_id(self, col_id):
|
296
|
+
"""Deletes the 'col_id' col in the table.
|
297
|
+
Raises a KeyError if col_id was not found.
|
298
|
+
"""
|
299
|
+
try:
|
300
|
+
col_index = self.col_names.index(col_id)
|
301
|
+
self.delete_column(col_index)
|
302
|
+
except ValueError:
|
303
|
+
raise KeyError('Column (%s) not found in table' % (col_id))
|
304
|
+
|
305
|
+
|
306
|
+
## The 'getter' part #######################################################
|
307
|
+
|
308
|
+
def get_shape(self):
|
309
|
+
"""Returns a tuple which represents the table's shape
|
310
|
+
"""
|
311
|
+
return len(self.row_names), len(self.col_names)
|
312
|
+
shape = property(get_shape)
|
313
|
+
|
314
|
+
def __getitem__(self, indices):
|
315
|
+
"""provided for convenience"""
|
316
|
+
rows, multirows = None, False
|
317
|
+
cols, multicols = None, False
|
318
|
+
if isinstance(indices, tuple):
|
319
|
+
rows = indices[0]
|
320
|
+
if len(indices) > 1:
|
321
|
+
cols = indices[1]
|
322
|
+
else:
|
323
|
+
rows = indices
|
324
|
+
# define row slice
|
325
|
+
if isinstance(rows, str):
|
326
|
+
try:
|
327
|
+
rows = self.row_names.index(rows)
|
328
|
+
except ValueError:
|
329
|
+
raise KeyError("Row (%s) not found in table" % (rows))
|
330
|
+
if isinstance(rows, int):
|
331
|
+
rows = slice(rows, rows+1)
|
332
|
+
multirows = False
|
333
|
+
else:
|
334
|
+
rows = slice(None)
|
335
|
+
multirows = True
|
336
|
+
# define col slice
|
337
|
+
if isinstance(cols, str):
|
338
|
+
try:
|
339
|
+
cols = self.col_names.index(cols)
|
340
|
+
except ValueError:
|
341
|
+
raise KeyError("Column (%s) not found in table" % (cols))
|
342
|
+
if isinstance(cols, int):
|
343
|
+
cols = slice(cols, cols+1)
|
344
|
+
multicols = False
|
345
|
+
else:
|
346
|
+
cols = slice(None)
|
347
|
+
multicols = True
|
348
|
+
# get sub-table
|
349
|
+
tab = Table()
|
350
|
+
tab.default_value = self.default_value
|
351
|
+
tab.create_rows(self.row_names[rows])
|
352
|
+
tab.create_columns(self.col_names[cols])
|
353
|
+
for idx, row in enumerate(self.data[rows]):
|
354
|
+
tab.set_row(idx, row[cols])
|
355
|
+
if multirows :
|
356
|
+
if multicols:
|
357
|
+
return tab
|
358
|
+
else:
|
359
|
+
return [item[0] for item in tab.data]
|
360
|
+
else:
|
361
|
+
if multicols:
|
362
|
+
return tab.data[0]
|
363
|
+
else:
|
364
|
+
return tab.data[0][0]
|
365
|
+
|
366
|
+
def get_cell_by_ids(self, row_id, col_id):
|
367
|
+
"""Returns the element at [row_id][col_id]
|
368
|
+
"""
|
369
|
+
try:
|
370
|
+
row_index = self.row_names.index(row_id)
|
371
|
+
except ValueError:
|
372
|
+
raise KeyError("Row (%s) not found in table" % (row_id))
|
373
|
+
else:
|
374
|
+
try:
|
375
|
+
col_index = self.col_names.index(col_id)
|
376
|
+
except ValueError:
|
377
|
+
raise KeyError("Column (%s) not found in table" % (col_id))
|
378
|
+
return self.data[row_index][col_index]
|
379
|
+
|
380
|
+
def get_row_by_id(self, row_id):
|
381
|
+
"""Returns the 'row_id' row
|
382
|
+
"""
|
383
|
+
try:
|
384
|
+
row_index = self.row_names.index(row_id)
|
385
|
+
except ValueError:
|
386
|
+
raise KeyError("Row (%s) not found in table" % (row_id))
|
387
|
+
return self.data[row_index]
|
388
|
+
|
389
|
+
def get_column_by_id(self, col_id, distinct=False):
|
390
|
+
"""Returns the 'col_id' col
|
391
|
+
"""
|
392
|
+
try:
|
393
|
+
col_index = self.col_names.index(col_id)
|
394
|
+
except ValueError:
|
395
|
+
raise KeyError("Column (%s) not found in table" % (col_id))
|
396
|
+
return self.get_column(col_index, distinct)
|
397
|
+
|
398
|
+
def get_columns(self):
|
399
|
+
"""Returns all the columns in the table
|
400
|
+
"""
|
401
|
+
return [self[:, index] for index in range(len(self.col_names))]
|
402
|
+
|
403
|
+
def get_column(self, col_index, distinct=False):
|
404
|
+
"""get a column by index"""
|
405
|
+
col = [row[col_index] for row in self.data]
|
406
|
+
if distinct:
|
407
|
+
col = list(set(col))
|
408
|
+
return col
|
409
|
+
|
410
|
+
def apply_stylesheet(self, stylesheet):
|
411
|
+
"""Applies the stylesheet to this table
|
412
|
+
"""
|
413
|
+
for instruction in stylesheet.instructions:
|
414
|
+
eval(instruction)
|
415
|
+
|
416
|
+
|
417
|
+
def transpose(self):
|
418
|
+
"""Keeps the self object intact, and returns the transposed (rotated)
|
419
|
+
table.
|
420
|
+
"""
|
421
|
+
transposed = Table()
|
422
|
+
transposed.create_rows(self.col_names)
|
423
|
+
transposed.create_columns(self.row_names)
|
424
|
+
for col_index, column in enumerate(self.get_columns()):
|
425
|
+
transposed.set_row(col_index, column)
|
426
|
+
return transposed
|
427
|
+
|
428
|
+
|
429
|
+
def pprint(self):
|
430
|
+
"""returns a string representing the table in a pretty
|
431
|
+
printed 'text' format.
|
432
|
+
"""
|
433
|
+
# The maximum row name (to know the start_index of the first col)
|
434
|
+
max_row_name = 0
|
435
|
+
for row_name in self.row_names:
|
436
|
+
if len(row_name) > max_row_name:
|
437
|
+
max_row_name = len(row_name)
|
438
|
+
col_start = max_row_name + 5
|
439
|
+
|
440
|
+
lines = []
|
441
|
+
# Build the 'first' line <=> the col_names one
|
442
|
+
# The first cell <=> an empty one
|
443
|
+
col_names_line = [' '*col_start]
|
444
|
+
for col_name in self.col_names:
|
445
|
+
col_names_line.append(col_name + ' '*5)
|
446
|
+
lines.append('|' + '|'.join(col_names_line) + '|')
|
447
|
+
max_line_length = len(lines[0])
|
448
|
+
|
449
|
+
# Build the table
|
450
|
+
for row_index, row in enumerate(self.data):
|
451
|
+
line = []
|
452
|
+
# First, build the row_name's cell
|
453
|
+
row_name = self.row_names[row_index]
|
454
|
+
line.append(row_name + ' '*(col_start-len(row_name)))
|
455
|
+
|
456
|
+
# Then, build all the table's cell for this line.
|
457
|
+
for col_index, cell in enumerate(row):
|
458
|
+
col_name_length = len(self.col_names[col_index]) + 5
|
459
|
+
data = str(cell)
|
460
|
+
line.append(data + ' '*(col_name_length - len(data)))
|
461
|
+
lines.append('|' + '|'.join(line) + '|')
|
462
|
+
if len(lines[-1]) > max_line_length:
|
463
|
+
max_line_length = len(lines[-1])
|
464
|
+
|
465
|
+
# Wrap the table with '-' to make a frame
|
466
|
+
lines.insert(0, '-'*max_line_length)
|
467
|
+
lines.append('-'*max_line_length)
|
468
|
+
return '\n'.join(lines)
|
469
|
+
|
470
|
+
|
471
|
+
def __repr__(self):
|
472
|
+
return repr(self.data)
|
473
|
+
|
474
|
+
def as_text(self):
|
475
|
+
data = []
|
476
|
+
# We must convert cells into strings before joining them
|
477
|
+
for row in self.data:
|
478
|
+
data.append([str(cell) for cell in row])
|
479
|
+
lines = ['\t'.join(row) for row in data]
|
480
|
+
return '\n'.join(lines)
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
class TableStyle:
|
485
|
+
"""Defines a table's style
|
486
|
+
"""
|
487
|
+
|
488
|
+
def __init__(self, table):
|
489
|
+
|
490
|
+
self._table = table
|
491
|
+
self.size = dict([(col_name, '1*') for col_name in table.col_names])
|
492
|
+
# __row_column__ is a special key to define the first column which
|
493
|
+
# actually has no name (<=> left most column <=> row names column)
|
494
|
+
self.size['__row_column__'] = '1*'
|
495
|
+
self.alignment = dict([(col_name, 'right')
|
496
|
+
for col_name in table.col_names])
|
497
|
+
self.alignment['__row_column__'] = 'right'
|
498
|
+
|
499
|
+
# We shouldn't have to create an entry for
|
500
|
+
# the 1st col (the row_column one)
|
501
|
+
self.units = dict([(col_name, '') for col_name in table.col_names])
|
502
|
+
self.units['__row_column__'] = ''
|
503
|
+
|
504
|
+
# XXX FIXME : params order should be reversed for all set() methods
|
505
|
+
def set_size(self, value, col_id):
|
506
|
+
"""sets the size of the specified col_id to value
|
507
|
+
"""
|
508
|
+
self.size[col_id] = value
|
509
|
+
|
510
|
+
def set_size_by_index(self, value, col_index):
|
511
|
+
"""Allows to set the size according to the column index rather than
|
512
|
+
using the column's id.
|
513
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
514
|
+
"""
|
515
|
+
if col_index == 0:
|
516
|
+
col_id = '__row_column__'
|
517
|
+
else:
|
518
|
+
col_id = self._table.col_names[col_index-1]
|
519
|
+
|
520
|
+
self.size[col_id] = value
|
521
|
+
|
522
|
+
|
523
|
+
def set_alignment(self, value, col_id):
|
524
|
+
"""sets the alignment of the specified col_id to value
|
525
|
+
"""
|
526
|
+
self.alignment[col_id] = value
|
527
|
+
|
528
|
+
|
529
|
+
def set_alignment_by_index(self, value, col_index):
|
530
|
+
"""Allows to set the alignment according to the column index rather than
|
531
|
+
using the column's id.
|
532
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
533
|
+
"""
|
534
|
+
if col_index == 0:
|
535
|
+
col_id = '__row_column__'
|
536
|
+
else:
|
537
|
+
col_id = self._table.col_names[col_index-1]
|
538
|
+
|
539
|
+
self.alignment[col_id] = value
|
540
|
+
|
541
|
+
|
542
|
+
def set_unit(self, value, col_id):
|
543
|
+
"""sets the unit of the specified col_id to value
|
544
|
+
"""
|
545
|
+
self.units[col_id] = value
|
546
|
+
|
547
|
+
|
548
|
+
def set_unit_by_index(self, value, col_index):
|
549
|
+
"""Allows to set the unit according to the column index rather than
|
550
|
+
using the column's id.
|
551
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
552
|
+
(Note that in the 'unit' case, you shouldn't have to set a unit
|
553
|
+
for the 1st column (the __row__column__ one))
|
554
|
+
"""
|
555
|
+
if col_index == 0:
|
556
|
+
col_id = '__row_column__'
|
557
|
+
else:
|
558
|
+
col_id = self._table.col_names[col_index-1]
|
559
|
+
|
560
|
+
self.units[col_id] = value
|
561
|
+
|
562
|
+
|
563
|
+
def get_size(self, col_id):
|
564
|
+
"""Returns the size of the specified col_id
|
565
|
+
"""
|
566
|
+
return self.size[col_id]
|
567
|
+
|
568
|
+
|
569
|
+
def get_size_by_index(self, col_index):
|
570
|
+
"""Allows to get the size according to the column index rather than
|
571
|
+
using the column's id.
|
572
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
573
|
+
"""
|
574
|
+
if col_index == 0:
|
575
|
+
col_id = '__row_column__'
|
576
|
+
else:
|
577
|
+
col_id = self._table.col_names[col_index-1]
|
578
|
+
|
579
|
+
return self.size[col_id]
|
580
|
+
|
581
|
+
|
582
|
+
def get_alignment(self, col_id):
|
583
|
+
"""Returns the alignment of the specified col_id
|
584
|
+
"""
|
585
|
+
return self.alignment[col_id]
|
586
|
+
|
587
|
+
|
588
|
+
def get_alignment_by_index(self, col_index):
|
589
|
+
"""Allors to get the alignment according to the column index rather than
|
590
|
+
using the column's id.
|
591
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
592
|
+
"""
|
593
|
+
if col_index == 0:
|
594
|
+
col_id = '__row_column__'
|
595
|
+
else:
|
596
|
+
col_id = self._table.col_names[col_index-1]
|
597
|
+
|
598
|
+
return self.alignment[col_id]
|
599
|
+
|
600
|
+
|
601
|
+
def get_unit(self, col_id):
|
602
|
+
"""Returns the unit of the specified col_id
|
603
|
+
"""
|
604
|
+
return self.units[col_id]
|
605
|
+
|
606
|
+
|
607
|
+
def get_unit_by_index(self, col_index):
|
608
|
+
"""Allors to get the unit according to the column index rather than
|
609
|
+
using the column's id.
|
610
|
+
BE CAREFUL : the '0' column is the '__row_column__' one !
|
611
|
+
"""
|
612
|
+
if col_index == 0:
|
613
|
+
col_id = '__row_column__'
|
614
|
+
else:
|
615
|
+
col_id = self._table.col_names[col_index-1]
|
616
|
+
|
617
|
+
return self.units[col_id]
|
618
|
+
|
619
|
+
|
620
|
+
import re
|
621
|
+
CELL_PROG = re.compile("([0-9]+)_([0-9]+)")
|
622
|
+
|
623
|
+
class TableStyleSheet:
|
624
|
+
"""A simple Table stylesheet
|
625
|
+
Rules are expressions where cells are defined by the row_index
|
626
|
+
and col_index separated by an underscore ('_').
|
627
|
+
For example, suppose you want to say that the (2,5) cell must be
|
628
|
+
the sum of its two preceding cells in the row, you would create
|
629
|
+
the following rule :
|
630
|
+
2_5 = 2_3 + 2_4
|
631
|
+
You can also use all the math.* operations you want. For example:
|
632
|
+
2_5 = sqrt(2_3**2 + 2_4**2)
|
633
|
+
"""
|
634
|
+
|
635
|
+
def __init__(self, rules = None):
|
636
|
+
rules = rules or []
|
637
|
+
self.rules = []
|
638
|
+
self.instructions = []
|
639
|
+
for rule in rules:
|
640
|
+
self.add_rule(rule)
|
641
|
+
|
642
|
+
|
643
|
+
def add_rule(self, rule):
|
644
|
+
"""Adds a rule to the stylesheet rules
|
645
|
+
"""
|
646
|
+
try:
|
647
|
+
source_code = ['from math import *']
|
648
|
+
source_code.append(CELL_PROG.sub(r'self.data[\1][\2]', rule))
|
649
|
+
self.instructions.append(compile('\n'.join(source_code),
|
650
|
+
'table.py', 'exec'))
|
651
|
+
self.rules.append(rule)
|
652
|
+
except SyntaxError:
|
653
|
+
print "Bad Stylesheet Rule : %s [skipped]"%rule
|
654
|
+
|
655
|
+
|
656
|
+
def add_rowsum_rule(self, dest_cell, row_index, start_col, end_col):
|
657
|
+
"""Creates and adds a rule to sum over the row at row_index from
|
658
|
+
start_col to end_col.
|
659
|
+
dest_cell is a tuple of two elements (x,y) of the destination cell
|
660
|
+
No check is done for indexes ranges.
|
661
|
+
pre:
|
662
|
+
start_col >= 0
|
663
|
+
end_col > start_col
|
664
|
+
"""
|
665
|
+
cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
|
666
|
+
end_col + 1)]
|
667
|
+
rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
|
668
|
+
self.add_rule(rule)
|
669
|
+
|
670
|
+
|
671
|
+
def add_rowavg_rule(self, dest_cell, row_index, start_col, end_col):
|
672
|
+
"""Creates and adds a rule to make the row average (from start_col
|
673
|
+
to end_col)
|
674
|
+
dest_cell is a tuple of two elements (x,y) of the destination cell
|
675
|
+
No check is done for indexes ranges.
|
676
|
+
pre:
|
677
|
+
start_col >= 0
|
678
|
+
end_col > start_col
|
679
|
+
"""
|
680
|
+
cell_list = ['%d_%d'%(row_index, index) for index in range(start_col,
|
681
|
+
end_col + 1)]
|
682
|
+
num = (end_col - start_col + 1)
|
683
|
+
rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
|
684
|
+
self.add_rule(rule)
|
685
|
+
|
686
|
+
|
687
|
+
def add_colsum_rule(self, dest_cell, col_index, start_row, end_row):
|
688
|
+
"""Creates and adds a rule to sum over the col at col_index from
|
689
|
+
start_row to end_row.
|
690
|
+
dest_cell is a tuple of two elements (x,y) of the destination cell
|
691
|
+
No check is done for indexes ranges.
|
692
|
+
pre:
|
693
|
+
start_row >= 0
|
694
|
+
end_row > start_row
|
695
|
+
"""
|
696
|
+
cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
|
697
|
+
end_row + 1)]
|
698
|
+
rule = '%d_%d=' % dest_cell + '+'.join(cell_list)
|
699
|
+
self.add_rule(rule)
|
700
|
+
|
701
|
+
|
702
|
+
def add_colavg_rule(self, dest_cell, col_index, start_row, end_row):
|
703
|
+
"""Creates and adds a rule to make the col average (from start_row
|
704
|
+
to end_row)
|
705
|
+
dest_cell is a tuple of two elements (x,y) of the destination cell
|
706
|
+
No check is done for indexes ranges.
|
707
|
+
pre:
|
708
|
+
start_row >= 0
|
709
|
+
end_row > start_row
|
710
|
+
"""
|
711
|
+
cell_list = ['%d_%d'%(index, col_index) for index in range(start_row,
|
712
|
+
end_row + 1)]
|
713
|
+
num = (end_row - start_row + 1)
|
714
|
+
rule = '%d_%d=' % dest_cell + '('+'+'.join(cell_list)+')/%f'%num
|
715
|
+
self.add_rule(rule)
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
class TableCellRenderer:
|
720
|
+
"""Defines a simple text renderer
|
721
|
+
"""
|
722
|
+
|
723
|
+
def __init__(self, **properties):
|
724
|
+
"""keywords should be properties with an associated boolean as value.
|
725
|
+
For example :
|
726
|
+
renderer = TableCellRenderer(units = True, alignment = False)
|
727
|
+
An unspecified property will have a 'False' value by default.
|
728
|
+
Possible properties are :
|
729
|
+
alignment, unit
|
730
|
+
"""
|
731
|
+
self.properties = properties
|
732
|
+
|
733
|
+
|
734
|
+
def render_cell(self, cell_coord, table, table_style):
|
735
|
+
"""Renders the cell at 'cell_coord' in the table, using table_style
|
736
|
+
"""
|
737
|
+
row_index, col_index = cell_coord
|
738
|
+
cell_value = table.data[row_index][col_index]
|
739
|
+
final_content = self._make_cell_content(cell_value,
|
740
|
+
table_style, col_index +1)
|
741
|
+
return self._render_cell_content(final_content,
|
742
|
+
table_style, col_index + 1)
|
743
|
+
|
744
|
+
|
745
|
+
def render_row_cell(self, row_name, table, table_style):
|
746
|
+
"""Renders the cell for 'row_id' row
|
747
|
+
"""
|
748
|
+
cell_value = row_name
|
749
|
+
return self._render_cell_content(cell_value, table_style, 0)
|
750
|
+
|
751
|
+
|
752
|
+
def render_col_cell(self, col_name, table, table_style):
|
753
|
+
"""Renders the cell for 'col_id' row
|
754
|
+
"""
|
755
|
+
cell_value = col_name
|
756
|
+
col_index = table.col_names.index(col_name)
|
757
|
+
return self._render_cell_content(cell_value, table_style, col_index +1)
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
def _render_cell_content(self, content, table_style, col_index):
|
762
|
+
"""Makes the appropriate rendering for this cell content.
|
763
|
+
Rendering properties will be searched using the
|
764
|
+
*table_style.get_xxx_by_index(col_index)' methods
|
765
|
+
|
766
|
+
**This method should be overridden in the derived renderer classes.**
|
767
|
+
"""
|
768
|
+
return content
|
769
|
+
|
770
|
+
|
771
|
+
def _make_cell_content(self, cell_content, table_style, col_index):
|
772
|
+
"""Makes the cell content (adds decoration data, like units for
|
773
|
+
example)
|
774
|
+
"""
|
775
|
+
final_content = cell_content
|
776
|
+
if 'skip_zero' in self.properties:
|
777
|
+
replacement_char = self.properties['skip_zero']
|
778
|
+
else:
|
779
|
+
replacement_char = 0
|
780
|
+
if replacement_char and final_content == 0:
|
781
|
+
return replacement_char
|
782
|
+
|
783
|
+
try:
|
784
|
+
units_on = self.properties['units']
|
785
|
+
if units_on:
|
786
|
+
final_content = self._add_unit(
|
787
|
+
cell_content, table_style, col_index)
|
788
|
+
except KeyError:
|
789
|
+
pass
|
790
|
+
|
791
|
+
return final_content
|
792
|
+
|
793
|
+
|
794
|
+
def _add_unit(self, cell_content, table_style, col_index):
|
795
|
+
"""Adds unit to the cell_content if needed
|
796
|
+
"""
|
797
|
+
unit = table_style.get_unit_by_index(col_index)
|
798
|
+
return str(cell_content) + " " + unit
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
class DocbookRenderer(TableCellRenderer):
|
803
|
+
"""Defines how to render a cell for a docboook table
|
804
|
+
"""
|
805
|
+
|
806
|
+
def define_col_header(self, col_index, table_style):
|
807
|
+
"""Computes the colspec element according to the style
|
808
|
+
"""
|
809
|
+
size = table_style.get_size_by_index(col_index)
|
810
|
+
return '<colspec colname="c%d" colwidth="%s"/>\n' % \
|
811
|
+
(col_index, size)
|
812
|
+
|
813
|
+
|
814
|
+
def _render_cell_content(self, cell_content, table_style, col_index):
|
815
|
+
"""Makes the appropriate rendering for this cell content.
|
816
|
+
Rendering properties will be searched using the
|
817
|
+
table_style.get_xxx_by_index(col_index)' methods.
|
818
|
+
"""
|
819
|
+
try:
|
820
|
+
align_on = self.properties['alignment']
|
821
|
+
alignment = table_style.get_alignment_by_index(col_index)
|
822
|
+
if align_on:
|
823
|
+
return "<entry align='%s'>%s</entry>\n" % \
|
824
|
+
(alignment, cell_content)
|
825
|
+
except KeyError:
|
826
|
+
# KeyError <=> Default alignment
|
827
|
+
return "<entry>%s</entry>\n" % cell_content
|
828
|
+
|
829
|
+
|
830
|
+
class TableWriter:
|
831
|
+
"""A class to write tables
|
832
|
+
"""
|
833
|
+
|
834
|
+
def __init__(self, stream, table, style, **properties):
|
835
|
+
self._stream = stream
|
836
|
+
self.style = style or TableStyle(table)
|
837
|
+
self._table = table
|
838
|
+
self.properties = properties
|
839
|
+
self.renderer = None
|
840
|
+
|
841
|
+
|
842
|
+
def set_style(self, style):
|
843
|
+
"""sets the table's associated style
|
844
|
+
"""
|
845
|
+
self.style = style
|
846
|
+
|
847
|
+
|
848
|
+
def set_renderer(self, renderer):
|
849
|
+
"""sets the way to render cell
|
850
|
+
"""
|
851
|
+
self.renderer = renderer
|
852
|
+
|
853
|
+
|
854
|
+
def update_properties(self, **properties):
|
855
|
+
"""Updates writer's properties (for cell rendering)
|
856
|
+
"""
|
857
|
+
self.properties.update(properties)
|
858
|
+
|
859
|
+
|
860
|
+
def write_table(self, title = ""):
|
861
|
+
"""Writes the table
|
862
|
+
"""
|
863
|
+
raise NotImplementedError("write_table must be implemented !")
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
class DocbookTableWriter(TableWriter):
|
868
|
+
"""Defines an implementation of TableWriter to write a table in Docbook
|
869
|
+
"""
|
870
|
+
|
871
|
+
def _write_headers(self):
|
872
|
+
"""Writes col headers
|
873
|
+
"""
|
874
|
+
# Define col_headers (colstpec elements)
|
875
|
+
for col_index in range(len(self._table.col_names)+1):
|
876
|
+
self._stream.write(self.renderer.define_col_header(col_index,
|
877
|
+
self.style))
|
878
|
+
|
879
|
+
self._stream.write("<thead>\n<row>\n")
|
880
|
+
# XXX FIXME : write an empty entry <=> the first (__row_column) column
|
881
|
+
self._stream.write('<entry></entry>\n')
|
882
|
+
for col_name in self._table.col_names:
|
883
|
+
self._stream.write(self.renderer.render_col_cell(
|
884
|
+
col_name, self._table,
|
885
|
+
self.style))
|
886
|
+
|
887
|
+
self._stream.write("</row>\n</thead>\n")
|
888
|
+
|
889
|
+
|
890
|
+
def _write_body(self):
|
891
|
+
"""Writes the table body
|
892
|
+
"""
|
893
|
+
self._stream.write('<tbody>\n')
|
894
|
+
|
895
|
+
for row_index, row in enumerate(self._table.data):
|
896
|
+
self._stream.write('<row>\n')
|
897
|
+
row_name = self._table.row_names[row_index]
|
898
|
+
# Write the first entry (row_name)
|
899
|
+
self._stream.write(self.renderer.render_row_cell(row_name,
|
900
|
+
self._table,
|
901
|
+
self.style))
|
902
|
+
|
903
|
+
for col_index, cell in enumerate(row):
|
904
|
+
self._stream.write(self.renderer.render_cell(
|
905
|
+
(row_index, col_index),
|
906
|
+
self._table, self.style))
|
907
|
+
|
908
|
+
self._stream.write('</row>\n')
|
909
|
+
|
910
|
+
self._stream.write('</tbody>\n')
|
911
|
+
|
912
|
+
|
913
|
+
def write_table(self, title = ""):
|
914
|
+
"""Writes the table
|
915
|
+
"""
|
916
|
+
self._stream.write('<table>\n<title>%s></title>\n'%(title))
|
917
|
+
self._stream.write(
|
918
|
+
'<tgroup cols="%d" align="left" colsep="1" rowsep="1">\n'%
|
919
|
+
(len(self._table.col_names)+1))
|
920
|
+
self._write_headers()
|
921
|
+
self._write_body()
|
922
|
+
|
923
|
+
self._stream.write('</tgroup>\n</table>\n')
|
924
|
+
|
925
|
+
|