bee_python 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{build/README → README} +1 -1
- data/egg/egg/build.yml +11 -49
- data/egg/egg.yml +19 -27
- data/egg/http/build.erb +32 -36
- data/egg/http/libhttp.py +102 -0
- data/egg/http/pylint.cfg +236 -0
- data/egg/http/server.py +7 -0
- data/egg/http/test.erb +32 -0
- data/egg/http.yml +33 -29
- data/egg/mysql/mysql.py +8 -9
- data/egg/project/build.erb +21 -53
- data/egg/project/pylint.cfg +236 -0
- data/egg/project/test.py +2 -2
- data/egg/project.yml +23 -31
- data/egg/script/build.erb +18 -23
- data/egg/script/pylint.cfg +236 -0
- data/egg/script.yml +22 -18
- data/egg/source/source.py +6 -6
- data/egg/test/test.py +1 -1
- data/lib/bee_task_python.rb +3 -34
- data/python.yml +123 -0
- metadata +61 -503
- data/test/build.yml +0 -16
- data/test/tc_bee_task_python.rb +0 -27
- data/test/test_build.rb +0 -26
- data/test/test_build_listener.rb +0 -110
- data/test/ts_bee_python.rb +0 -26
- data/tools/common/__init__.py +0 -5
- data/tools/common/common/__init__.py +0 -140
- data/tools/common/common/__pkginfo__.py +0 -43
- data/tools/common/common/adbh.py +0 -35
- data/tools/common/common/cache.py +0 -114
- data/tools/common/common/changelog.py +0 -234
- data/tools/common/common/clcommands.py +0 -181
- data/tools/common/common/cli.py +0 -212
- data/tools/common/common/compat.py +0 -328
- data/tools/common/common/configuration.py +0 -1087
- data/tools/common/common/contexts.py +0 -58
- data/tools/common/common/corbautils.py +0 -117
- data/tools/common/common/daemon.py +0 -171
- data/tools/common/common/date.py +0 -279
- data/tools/common/common/db.py +0 -49
- data/tools/common/common/dbf.py +0 -229
- data/tools/common/common/debugger.py +0 -208
- data/tools/common/common/decorators.py +0 -190
- data/tools/common/common/deprecation.py +0 -118
- data/tools/common/common/fileutils.py +0 -409
- data/tools/common/common/graph.py +0 -259
- data/tools/common/common/html.py +0 -142
- data/tools/common/common/interface.py +0 -76
- data/tools/common/common/logging_ext.py +0 -166
- data/tools/common/common/modutils.py +0 -670
- data/tools/common/common/optik_ext.py +0 -383
- data/tools/common/common/optparser.py +0 -92
- data/tools/common/common/pdf_ext.py +0 -111
- data/tools/common/common/proc.py +0 -276
- data/tools/common/common/pyro_ext.py +0 -146
- data/tools/common/common/pytest.py +0 -754
- data/tools/common/common/shellutils.py +0 -383
- data/tools/common/common/sphinx_ext.py +0 -87
- data/tools/common/common/sphinxutils.py +0 -122
- data/tools/common/common/sqlgen.py +0 -31
- data/tools/common/common/table.py +0 -930
- data/tools/common/common/tasksqueue.py +0 -97
- data/tools/common/common/test/__init__.py +0 -1
- data/tools/common/common/test/data/ChangeLog +0 -184
- data/tools/common/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/common/common/test/data/__init__.py +0 -1
- data/tools/common/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/content_differ_dir/README +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/file_differ_dir/README +0 -1
- data/tools/common/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/common/common/test/data/find_test/__init__.py +0 -0
- data/tools/common/common/test/data/find_test/foo.txt +0 -0
- data/tools/common/common/test/data/find_test/module.py +0 -0
- data/tools/common/common/test/data/find_test/module2.py +0 -0
- data/tools/common/common/test/data/find_test/newlines.txt +0 -0
- data/tools/common/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/common/common/test/data/find_test/nonregr.py +0 -0
- data/tools/common/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/common/common/test/data/find_test/spam.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/common/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/common/common/test/data/find_test/test.ini +0 -0
- data/tools/common/common/test/data/find_test/test1.msg +0 -0
- data/tools/common/common/test/data/find_test/test2.msg +0 -0
- data/tools/common/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/common/common/test/data/foo.txt +0 -9
- data/tools/common/common/test/data/module.py +0 -88
- data/tools/common/common/test/data/module2.py +0 -77
- data/tools/common/common/test/data/newlines.txt +0 -3
- data/tools/common/common/test/data/noendingnewline.py +0 -36
- data/tools/common/common/test/data/nonregr.py +0 -14
- data/tools/common/common/test/data/normal_file.txt +0 -0
- data/tools/common/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/common/common/test/data/reference_dir/README +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/same_dir/NOTHING +0 -0
- data/tools/common/common/test/data/same_dir/README +0 -1
- data/tools/common/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/spam.txt +0 -9
- data/tools/common/common/test/data/sub/doc.txt +0 -1
- data/tools/common/common/test/data/sub/momo.py +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/common/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/common/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/common/common/test/data/test.ini +0 -20
- data/tools/common/common/test/data/test1.msg +0 -30
- data/tools/common/common/test/data/test2.msg +0 -42
- data/tools/common/common/test/data/write_protected_file.txt +0 -0
- data/tools/common/common/test/foomod.py +0 -17
- data/tools/common/common/test/unittest_cache.py +0 -129
- data/tools/common/common/test/unittest_changelog.py +0 -37
- data/tools/common/common/test/unittest_compat.py +0 -239
- data/tools/common/common/test/unittest_configuration.py +0 -348
- data/tools/common/common/test/unittest_date.py +0 -154
- data/tools/common/common/test/unittest_decorators.py +0 -62
- data/tools/common/common/test/unittest_deprecation.py +0 -76
- data/tools/common/common/test/unittest_fileutils.py +0 -133
- data/tools/common/common/test/unittest_graph.py +0 -50
- data/tools/common/common/test/unittest_html.py +0 -76
- data/tools/common/common/test/unittest_interface.py +0 -87
- data/tools/common/common/test/unittest_modutils.py +0 -244
- data/tools/common/common/test/unittest_pytest.py +0 -50
- data/tools/common/common/test/unittest_shellutils.py +0 -248
- data/tools/common/common/test/unittest_table.py +0 -448
- data/tools/common/common/test/unittest_taskqueue.py +0 -71
- data/tools/common/common/test/unittest_testlib.py +0 -956
- data/tools/common/common/test/unittest_textutils.py +0 -247
- data/tools/common/common/test/unittest_tree.py +0 -248
- data/tools/common/common/test/unittest_umessage.py +0 -55
- data/tools/common/common/test/unittest_ureports_html.py +0 -64
- data/tools/common/common/test/unittest_ureports_text.py +0 -105
- data/tools/common/common/test/unittest_xmlutils.py +0 -75
- data/tools/common/common/test/utils.py +0 -87
- data/tools/common/common/testlib.py +0 -1927
- data/tools/common/common/textutils.py +0 -476
- data/tools/common/common/tree.py +0 -372
- data/tools/common/common/umessage.py +0 -161
- data/tools/common/common/ureports/__init__.py +0 -174
- data/tools/common/common/ureports/docbook_writer.py +0 -139
- data/tools/common/common/ureports/html_writer.py +0 -131
- data/tools/common/common/ureports/nodes.py +0 -201
- data/tools/common/common/ureports/text_writer.py +0 -140
- data/tools/common/common/vcgutils.py +0 -216
- data/tools/common/common/visitor.py +0 -107
- data/tools/common/common/xmlrpcutils.py +0 -136
- data/tools/common/common/xmlutils.py +0 -61
- data/tools/coverage/coverage.py +0 -602
- data/tools/epydoc/__init__.py +0 -227
- data/tools/epydoc/__init__.pyc +0 -0
- data/tools/epydoc/apidoc.py +0 -2203
- data/tools/epydoc/apidoc.pyc +0 -0
- data/tools/epydoc/checker.py +0 -349
- data/tools/epydoc/checker.pyc +0 -0
- data/tools/epydoc/cli.py +0 -1470
- data/tools/epydoc/cli.pyc +0 -0
- data/tools/epydoc/compat.py +0 -250
- data/tools/epydoc/compat.pyc +0 -0
- data/tools/epydoc/docbuilder.py +0 -1358
- data/tools/epydoc/docbuilder.pyc +0 -0
- data/tools/epydoc/docintrospecter.py +0 -1056
- data/tools/epydoc/docintrospecter.pyc +0 -0
- data/tools/epydoc/docparser.py +0 -2113
- data/tools/epydoc/docparser.pyc +0 -0
- data/tools/epydoc/docstringparser.py +0 -1111
- data/tools/epydoc/docstringparser.pyc +0 -0
- data/tools/epydoc/docwriter/__init__.py +0 -12
- data/tools/epydoc/docwriter/__init__.pyc +0 -0
- data/tools/epydoc/docwriter/dotgraph.py +0 -1351
- data/tools/epydoc/docwriter/dotgraph.pyc +0 -0
- data/tools/epydoc/docwriter/html.py +0 -3491
- data/tools/epydoc/docwriter/html.pyc +0 -0
- data/tools/epydoc/docwriter/html_colorize.py +0 -909
- data/tools/epydoc/docwriter/html_colorize.pyc +0 -0
- data/tools/epydoc/docwriter/html_css.py +0 -550
- data/tools/epydoc/docwriter/html_css.pyc +0 -0
- data/tools/epydoc/docwriter/html_help.py +0 -190
- data/tools/epydoc/docwriter/html_help.pyc +0 -0
- data/tools/epydoc/docwriter/latex.py +0 -1187
- data/tools/epydoc/docwriter/latex.pyc +0 -0
- data/tools/epydoc/docwriter/plaintext.py +0 -276
- data/tools/epydoc/docwriter/plaintext.pyc +0 -0
- data/tools/epydoc/docwriter/xlink.py +0 -505
- data/tools/epydoc/docwriter/xlink.pyc +0 -0
- data/tools/epydoc/gui.py +0 -1148
- data/tools/epydoc/gui.pyc +0 -0
- data/tools/epydoc/log.py +0 -204
- data/tools/epydoc/log.pyc +0 -0
- data/tools/epydoc/markup/__init__.py +0 -623
- data/tools/epydoc/markup/__init__.pyc +0 -0
- data/tools/epydoc/markup/doctest.py +0 -311
- data/tools/epydoc/markup/doctest.pyc +0 -0
- data/tools/epydoc/markup/epytext.py +0 -2116
- data/tools/epydoc/markup/epytext.pyc +0 -0
- data/tools/epydoc/markup/javadoc.py +0 -250
- data/tools/epydoc/markup/javadoc.pyc +0 -0
- data/tools/epydoc/markup/plaintext.py +0 -78
- data/tools/epydoc/markup/plaintext.pyc +0 -0
- data/tools/epydoc/markup/pyval_repr.py +0 -532
- data/tools/epydoc/markup/pyval_repr.pyc +0 -0
- data/tools/epydoc/markup/restructuredtext.py +0 -906
- data/tools/epydoc/markup/restructuredtext.pyc +0 -0
- data/tools/epydoc/test/__init__.py +0 -97
- data/tools/epydoc/test/__init__.pyc +0 -0
- data/tools/epydoc/test/util.py +0 -226
- data/tools/epydoc/test/util.pyc +0 -0
- data/tools/epydoc/util.py +0 -289
- data/tools/epydoc/util.pyc +0 -0
- data/tools/logilab/logilab/__init__.py +0 -5
- data/tools/logilab/logilab/astng/__init__.py +0 -82
- data/tools/logilab/logilab/astng/__pkginfo__.py +0 -76
- data/tools/logilab/logilab/astng/_exceptions.py +0 -64
- data/tools/logilab/logilab/astng/_nodes_ast.py +0 -667
- data/tools/logilab/logilab/astng/_nodes_compiler.py +0 -758
- data/tools/logilab/logilab/astng/bases.py +0 -608
- data/tools/logilab/logilab/astng/builder.py +0 -239
- data/tools/logilab/logilab/astng/inference.py +0 -426
- data/tools/logilab/logilab/astng/inspector.py +0 -289
- data/tools/logilab/logilab/astng/manager.py +0 -421
- data/tools/logilab/logilab/astng/mixins.py +0 -165
- data/tools/logilab/logilab/astng/node_classes.py +0 -848
- data/tools/logilab/logilab/astng/nodes.py +0 -85
- data/tools/logilab/logilab/astng/nodes_as_string.py +0 -389
- data/tools/logilab/logilab/astng/patchcomptransformer.py +0 -159
- data/tools/logilab/logilab/astng/protocols.py +0 -333
- data/tools/logilab/logilab/astng/raw_building.py +0 -212
- data/tools/logilab/logilab/astng/rebuilder.py +0 -307
- data/tools/logilab/logilab/astng/scoped_nodes.py +0 -951
- data/tools/logilab/logilab/astng/test/__init__.py +0 -19
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/astng/test/data/MyPyPa-0.1.0-py2.5.zip +0 -0
- data/tools/logilab/logilab/astng/test/data/SSL1/Connection1.py +0 -33
- data/tools/logilab/logilab/astng/test/data/SSL1/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data/all.py +0 -29
- data/tools/logilab/logilab/astng/test/data/appl/__init__.py +0 -23
- data/tools/logilab/logilab/astng/test/data/appl/myConnection.py +0 -30
- data/tools/logilab/logilab/astng/test/data/format.py +0 -34
- data/tools/logilab/logilab/astng/test/data/module.py +0 -90
- data/tools/logilab/logilab/astng/test/data/module2.py +0 -112
- data/tools/logilab/logilab/astng/test/data/noendingnewline.py +0 -57
- data/tools/logilab/logilab/astng/test/data/nonregr.py +0 -76
- data/tools/logilab/logilab/astng/test/data/notall.py +0 -28
- data/tools/logilab/logilab/astng/test/data2/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/data2/clientmodule_test.py +0 -51
- data/tools/logilab/logilab/astng/test/data2/suppliermodule_test.py +0 -32
- data/tools/logilab/logilab/astng/test/regrtest.py +0 -135
- data/tools/logilab/logilab/astng/test/regrtest_data/absimport.py +0 -22
- data/tools/logilab/logilab/astng/test/regrtest_data/descriptor_crash.py +0 -31
- data/tools/logilab/logilab/astng/test/regrtest_data/import_package_subpackage_module.py +0 -68
- data/tools/logilab/logilab/astng/test/regrtest_data/package/__init__.py +0 -24
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/__init__.py +0 -20
- data/tools/logilab/logilab/astng/test/regrtest_data/package/subpackage/module.py +0 -20
- data/tools/logilab/logilab/astng/test/unittest_builder.py +0 -684
- data/tools/logilab/logilab/astng/test/unittest_inference.py +0 -1112
- data/tools/logilab/logilab/astng/test/unittest_inspector.py +0 -105
- data/tools/logilab/logilab/astng/test/unittest_lookup.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_manager.py +0 -98
- data/tools/logilab/logilab/astng/test/unittest_nodes.py +0 -302
- data/tools/logilab/logilab/astng/test/unittest_scoped_nodes.py +0 -501
- data/tools/logilab/logilab/astng/test/unittest_utils.py +0 -104
- data/tools/logilab/logilab/astng/utils.py +0 -342
- data/tools/logilab/logilab/common/__init__.py +0 -140
- data/tools/logilab/logilab/common/__pkginfo__.py +0 -43
- data/tools/logilab/logilab/common/adbh.py +0 -35
- data/tools/logilab/logilab/common/cache.py +0 -114
- data/tools/logilab/logilab/common/changelog.py +0 -234
- data/tools/logilab/logilab/common/clcommands.py +0 -181
- data/tools/logilab/logilab/common/cli.py +0 -212
- data/tools/logilab/logilab/common/compat.py +0 -328
- data/tools/logilab/logilab/common/configuration.py +0 -1087
- data/tools/logilab/logilab/common/contexts.py +0 -58
- data/tools/logilab/logilab/common/corbautils.py +0 -117
- data/tools/logilab/logilab/common/daemon.py +0 -171
- data/tools/logilab/logilab/common/date.py +0 -279
- data/tools/logilab/logilab/common/db.py +0 -49
- data/tools/logilab/logilab/common/dbf.py +0 -229
- data/tools/logilab/logilab/common/debugger.py +0 -208
- data/tools/logilab/logilab/common/decorators.py +0 -190
- data/tools/logilab/logilab/common/deprecation.py +0 -118
- data/tools/logilab/logilab/common/fileutils.py +0 -409
- data/tools/logilab/logilab/common/graph.py +0 -259
- data/tools/logilab/logilab/common/html.py +0 -142
- data/tools/logilab/logilab/common/interface.py +0 -76
- data/tools/logilab/logilab/common/logging_ext.py +0 -166
- data/tools/logilab/logilab/common/modutils.py +0 -670
- data/tools/logilab/logilab/common/optik_ext.py +0 -383
- data/tools/logilab/logilab/common/optparser.py +0 -92
- data/tools/logilab/logilab/common/pdf_ext.py +0 -111
- data/tools/logilab/logilab/common/proc.py +0 -276
- data/tools/logilab/logilab/common/pyro_ext.py +0 -146
- data/tools/logilab/logilab/common/pytest.py +0 -754
- data/tools/logilab/logilab/common/shellutils.py +0 -383
- data/tools/logilab/logilab/common/sphinx_ext.py +0 -87
- data/tools/logilab/logilab/common/sphinxutils.py +0 -122
- data/tools/logilab/logilab/common/sqlgen.py +0 -31
- data/tools/logilab/logilab/common/table.py +0 -930
- data/tools/logilab/logilab/common/tasksqueue.py +0 -97
- data/tools/logilab/logilab/common/test/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/ChangeLog +0 -184
- data/tools/logilab/logilab/common/test/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- data/tools/logilab/logilab/common/test/data/__init__.py +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/content_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/content_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/file_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/file_differ_dir/subdirtwo/Hello +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/__init__.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/foo.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/module2.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/newlines.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/noendingnewline.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/nonregr.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/spam.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/doc.txt +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/sub/momo.py +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test.ini +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test1.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/test2.msg +0 -0
- data/tools/logilab/logilab/common/test/data/find_test/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/foo.txt +0 -9
- data/tools/logilab/logilab/common/test/data/module.py +0 -88
- data/tools/logilab/logilab/common/test/data/module2.py +0 -77
- data/tools/logilab/logilab/common/test/data/newlines.txt +0 -3
- data/tools/logilab/logilab/common/test/data/noendingnewline.py +0 -36
- data/tools/logilab/logilab/common/test/data/nonregr.py +0 -14
- data/tools/logilab/logilab/common/test/data/normal_file.txt +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/reference_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/reference_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/same_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/same_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/same_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/spam.txt +0 -9
- data/tools/logilab/logilab/common/test/data/sub/doc.txt +0 -1
- data/tools/logilab/logilab/common/test/data/sub/momo.py +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/NOTHING +0 -0
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/README +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/coin +0 -1
- data/tools/logilab/logilab/common/test/data/subdir_differ_dir/subdir/toto.txt +0 -53
- data/tools/logilab/logilab/common/test/data/test.ini +0 -20
- data/tools/logilab/logilab/common/test/data/test1.msg +0 -30
- data/tools/logilab/logilab/common/test/data/test2.msg +0 -42
- data/tools/logilab/logilab/common/test/data/write_protected_file.txt +0 -0
- data/tools/logilab/logilab/common/test/foomod.py +0 -17
- data/tools/logilab/logilab/common/test/unittest_cache.py +0 -129
- data/tools/logilab/logilab/common/test/unittest_changelog.py +0 -37
- data/tools/logilab/logilab/common/test/unittest_compat.py +0 -239
- data/tools/logilab/logilab/common/test/unittest_configuration.py +0 -348
- data/tools/logilab/logilab/common/test/unittest_date.py +0 -154
- data/tools/logilab/logilab/common/test/unittest_decorators.py +0 -62
- data/tools/logilab/logilab/common/test/unittest_deprecation.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_fileutils.py +0 -133
- data/tools/logilab/logilab/common/test/unittest_graph.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_html.py +0 -76
- data/tools/logilab/logilab/common/test/unittest_interface.py +0 -87
- data/tools/logilab/logilab/common/test/unittest_modutils.py +0 -244
- data/tools/logilab/logilab/common/test/unittest_pytest.py +0 -50
- data/tools/logilab/logilab/common/test/unittest_shellutils.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_table.py +0 -448
- data/tools/logilab/logilab/common/test/unittest_taskqueue.py +0 -71
- data/tools/logilab/logilab/common/test/unittest_testlib.py +0 -956
- data/tools/logilab/logilab/common/test/unittest_textutils.py +0 -247
- data/tools/logilab/logilab/common/test/unittest_tree.py +0 -248
- data/tools/logilab/logilab/common/test/unittest_umessage.py +0 -55
- data/tools/logilab/logilab/common/test/unittest_ureports_html.py +0 -64
- data/tools/logilab/logilab/common/test/unittest_ureports_text.py +0 -105
- data/tools/logilab/logilab/common/test/unittest_xmlutils.py +0 -75
- data/tools/logilab/logilab/common/test/utils.py +0 -87
- data/tools/logilab/logilab/common/testlib.py +0 -1927
- data/tools/logilab/logilab/common/textutils.py +0 -476
- data/tools/logilab/logilab/common/tree.py +0 -372
- data/tools/logilab/logilab/common/umessage.py +0 -161
- data/tools/logilab/logilab/common/ureports/__init__.py +0 -174
- data/tools/logilab/logilab/common/ureports/docbook_writer.py +0 -139
- data/tools/logilab/logilab/common/ureports/html_writer.py +0 -131
- data/tools/logilab/logilab/common/ureports/nodes.py +0 -201
- data/tools/logilab/logilab/common/ureports/text_writer.py +0 -140
- data/tools/logilab/logilab/common/vcgutils.py +0 -216
- data/tools/logilab/logilab/common/visitor.py +0 -107
- data/tools/logilab/logilab/common/xmlrpcutils.py +0 -136
- data/tools/logilab/logilab/common/xmlutils.py +0 -61
- data/tools/pychecker/COPYRIGHT +0 -31
- data/tools/pychecker/ChangeLog +0 -349
- data/tools/pychecker/CodeChecks.py +0 -1969
- data/tools/pychecker/CodeChecks.pyc +0 -0
- data/tools/pychecker/CodeChecks.pyo +0 -0
- data/tools/pychecker/Config.py +0 -475
- data/tools/pychecker/Config.pyc +0 -0
- data/tools/pychecker/Config.pyo +0 -0
- data/tools/pychecker/KNOWN_BUGS +0 -100
- data/tools/pychecker/MAINTAINERS +0 -81
- data/tools/pychecker/NEWS +0 -406
- data/tools/pychecker/OP.py +0 -131
- data/tools/pychecker/OP.pyc +0 -0
- data/tools/pychecker/OP.pyo +0 -0
- data/tools/pychecker/OptionTypes.py +0 -117
- data/tools/pychecker/OptionTypes.pyc +0 -0
- data/tools/pychecker/OptionTypes.pyo +0 -0
- data/tools/pychecker/README +0 -152
- data/tools/pychecker/Stack.py +0 -115
- data/tools/pychecker/Stack.pyc +0 -0
- data/tools/pychecker/Stack.pyo +0 -0
- data/tools/pychecker/TODO +0 -101
- data/tools/pychecker/VERSION +0 -1
- data/tools/pychecker/Warning.py +0 -50
- data/tools/pychecker/Warning.pyc +0 -0
- data/tools/pychecker/Warning.pyo +0 -0
- data/tools/pychecker/__init__.py +0 -17
- data/tools/pychecker/__init__.pyc +0 -0
- data/tools/pychecker/__init__.pyo +0 -0
- data/tools/pychecker/checker.py +0 -961
- data/tools/pychecker/checker.pyc +0 -0
- data/tools/pychecker/checker.pyo +0 -0
- data/tools/pychecker/function.py +0 -159
- data/tools/pychecker/function.pyc +0 -0
- data/tools/pychecker/function.pyo +0 -0
- data/tools/pychecker/msgs.py +0 -175
- data/tools/pychecker/msgs.pyc +0 -0
- data/tools/pychecker/msgs.pyo +0 -0
- data/tools/pychecker/options.py +0 -275
- data/tools/pychecker/options.pyc +0 -0
- data/tools/pychecker/options.pyo +0 -0
- data/tools/pychecker/pcmodules.py +0 -19
- data/tools/pychecker/pcmodules.pyc +0 -0
- data/tools/pychecker/pcmodules.pyo +0 -0
- data/tools/pychecker/printer.py +0 -47
- data/tools/pychecker/printer.pyc +0 -0
- data/tools/pychecker/printer.pyo +0 -0
- data/tools/pychecker/python.py +0 -427
- data/tools/pychecker/python.pyc +0 -0
- data/tools/pychecker/python.pyo +0 -0
- data/tools/pychecker/utils.py +0 -102
- data/tools/pychecker/utils.pyc +0 -0
- data/tools/pychecker/utils.pyo +0 -0
- data/tools/pychecker/warn.py +0 -778
- data/tools/pychecker/warn.pyc +0 -0
- data/tools/pychecker/warn.pyo +0 -0
- data/tools/pylint2/pylint/__init__.py +0 -16
- data/tools/pylint2/pylint/__pkginfo__.py +0 -67
- data/tools/pylint2/pylint/checkers/__init__.py +0 -155
- data/tools/pylint2/pylint/checkers/base.py +0 -749
- data/tools/pylint2/pylint/checkers/classes.py +0 -527
- data/tools/pylint2/pylint/checkers/design_analysis.py +0 -344
- data/tools/pylint2/pylint/checkers/exceptions.py +0 -183
- data/tools/pylint2/pylint/checkers/format.py +0 -367
- data/tools/pylint2/pylint/checkers/imports.py +0 -379
- data/tools/pylint2/pylint/checkers/logging.py +0 -98
- data/tools/pylint2/pylint/checkers/misc.py +0 -128
- data/tools/pylint2/pylint/checkers/newstyle.py +0 -107
- data/tools/pylint2/pylint/checkers/raw_metrics.py +0 -125
- data/tools/pylint2/pylint/checkers/similar.py +0 -333
- data/tools/pylint2/pylint/checkers/string_format.py +0 -239
- data/tools/pylint2/pylint/checkers/typecheck.py +0 -364
- data/tools/pylint2/pylint/checkers/utils.py +0 -208
- data/tools/pylint2/pylint/checkers/variables.py +0 -498
- data/tools/pylint2/pylint/config.py +0 -149
- data/tools/pylint2/pylint/epylint.py +0 -149
- data/tools/pylint2/pylint/gui.py +0 -433
- data/tools/pylint2/pylint/interfaces.py +0 -98
- data/tools/pylint2/pylint/lint.py +0 -914
- data/tools/pylint2/pylint/pyreverse/__init__.py +0 -5
- data/tools/pylint2/pylint/pyreverse/diadefslib.py +0 -229
- data/tools/pylint2/pylint/pyreverse/diagrams.py +0 -247
- data/tools/pylint2/pylint/pyreverse/main.py +0 -123
- data/tools/pylint2/pylint/pyreverse/utils.py +0 -131
- data/tools/pylint2/pylint/pyreverse/writer.py +0 -196
- data/tools/pylint2/pylint/reporters/__init__.py +0 -67
- data/tools/pylint2/pylint/reporters/guireporter.py +0 -36
- data/tools/pylint2/pylint/reporters/html.py +0 -69
- data/tools/pylint2/pylint/reporters/text.py +0 -156
- data/tools/pylint2/pylint/utils.py +0 -518
- data/tools/pylint2/pylint.py +0 -16
@@ -1,476 +0,0 @@
|
|
1
|
-
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
2
|
-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3
|
-
#
|
4
|
-
# This file is part of logilab-common.
|
5
|
-
#
|
6
|
-
# logilab-common is free software: you can redistribute it and/or modify it under
|
7
|
-
# the terms of the GNU Lesser General Public License as published by the Free
|
8
|
-
# Software Foundation, either version 2.1 of the License, or (at your option) any
|
9
|
-
# later version.
|
10
|
-
#
|
11
|
-
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
-
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
14
|
-
# details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License along
|
17
|
-
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
"""Some text manipulation utility functions.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
:group text formatting: normalize_text, normalize_paragraph, pretty_match,\
|
26
|
-
unquote, colorize_ansi
|
27
|
-
:group text manipulation: searchall, splitstrip
|
28
|
-
:sort: text formatting, text manipulation
|
29
|
-
|
30
|
-
:type ANSI_STYLES: dict(str)
|
31
|
-
:var ANSI_STYLES: dictionary mapping style identifier to ANSI terminal code
|
32
|
-
|
33
|
-
:type ANSI_COLORS: dict(str)
|
34
|
-
:var ANSI_COLORS: dictionary mapping color identifier to ANSI terminal code
|
35
|
-
|
36
|
-
:type ANSI_PREFIX: str
|
37
|
-
:var ANSI_PREFIX:
|
38
|
-
ANSI terminal code notifying the start of an ANSI escape sequence
|
39
|
-
|
40
|
-
:type ANSI_END: str
|
41
|
-
:var ANSI_END:
|
42
|
-
ANSI terminal code notifying the end of an ANSI escape sequence
|
43
|
-
|
44
|
-
:type ANSI_RESET: str
|
45
|
-
:var ANSI_RESET:
|
46
|
-
ANSI terminal code resetting format defined by a previous ANSI escape sequence
|
47
|
-
"""
|
48
|
-
__docformat__ = "restructuredtext en"
|
49
|
-
|
50
|
-
import sys
|
51
|
-
import re
|
52
|
-
from unicodedata import normalize as _uninormalize
|
53
|
-
try:
|
54
|
-
from os import linesep
|
55
|
-
except ImportError:
|
56
|
-
linesep = '\n' # gae
|
57
|
-
|
58
|
-
from logilab.common.deprecation import deprecated
|
59
|
-
|
60
|
-
MANUAL_UNICODE_MAP = {
|
61
|
-
u'\xa1': u'!', # INVERTED EXCLAMATION MARK
|
62
|
-
u'\u0142': u'l', # LATIN SMALL LETTER L WITH STROKE
|
63
|
-
u'\u2044': u'/', # FRACTION SLASH
|
64
|
-
u'\xc6': u'AE', # LATIN CAPITAL LETTER AE
|
65
|
-
u'\xa9': u'(c)', # COPYRIGHT SIGN
|
66
|
-
u'\xab': u'"', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
67
|
-
u'\xe6': u'ae', # LATIN SMALL LETTER AE
|
68
|
-
u'\xae': u'(r)', # REGISTERED SIGN
|
69
|
-
u'\u0153': u'oe', # LATIN SMALL LIGATURE OE
|
70
|
-
u'\u0152': u'OE', # LATIN CAPITAL LIGATURE OE
|
71
|
-
u'\xd8': u'O', # LATIN CAPITAL LETTER O WITH STROKE
|
72
|
-
u'\xf8': u'o', # LATIN SMALL LETTER O WITH STROKE
|
73
|
-
u'\xbb': u'"', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
74
|
-
u'\xdf': u'ss', # LATIN SMALL LETTER SHARP S
|
75
|
-
}
|
76
|
-
|
77
|
-
def unormalize(ustring, ignorenonascii=False):
|
78
|
-
"""replace diacritical characters with their corresponding ascii characters
|
79
|
-
"""
|
80
|
-
res = []
|
81
|
-
for letter in ustring[:]:
|
82
|
-
try:
|
83
|
-
replacement = MANUAL_UNICODE_MAP[letter]
|
84
|
-
except KeyError:
|
85
|
-
if ord(letter) >= 2**8:
|
86
|
-
if ignorenonascii:
|
87
|
-
continue
|
88
|
-
raise ValueError("can't deal with non-ascii based characters")
|
89
|
-
replacement = _uninormalize('NFD', letter)[0]
|
90
|
-
res.append(replacement)
|
91
|
-
return u''.join(res)
|
92
|
-
|
93
|
-
def unquote(string):
|
94
|
-
"""remove optional quotes (simple or double) from the string
|
95
|
-
|
96
|
-
:type string: str or unicode
|
97
|
-
:param string: an optionally quoted string
|
98
|
-
|
99
|
-
:rtype: str or unicode
|
100
|
-
:return: the unquoted string (or the input string if it wasn't quoted)
|
101
|
-
"""
|
102
|
-
if not string:
|
103
|
-
return string
|
104
|
-
if string[0] in '"\'':
|
105
|
-
string = string[1:]
|
106
|
-
if string[-1] in '"\'':
|
107
|
-
string = string[:-1]
|
108
|
-
return string
|
109
|
-
|
110
|
-
|
111
|
-
_BLANKLINES_RGX = re.compile('\r?\n\r?\n')
|
112
|
-
_NORM_SPACES_RGX = re.compile('\s+')
|
113
|
-
|
114
|
-
def normalize_text(text, line_len=80, indent='', rest=False):
|
115
|
-
"""normalize a text to display it with a maximum line size and
|
116
|
-
optionally arbitrary indentation. Line jumps are normalized but blank
|
117
|
-
lines are kept. The indentation string may be used to insert a
|
118
|
-
comment (#) or a quoting (>) mark for instance.
|
119
|
-
|
120
|
-
:type text: str or unicode
|
121
|
-
:param text: the input text to normalize
|
122
|
-
|
123
|
-
:type line_len: int
|
124
|
-
:param line_len: expected maximum line's length, default to 80
|
125
|
-
|
126
|
-
:type indent: str or unicode
|
127
|
-
:param indent: optional string to use as indentation
|
128
|
-
|
129
|
-
:rtype: str or unicode
|
130
|
-
:return:
|
131
|
-
the input text normalized to fit on lines with a maximized size
|
132
|
-
inferior to `line_len`, and optionally prefixed by an
|
133
|
-
indentation string
|
134
|
-
"""
|
135
|
-
if rest:
|
136
|
-
normp = normalize_rest_paragraph
|
137
|
-
else:
|
138
|
-
normp = normalize_paragraph
|
139
|
-
result = []
|
140
|
-
for text in _BLANKLINES_RGX.split(text):
|
141
|
-
result.append(normp(text, line_len, indent))
|
142
|
-
return ('%s%s%s' % (linesep, indent, linesep)).join(result)
|
143
|
-
|
144
|
-
|
145
|
-
def normalize_paragraph(text, line_len=80, indent=''):
|
146
|
-
"""normalize a text to display it with a maximum line size and
|
147
|
-
optionally arbitrary indentation. Line jumps are normalized. The
|
148
|
-
indentation string may be used top insert a comment mark for
|
149
|
-
instance.
|
150
|
-
|
151
|
-
:type text: str or unicode
|
152
|
-
:param text: the input text to normalize
|
153
|
-
|
154
|
-
:type line_len: int
|
155
|
-
:param line_len: expected maximum line's length, default to 80
|
156
|
-
|
157
|
-
:type indent: str or unicode
|
158
|
-
:param indent: optional string to use as indentation
|
159
|
-
|
160
|
-
:rtype: str or unicode
|
161
|
-
:return:
|
162
|
-
the input text normalized to fit on lines with a maximized size
|
163
|
-
inferior to `line_len`, and optionally prefixed by an
|
164
|
-
indentation string
|
165
|
-
"""
|
166
|
-
text = _NORM_SPACES_RGX.sub(' ', text)
|
167
|
-
line_len = line_len - len(indent)
|
168
|
-
lines = []
|
169
|
-
while text:
|
170
|
-
aline, text = splittext(text.strip(), line_len)
|
171
|
-
lines.append(indent + aline)
|
172
|
-
return linesep.join(lines)
|
173
|
-
|
174
|
-
def normalize_rest_paragraph(text, line_len=80, indent=''):
|
175
|
-
"""normalize a ReST text to display it with a maximum line size and
|
176
|
-
optionally arbitrary indentation. Line jumps are normalized. The
|
177
|
-
indentation string may be used top insert a comment mark for
|
178
|
-
instance.
|
179
|
-
|
180
|
-
:type text: str or unicode
|
181
|
-
:param text: the input text to normalize
|
182
|
-
|
183
|
-
:type line_len: int
|
184
|
-
:param line_len: expected maximum line's length, default to 80
|
185
|
-
|
186
|
-
:type indent: str or unicode
|
187
|
-
:param indent: optional string to use as indentation
|
188
|
-
|
189
|
-
:rtype: str or unicode
|
190
|
-
:return:
|
191
|
-
the input text normalized to fit on lines with a maximized size
|
192
|
-
inferior to `line_len`, and optionally prefixed by an
|
193
|
-
indentation string
|
194
|
-
"""
|
195
|
-
toreport = ''
|
196
|
-
lines = []
|
197
|
-
line_len = line_len - len(indent)
|
198
|
-
for line in text.splitlines():
|
199
|
-
line = toreport + _NORM_SPACES_RGX.sub(' ', line.strip())
|
200
|
-
toreport = ''
|
201
|
-
while len(line) > line_len:
|
202
|
-
# too long line, need split
|
203
|
-
line, toreport = splittext(line, line_len)
|
204
|
-
lines.append(indent + line)
|
205
|
-
if toreport:
|
206
|
-
line = toreport + ' '
|
207
|
-
toreport = ''
|
208
|
-
else:
|
209
|
-
line = ''
|
210
|
-
if line:
|
211
|
-
lines.append(indent + line.strip())
|
212
|
-
return linesep.join(lines)
|
213
|
-
|
214
|
-
def splittext(text, line_len):
|
215
|
-
"""split the given text on space according to the given max line size
|
216
|
-
|
217
|
-
return a 2-uple:
|
218
|
-
* a line <= line_len if possible
|
219
|
-
* the rest of the text which has to be reported on another line
|
220
|
-
"""
|
221
|
-
if len(text) <= line_len:
|
222
|
-
return text, ''
|
223
|
-
pos = min(len(text)-1, line_len)
|
224
|
-
while pos > 0 and text[pos] != ' ':
|
225
|
-
pos -= 1
|
226
|
-
if pos == 0:
|
227
|
-
pos = min(len(text), line_len)
|
228
|
-
while len(text) > pos and text[pos] != ' ':
|
229
|
-
pos += 1
|
230
|
-
return text[:pos], text[pos+1:].strip()
|
231
|
-
|
232
|
-
|
233
|
-
def splitstrip(string, sep=','):
|
234
|
-
"""return a list of stripped string by splitting the string given as
|
235
|
-
argument on `sep` (',' by default). Empty string are discarded.
|
236
|
-
|
237
|
-
>>> splitstrip('a, b, c , 4,,')
|
238
|
-
['a', 'b', 'c', '4']
|
239
|
-
>>> splitstrip('a')
|
240
|
-
['a']
|
241
|
-
>>>
|
242
|
-
|
243
|
-
:type string: str or unicode
|
244
|
-
:param string: a csv line
|
245
|
-
|
246
|
-
:type sep: str or unicode
|
247
|
-
:param sep: field separator, default to the comma (',')
|
248
|
-
|
249
|
-
:rtype: str or unicode
|
250
|
-
:return: the unquoted string (or the input string if it wasn't quoted)
|
251
|
-
"""
|
252
|
-
return [word.strip() for word in string.split(sep) if word.strip()]
|
253
|
-
|
254
|
-
get_csv = deprecated()(splitstrip)
|
255
|
-
|
256
|
-
_BLANK_URE = r'(\s|,)+'
|
257
|
-
_BLANK_RE = re.compile(_BLANK_URE)
|
258
|
-
__VALUE_URE = r'-?(([0-9]+\.[0-9]*)|((0x?)?[0-9]+))'
|
259
|
-
__UNITS_URE = r'[a-zA-Z]+'
|
260
|
-
_VALUE_RE = re.compile(r'(?P<value>%s)(?P<unit>%s)?'%(__VALUE_URE,__UNITS_URE))
|
261
|
-
|
262
|
-
BYTE_UNITS = {
|
263
|
-
"b": 1,
|
264
|
-
"kb": 1024,
|
265
|
-
"mb": 1024 ** 2,
|
266
|
-
"gb": 1024 ** 3,
|
267
|
-
"tb": 1024 ** 4,
|
268
|
-
}
|
269
|
-
|
270
|
-
TIME_UNITS = {
|
271
|
-
"ms": 0.0001,
|
272
|
-
"s": 1,
|
273
|
-
"min": 60,
|
274
|
-
"h": 60 * 60,
|
275
|
-
"d": 60 * 60 *24,
|
276
|
-
}
|
277
|
-
|
278
|
-
def apply_units( string, units, inter=None, final=float, blank_reg=_BLANK_RE,
|
279
|
-
value_reg=_VALUE_RE):
|
280
|
-
"""Parse the string applying the units defined in units
|
281
|
-
(e.g.: "1.5m",{'m',60} -> 80).
|
282
|
-
|
283
|
-
:type string: str or unicode
|
284
|
-
:param string: the string to parse
|
285
|
-
|
286
|
-
:type units: dict (or any object with __getitem__ using basestring key)
|
287
|
-
:param units: a dict mapping a unit string repr to its value
|
288
|
-
|
289
|
-
:type inter: type
|
290
|
-
:param inter: used to parse every intermediate value (need __sum__)
|
291
|
-
|
292
|
-
:type blank_reg: regexp
|
293
|
-
:param blank_reg: should match every blank char to ignore.
|
294
|
-
|
295
|
-
:type value_reg: regexp with "value" and optional "unit" group
|
296
|
-
:param value_reg: match a value and it's unit into the
|
297
|
-
"""
|
298
|
-
if inter is None:
|
299
|
-
inter = final
|
300
|
-
string = _BLANK_RE.sub('',string)
|
301
|
-
values = []
|
302
|
-
for match in value_reg.finditer(string):
|
303
|
-
dic = match.groupdict()
|
304
|
-
#import sys
|
305
|
-
#print >> sys.stderr, dic
|
306
|
-
lit, unit = dic["value"], dic.get("unit")
|
307
|
-
value = inter(lit)
|
308
|
-
if unit is not None:
|
309
|
-
try:
|
310
|
-
value *= units[unit.lower()]
|
311
|
-
except KeyError:
|
312
|
-
raise KeyError('invalid unit %s. valid units are %s' %
|
313
|
-
(unit, units.keys()))
|
314
|
-
values.append(value)
|
315
|
-
return final(sum(values))
|
316
|
-
|
317
|
-
_LINE_RGX = re.compile('\r\n|\r+|\n')
|
318
|
-
|
319
|
-
def pretty_match(match, string, underline_char='^'):
|
320
|
-
"""return a string with the match location underlined:
|
321
|
-
|
322
|
-
>>> import re
|
323
|
-
>>> print pretty_match(re.search('mange', 'il mange du bacon'), 'il mange du bacon')
|
324
|
-
il mange du bacon
|
325
|
-
^^^^^
|
326
|
-
>>>
|
327
|
-
|
328
|
-
:type match: _sre.SRE_match
|
329
|
-
:param match: object returned by re.match, re.search or re.finditer
|
330
|
-
|
331
|
-
:type string: str or unicode
|
332
|
-
:param string:
|
333
|
-
the string on which the regular expression has been applied to
|
334
|
-
obtain the `match` object
|
335
|
-
|
336
|
-
:type underline_char: str or unicode
|
337
|
-
:param underline_char:
|
338
|
-
character to use to underline the matched section, default to the
|
339
|
-
carret '^'
|
340
|
-
|
341
|
-
:rtype: str or unicode
|
342
|
-
:return:
|
343
|
-
the original string with an inserted line to underline the match
|
344
|
-
location
|
345
|
-
"""
|
346
|
-
start = match.start()
|
347
|
-
end = match.end()
|
348
|
-
string = _LINE_RGX.sub(linesep, string)
|
349
|
-
start_line_pos = string.rfind(linesep, 0, start)
|
350
|
-
if start_line_pos == -1:
|
351
|
-
start_line_pos = 0
|
352
|
-
result = []
|
353
|
-
else:
|
354
|
-
result = [string[:start_line_pos]]
|
355
|
-
start_line_pos += len(linesep)
|
356
|
-
offset = start - start_line_pos
|
357
|
-
underline = ' ' * offset + underline_char * (end - start)
|
358
|
-
end_line_pos = string.find(linesep, end)
|
359
|
-
if end_line_pos == -1:
|
360
|
-
string = string[start_line_pos:]
|
361
|
-
result.append(string)
|
362
|
-
result.append(underline)
|
363
|
-
else:
|
364
|
-
end = string[end_line_pos + len(linesep):]
|
365
|
-
string = string[start_line_pos:end_line_pos]
|
366
|
-
result.append(string)
|
367
|
-
result.append(underline)
|
368
|
-
result.append(end)
|
369
|
-
return linesep.join(result).rstrip()
|
370
|
-
|
371
|
-
|
372
|
-
# Ansi colorization ###########################################################
|
373
|
-
|
374
|
-
ANSI_PREFIX = '\033['
|
375
|
-
ANSI_END = 'm'
|
376
|
-
ANSI_RESET = '\033[0m'
|
377
|
-
ANSI_STYLES = {
|
378
|
-
'reset' : "0",
|
379
|
-
'bold' : "1",
|
380
|
-
'italic' : "3",
|
381
|
-
'underline' : "4",
|
382
|
-
'blink' : "5",
|
383
|
-
'inverse' : "7",
|
384
|
-
'strike' : "9",
|
385
|
-
}
|
386
|
-
ANSI_COLORS = {
|
387
|
-
'reset' : "0",
|
388
|
-
'black' : "30",
|
389
|
-
'red' : "31",
|
390
|
-
'green' : "32",
|
391
|
-
'yellow' : "33",
|
392
|
-
'blue' : "34",
|
393
|
-
'magenta' : "35",
|
394
|
-
'cyan' : "36",
|
395
|
-
'white' : "37",
|
396
|
-
}
|
397
|
-
|
398
|
-
def _get_ansi_code(color=None, style=None):
|
399
|
-
"""return ansi escape code corresponding to color and style
|
400
|
-
|
401
|
-
:type color: str or None
|
402
|
-
:param color:
|
403
|
-
the color name (see `ANSI_COLORS` for available values)
|
404
|
-
or the color number when 256 colors are available
|
405
|
-
|
406
|
-
:type style: str or None
|
407
|
-
:param style:
|
408
|
-
style string (see `ANSI_COLORS` for available values). To get
|
409
|
-
several style effects at the same time, use a coma as separator.
|
410
|
-
|
411
|
-
:raise KeyError: if an unexistent color or style identifier is given
|
412
|
-
|
413
|
-
:rtype: str
|
414
|
-
:return: the built escape code
|
415
|
-
"""
|
416
|
-
ansi_code = []
|
417
|
-
if style:
|
418
|
-
style_attrs = splitstrip(style)
|
419
|
-
for effect in style_attrs:
|
420
|
-
ansi_code.append(ANSI_STYLES[effect])
|
421
|
-
if color:
|
422
|
-
if color.isdigit():
|
423
|
-
ansi_code.extend(['38','5'])
|
424
|
-
ansi_code.append(color)
|
425
|
-
else:
|
426
|
-
ansi_code.append(ANSI_COLORS[color])
|
427
|
-
if ansi_code:
|
428
|
-
return ANSI_PREFIX + ';'.join(ansi_code) + ANSI_END
|
429
|
-
return ''
|
430
|
-
|
431
|
-
def colorize_ansi(msg, color=None, style=None):
|
432
|
-
"""colorize message by wrapping it with ansi escape codes
|
433
|
-
|
434
|
-
:type msg: str or unicode
|
435
|
-
:param msg: the message string to colorize
|
436
|
-
|
437
|
-
:type color: str or None
|
438
|
-
:param color:
|
439
|
-
the color identifier (see `ANSI_COLORS` for available values)
|
440
|
-
|
441
|
-
:type style: str or None
|
442
|
-
:param style:
|
443
|
-
style string (see `ANSI_COLORS` for available values). To get
|
444
|
-
several style effects at the same time, use a coma as separator.
|
445
|
-
|
446
|
-
:raise KeyError: if an unexistent color or style identifier is given
|
447
|
-
|
448
|
-
:rtype: str or unicode
|
449
|
-
:return: the ansi escaped string
|
450
|
-
"""
|
451
|
-
# If both color and style are not defined, then leave the text as is
|
452
|
-
if color is None and style is None:
|
453
|
-
return msg
|
454
|
-
escape_code = _get_ansi_code(color, style)
|
455
|
-
# If invalid (or unknown) color, don't wrap msg with ansi codes
|
456
|
-
if escape_code:
|
457
|
-
return '%s%s%s' % (escape_code, msg, ANSI_RESET)
|
458
|
-
return msg
|
459
|
-
|
460
|
-
DIFF_STYLE = {'separator': 'cyan', 'remove': 'red', 'add': 'green'}
|
461
|
-
|
462
|
-
def diff_colorize_ansi(lines, out=sys.stdout, style=DIFF_STYLE):
|
463
|
-
for line in lines:
|
464
|
-
if line[:4] in ('--- ', '+++ '):
|
465
|
-
out.write(colorize_ansi(line, style['separator']))
|
466
|
-
elif line[0] == '-':
|
467
|
-
out.write(colorize_ansi(line, style['remove']))
|
468
|
-
elif line[0] == '+':
|
469
|
-
out.write(colorize_ansi(line, style['add']))
|
470
|
-
elif line[:4] == '--- ':
|
471
|
-
out.write(colorize_ansi(line, style['separator']))
|
472
|
-
elif line[:4] == '+++ ':
|
473
|
-
out.write(colorize_ansi(line, style['separator']))
|
474
|
-
else:
|
475
|
-
out.write(line)
|
476
|
-
|