rigid 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/rigid +4 -0
- data/rigid +16 -0
- data/vendor/PyYAML-3.12.dist-info/DESCRIPTION.rst +12 -0
- data/vendor/PyYAML-3.12.dist-info/INSTALLER +1 -0
- data/vendor/PyYAML-3.12.dist-info/METADATA +35 -0
- data/vendor/PyYAML-3.12.dist-info/RECORD +42 -0
- data/vendor/PyYAML-3.12.dist-info/WHEEL +5 -0
- data/vendor/PyYAML-3.12.dist-info/metadata.json +1 -0
- data/vendor/PyYAML-3.12.dist-info/top_level.txt +2 -0
- data/vendor/_yaml.so +0 -0
- data/vendor/click/__init__.py +98 -0
- data/vendor/click/__init__.pyc +0 -0
- data/vendor/click/_bashcomplete.py +83 -0
- data/vendor/click/_bashcomplete.pyc +0 -0
- data/vendor/click/_compat.py +642 -0
- data/vendor/click/_compat.pyc +0 -0
- data/vendor/click/_termui_impl.py +547 -0
- data/vendor/click/_termui_impl.pyc +0 -0
- data/vendor/click/_textwrap.py +38 -0
- data/vendor/click/_textwrap.pyc +0 -0
- data/vendor/click/_unicodefun.py +119 -0
- data/vendor/click/_unicodefun.pyc +0 -0
- data/vendor/click/_winconsole.py +273 -0
- data/vendor/click/_winconsole.pyc +0 -0
- data/vendor/click/core.py +1738 -0
- data/vendor/click/core.pyc +0 -0
- data/vendor/click/decorators.py +304 -0
- data/vendor/click/decorators.pyc +0 -0
- data/vendor/click/exceptions.py +201 -0
- data/vendor/click/exceptions.pyc +0 -0
- data/vendor/click/formatting.py +256 -0
- data/vendor/click/formatting.pyc +0 -0
- data/vendor/click/globals.py +48 -0
- data/vendor/click/globals.pyc +0 -0
- data/vendor/click/parser.py +426 -0
- data/vendor/click/parser.pyc +0 -0
- data/vendor/click/termui.py +539 -0
- data/vendor/click/termui.pyc +0 -0
- data/vendor/click/testing.py +322 -0
- data/vendor/click/testing.pyc +0 -0
- data/vendor/click/types.py +550 -0
- data/vendor/click/types.pyc +0 -0
- data/vendor/click/utils.py +415 -0
- data/vendor/click/utils.pyc +0 -0
- data/vendor/click-6.6.dist-info/DESCRIPTION.rst +3 -0
- data/vendor/click-6.6.dist-info/INSTALLER +1 -0
- data/vendor/click-6.6.dist-info/METADATA +16 -0
- data/vendor/click-6.6.dist-info/RECORD +41 -0
- data/vendor/click-6.6.dist-info/WHEEL +6 -0
- data/vendor/click-6.6.dist-info/metadata.json +1 -0
- data/vendor/click-6.6.dist-info/top_level.txt +1 -0
- data/vendor/easy_install.py +5 -0
- data/vendor/easy_install.pyc +0 -0
- data/vendor/pip-9.0.1.dist-info/DESCRIPTION.rst +39 -0
- data/vendor/pip-9.0.1.dist-info/INSTALLER +1 -0
- data/vendor/pip-9.0.1.dist-info/METADATA +69 -0
- data/vendor/pip-9.0.1.dist-info/RECORD +501 -0
- data/vendor/pip-9.0.1.dist-info/WHEEL +6 -0
- data/vendor/pip-9.0.1.dist-info/entry_points.txt +5 -0
- data/vendor/pip-9.0.1.dist-info/metadata.json +1 -0
- data/vendor/pip-9.0.1.dist-info/top_level.txt +1 -0
- data/vendor/pkg_resources/__init__.py +3051 -0
- data/vendor/pkg_resources/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/__init__.py +0 -0
- data/vendor/pkg_resources/_vendor/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/appdirs.py +552 -0
- data/vendor/pkg_resources/_vendor/appdirs.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/__about__.py +21 -0
- data/vendor/pkg_resources/_vendor/packaging/__about__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/__init__.py +14 -0
- data/vendor/pkg_resources/_vendor/packaging/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/_compat.py +30 -0
- data/vendor/pkg_resources/_vendor/packaging/_compat.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/_structures.py +68 -0
- data/vendor/pkg_resources/_vendor/packaging/_structures.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/markers.py +287 -0
- data/vendor/pkg_resources/_vendor/packaging/markers.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/requirements.py +127 -0
- data/vendor/pkg_resources/_vendor/packaging/requirements.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/specifiers.py +774 -0
- data/vendor/pkg_resources/_vendor/packaging/specifiers.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/utils.py +14 -0
- data/vendor/pkg_resources/_vendor/packaging/utils.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/version.py +393 -0
- data/vendor/pkg_resources/_vendor/packaging/version.pyc +0 -0
- data/vendor/pkg_resources/_vendor/pyparsing.py +5696 -0
- data/vendor/pkg_resources/_vendor/pyparsing.pyc +0 -0
- data/vendor/pkg_resources/_vendor/six.py +868 -0
- data/vendor/pkg_resources/_vendor/six.pyc +0 -0
- data/vendor/pkg_resources/extern/__init__.py +73 -0
- data/vendor/pkg_resources/extern/__init__.pyc +0 -0
- data/vendor/requests/__init__.py +86 -0
- data/vendor/requests/__init__.pyc +0 -0
- data/vendor/requests/adapters.py +503 -0
- data/vendor/requests/adapters.pyc +0 -0
- data/vendor/requests/api.py +148 -0
- data/vendor/requests/api.pyc +0 -0
- data/vendor/requests/auth.py +252 -0
- data/vendor/requests/auth.pyc +0 -0
- data/vendor/requests/cacert.pem +5616 -0
- data/vendor/requests/certs.py +25 -0
- data/vendor/requests/certs.pyc +0 -0
- data/vendor/requests/compat.py +66 -0
- data/vendor/requests/compat.pyc +0 -0
- data/vendor/requests/cookies.py +540 -0
- data/vendor/requests/cookies.pyc +0 -0
- data/vendor/requests/exceptions.py +114 -0
- data/vendor/requests/exceptions.pyc +0 -0
- data/vendor/requests/hooks.py +34 -0
- data/vendor/requests/hooks.pyc +0 -0
- data/vendor/requests/models.py +873 -0
- data/vendor/requests/models.pyc +0 -0
- data/vendor/requests/packages/__init__.py +36 -0
- data/vendor/requests/packages/__init__.pyc +0 -0
- data/vendor/requests/packages/chardet/__init__.py +32 -0
- data/vendor/requests/packages/chardet/__init__.pyc +0 -0
- data/vendor/requests/packages/chardet/big5freq.py +925 -0
- data/vendor/requests/packages/chardet/big5freq.pyc +0 -0
- data/vendor/requests/packages/chardet/big5prober.py +42 -0
- data/vendor/requests/packages/chardet/big5prober.pyc +0 -0
- data/vendor/requests/packages/chardet/chardetect.py +80 -0
- data/vendor/requests/packages/chardet/chardetect.pyc +0 -0
- data/vendor/requests/packages/chardet/chardistribution.py +231 -0
- data/vendor/requests/packages/chardet/chardistribution.pyc +0 -0
- data/vendor/requests/packages/chardet/charsetgroupprober.py +106 -0
- data/vendor/requests/packages/chardet/charsetgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/charsetprober.py +62 -0
- data/vendor/requests/packages/chardet/charsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/codingstatemachine.py +61 -0
- data/vendor/requests/packages/chardet/codingstatemachine.pyc +0 -0
- data/vendor/requests/packages/chardet/compat.py +34 -0
- data/vendor/requests/packages/chardet/compat.pyc +0 -0
- data/vendor/requests/packages/chardet/constants.py +39 -0
- data/vendor/requests/packages/chardet/constants.pyc +0 -0
- data/vendor/requests/packages/chardet/cp949prober.py +44 -0
- data/vendor/requests/packages/chardet/cp949prober.pyc +0 -0
- data/vendor/requests/packages/chardet/escprober.py +86 -0
- data/vendor/requests/packages/chardet/escprober.pyc +0 -0
- data/vendor/requests/packages/chardet/escsm.py +242 -0
- data/vendor/requests/packages/chardet/escsm.pyc +0 -0
- data/vendor/requests/packages/chardet/eucjpprober.py +90 -0
- data/vendor/requests/packages/chardet/eucjpprober.pyc +0 -0
- data/vendor/requests/packages/chardet/euckrfreq.py +596 -0
- data/vendor/requests/packages/chardet/euckrfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/euckrprober.py +42 -0
- data/vendor/requests/packages/chardet/euckrprober.pyc +0 -0
- data/vendor/requests/packages/chardet/euctwfreq.py +428 -0
- data/vendor/requests/packages/chardet/euctwfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/euctwprober.py +41 -0
- data/vendor/requests/packages/chardet/euctwprober.pyc +0 -0
- data/vendor/requests/packages/chardet/gb2312freq.py +472 -0
- data/vendor/requests/packages/chardet/gb2312freq.pyc +0 -0
- data/vendor/requests/packages/chardet/gb2312prober.py +41 -0
- data/vendor/requests/packages/chardet/gb2312prober.pyc +0 -0
- data/vendor/requests/packages/chardet/hebrewprober.py +283 -0
- data/vendor/requests/packages/chardet/hebrewprober.pyc +0 -0
- data/vendor/requests/packages/chardet/jisfreq.py +569 -0
- data/vendor/requests/packages/chardet/jisfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/jpcntx.py +227 -0
- data/vendor/requests/packages/chardet/jpcntx.pyc +0 -0
- data/vendor/requests/packages/chardet/langbulgarianmodel.py +229 -0
- data/vendor/requests/packages/chardet/langbulgarianmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langcyrillicmodel.py +329 -0
- data/vendor/requests/packages/chardet/langcyrillicmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langgreekmodel.py +225 -0
- data/vendor/requests/packages/chardet/langgreekmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langhebrewmodel.py +201 -0
- data/vendor/requests/packages/chardet/langhebrewmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langhungarianmodel.py +225 -0
- data/vendor/requests/packages/chardet/langhungarianmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langthaimodel.py +200 -0
- data/vendor/requests/packages/chardet/langthaimodel.pyc +0 -0
- data/vendor/requests/packages/chardet/latin1prober.py +139 -0
- data/vendor/requests/packages/chardet/latin1prober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcharsetprober.py +86 -0
- data/vendor/requests/packages/chardet/mbcharsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcsgroupprober.py +54 -0
- data/vendor/requests/packages/chardet/mbcsgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcssm.py +572 -0
- data/vendor/requests/packages/chardet/mbcssm.pyc +0 -0
- data/vendor/requests/packages/chardet/sbcharsetprober.py +120 -0
- data/vendor/requests/packages/chardet/sbcharsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/sbcsgroupprober.py +69 -0
- data/vendor/requests/packages/chardet/sbcsgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/sjisprober.py +91 -0
- data/vendor/requests/packages/chardet/sjisprober.pyc +0 -0
- data/vendor/requests/packages/chardet/universaldetector.py +170 -0
- data/vendor/requests/packages/chardet/universaldetector.pyc +0 -0
- data/vendor/requests/packages/chardet/utf8prober.py +76 -0
- data/vendor/requests/packages/chardet/utf8prober.pyc +0 -0
- data/vendor/requests/packages/urllib3/__init__.py +96 -0
- data/vendor/requests/packages/urllib3/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/_collections.py +324 -0
- data/vendor/requests/packages/urllib3/_collections.pyc +0 -0
- data/vendor/requests/packages/urllib3/connection.py +330 -0
- data/vendor/requests/packages/urllib3/connection.pyc +0 -0
- data/vendor/requests/packages/urllib3/connectionpool.py +866 -0
- data/vendor/requests/packages/urllib3/connectionpool.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/__init__.py +0 -0
- data/vendor/requests/packages/urllib3/contrib/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/appengine.py +231 -0
- data/vendor/requests/packages/urllib3/contrib/appengine.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/ntlmpool.py +115 -0
- data/vendor/requests/packages/urllib3/contrib/ntlmpool.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/pyopenssl.py +358 -0
- data/vendor/requests/packages/urllib3/contrib/pyopenssl.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/socks.py +172 -0
- data/vendor/requests/packages/urllib3/contrib/socks.pyc +0 -0
- data/vendor/requests/packages/urllib3/exceptions.py +209 -0
- data/vendor/requests/packages/urllib3/exceptions.pyc +0 -0
- data/vendor/requests/packages/urllib3/fields.py +178 -0
- data/vendor/requests/packages/urllib3/fields.pyc +0 -0
- data/vendor/requests/packages/urllib3/filepost.py +94 -0
- data/vendor/requests/packages/urllib3/filepost.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/__init__.py +5 -0
- data/vendor/requests/packages/urllib3/packages/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ordered_dict.py +259 -0
- data/vendor/requests/packages/urllib3/packages/ordered_dict.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/six.py +868 -0
- data/vendor/requests/packages/urllib3/packages/six.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py +13 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py +105 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyc +0 -0
- data/vendor/requests/packages/urllib3/poolmanager.py +367 -0
- data/vendor/requests/packages/urllib3/poolmanager.pyc +0 -0
- data/vendor/requests/packages/urllib3/request.py +151 -0
- data/vendor/requests/packages/urllib3/request.pyc +0 -0
- data/vendor/requests/packages/urllib3/response.py +530 -0
- data/vendor/requests/packages/urllib3/response.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/__init__.py +46 -0
- data/vendor/requests/packages/urllib3/util/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/connection.py +144 -0
- data/vendor/requests/packages/urllib3/util/connection.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/request.py +72 -0
- data/vendor/requests/packages/urllib3/util/request.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/response.py +74 -0
- data/vendor/requests/packages/urllib3/util/response.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/retry.py +300 -0
- data/vendor/requests/packages/urllib3/util/retry.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/ssl_.py +320 -0
- data/vendor/requests/packages/urllib3/util/ssl_.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/timeout.py +242 -0
- data/vendor/requests/packages/urllib3/util/timeout.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/url.py +217 -0
- data/vendor/requests/packages/urllib3/util/url.pyc +0 -0
- data/vendor/requests/sessions.py +712 -0
- data/vendor/requests/sessions.pyc +0 -0
- data/vendor/requests/status_codes.py +91 -0
- data/vendor/requests/status_codes.pyc +0 -0
- data/vendor/requests/structures.py +105 -0
- data/vendor/requests/structures.pyc +0 -0
- data/vendor/requests/utils.py +817 -0
- data/vendor/requests/utils.pyc +0 -0
- data/vendor/requests-2.11.1.dist-info/DESCRIPTION.rst +1294 -0
- data/vendor/requests-2.11.1.dist-info/INSTALLER +1 -0
- data/vendor/requests-2.11.1.dist-info/METADATA +1323 -0
- data/vendor/requests-2.11.1.dist-info/RECORD +170 -0
- data/vendor/requests-2.11.1.dist-info/WHEEL +6 -0
- data/vendor/requests-2.11.1.dist-info/metadata.json +1 -0
- data/vendor/requests-2.11.1.dist-info/top_level.txt +1 -0
- data/vendor/rigid/__init__.py +1 -0
- data/vendor/rigid/__init__.pyc +0 -0
- data/vendor/rigid/api.py +129 -0
- data/vendor/rigid/api.pyc +0 -0
- data/vendor/rigid/commands/__init__.py +260 -0
- data/vendor/rigid/commands/__init__.pyc +0 -0
- data/vendor/rigid/commands/deploy.py +0 -0
- data/vendor/rigid/commands/deploy.pyc +0 -0
- data/vendor/rigid/deploy.py +70 -0
- data/vendor/rigid/deploy.pyc +0 -0
- data/vendor/rigid/file_scanner.py +63 -0
- data/vendor/rigid/file_scanner.pyc +0 -0
- data/vendor/rigid/utils.py +17 -0
- data/vendor/rigid/utils.pyc +0 -0
- data/vendor/rigid-0.2.0.dist-info/DESCRIPTION.rst +3 -0
- data/vendor/rigid-0.2.0.dist-info/INSTALLER +1 -0
- data/vendor/rigid-0.2.0.dist-info/METADATA +23 -0
- data/vendor/rigid-0.2.0.dist-info/RECORD +49 -0
- data/vendor/rigid-0.2.0.dist-info/WHEEL +5 -0
- data/vendor/rigid-0.2.0.dist-info/entry_points.txt +3 -0
- data/vendor/rigid-0.2.0.dist-info/metadata.json +1 -0
- data/vendor/rigid-0.2.0.dist-info/top_level.txt +2 -0
- data/vendor/setuptools-28.8.0.dist-info/DESCRIPTION.rst +243 -0
- data/vendor/setuptools-28.8.0.dist-info/INSTALLER +1 -0
- data/vendor/setuptools-28.8.0.dist-info/METADATA +272 -0
- data/vendor/setuptools-28.8.0.dist-info/RECORD +143 -0
- data/vendor/setuptools-28.8.0.dist-info/WHEEL +6 -0
- data/vendor/setuptools-28.8.0.dist-info/dependency_links.txt +2 -0
- data/vendor/setuptools-28.8.0.dist-info/entry_points.txt +63 -0
- data/vendor/setuptools-28.8.0.dist-info/metadata.json +1 -0
- data/vendor/setuptools-28.8.0.dist-info/top_level.txt +3 -0
- data/vendor/setuptools-28.8.0.dist-info/zip-safe +1 -0
- data/vendor/tests/__init__.py +0 -0
- data/vendor/tests/__init__.pyc +0 -0
- data/vendor/tests/integration/__init__.py +0 -0
- data/vendor/tests/integration/__init__.pyc +0 -0
- data/vendor/tests/integration/test_app.py +63 -0
- data/vendor/tests/integration/test_app.pyc +0 -0
- data/vendor/tests/integration/test_apps.py +27 -0
- data/vendor/tests/integration/test_apps.pyc +0 -0
- data/vendor/tests/integration/test_deploy.py +128 -0
- data/vendor/tests/integration/test_deploy.pyc +0 -0
- data/vendor/tests/integration/test_domains.py +35 -0
- data/vendor/tests/integration/test_domains.pyc +0 -0
- data/vendor/tests/integration/test_login.py +37 -0
- data/vendor/tests/integration/test_login.pyc +0 -0
- data/vendor/tests/integration/test_promote.py +24 -0
- data/vendor/tests/integration/test_promote.pyc +0 -0
- data/vendor/tests/integration/test_token.py +33 -0
- data/vendor/tests/integration/test_token.pyc +0 -0
- data/vendor/tests/integration/test_whoami.py +24 -0
- data/vendor/tests/integration/test_whoami.pyc +0 -0
- data/vendor/tests/test_deploy.py +33 -0
- data/vendor/tests/test_deploy.pyc +0 -0
- data/vendor/tests/test_file_scanner.py +89 -0
- data/vendor/tests/test_file_scanner.pyc +0 -0
- data/vendor/tests/utils.py +78 -0
- data/vendor/tests/utils.pyc +0 -0
- data/vendor/wheel-0.30.0a0.dist-info/DESCRIPTION.rst +325 -0
- data/vendor/wheel-0.30.0a0.dist-info/INSTALLER +1 -0
- data/vendor/wheel-0.30.0a0.dist-info/LICENSE.txt +22 -0
- data/vendor/wheel-0.30.0a0.dist-info/METADATA +357 -0
- data/vendor/wheel-0.30.0a0.dist-info/RECORD +86 -0
- data/vendor/wheel-0.30.0a0.dist-info/WHEEL +6 -0
- data/vendor/wheel-0.30.0a0.dist-info/entry_points.txt +6 -0
- data/vendor/wheel-0.30.0a0.dist-info/metadata.json +1 -0
- data/vendor/wheel-0.30.0a0.dist-info/top_level.txt +1 -0
- data/vendor/yaml/__init__.py +315 -0
- data/vendor/yaml/__init__.pyc +0 -0
- data/vendor/yaml/composer.py +139 -0
- data/vendor/yaml/composer.pyc +0 -0
- data/vendor/yaml/constructor.py +675 -0
- data/vendor/yaml/constructor.pyc +0 -0
- data/vendor/yaml/cyaml.py +85 -0
- data/vendor/yaml/cyaml.pyc +0 -0
- data/vendor/yaml/dumper.py +62 -0
- data/vendor/yaml/dumper.pyc +0 -0
- data/vendor/yaml/emitter.py +1140 -0
- data/vendor/yaml/emitter.pyc +0 -0
- data/vendor/yaml/error.py +75 -0
- data/vendor/yaml/error.pyc +0 -0
- data/vendor/yaml/events.py +86 -0
- data/vendor/yaml/events.pyc +0 -0
- data/vendor/yaml/loader.py +40 -0
- data/vendor/yaml/loader.pyc +0 -0
- data/vendor/yaml/nodes.py +49 -0
- data/vendor/yaml/nodes.pyc +0 -0
- data/vendor/yaml/parser.py +589 -0
- data/vendor/yaml/parser.pyc +0 -0
- data/vendor/yaml/reader.py +190 -0
- data/vendor/yaml/reader.pyc +0 -0
- data/vendor/yaml/representer.py +486 -0
- data/vendor/yaml/representer.pyc +0 -0
- data/vendor/yaml/resolver.py +227 -0
- data/vendor/yaml/resolver.pyc +0 -0
- data/vendor/yaml/scanner.py +1453 -0
- data/vendor/yaml/scanner.pyc +0 -0
- data/vendor/yaml/serializer.py +111 -0
- data/vendor/yaml/serializer.pyc +0 -0
- data/vendor/yaml/tokens.py +104 -0
- data/vendor/yaml/tokens.pyc +0 -0
- metadata +407 -0
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is Mozilla Communicator client code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
#
|
12
|
+
# This library is free software; you can redistribute it and/or
|
13
|
+
# modify it under the terms of the GNU Lesser General Public
|
14
|
+
# License as published by the Free Software Foundation; either
|
15
|
+
# version 2.1 of the License, or (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
20
|
+
# Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public
|
23
|
+
# License along with this library; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
25
|
+
# 02110-1301 USA
|
26
|
+
######################### END LICENSE BLOCK #########################
|
27
|
+
|
28
|
+
from .mbcharsetprober import MultiByteCharSetProber
|
29
|
+
from .codingstatemachine import CodingStateMachine
|
30
|
+
from .chardistribution import Big5DistributionAnalysis
|
31
|
+
from .mbcssm import Big5SMModel
|
32
|
+
|
33
|
+
|
34
|
+
class Big5Prober(MultiByteCharSetProber):
|
35
|
+
def __init__(self):
|
36
|
+
MultiByteCharSetProber.__init__(self)
|
37
|
+
self._mCodingSM = CodingStateMachine(Big5SMModel)
|
38
|
+
self._mDistributionAnalyzer = Big5DistributionAnalysis()
|
39
|
+
self.reset()
|
40
|
+
|
41
|
+
def get_charset_name(self):
|
42
|
+
return "Big5"
|
Binary file
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
"""
|
3
|
+
Script which takes one or more file paths and reports on their detected
|
4
|
+
encodings
|
5
|
+
|
6
|
+
Example::
|
7
|
+
|
8
|
+
% chardetect somefile someotherfile
|
9
|
+
somefile: windows-1252 with confidence 0.5
|
10
|
+
someotherfile: ascii with confidence 1.0
|
11
|
+
|
12
|
+
If no paths are provided, it takes its input from stdin.
|
13
|
+
|
14
|
+
"""
|
15
|
+
|
16
|
+
from __future__ import absolute_import, print_function, unicode_literals
|
17
|
+
|
18
|
+
import argparse
|
19
|
+
import sys
|
20
|
+
from io import open
|
21
|
+
|
22
|
+
from chardet import __version__
|
23
|
+
from chardet.universaldetector import UniversalDetector
|
24
|
+
|
25
|
+
|
26
|
+
def description_of(lines, name='stdin'):
|
27
|
+
"""
|
28
|
+
Return a string describing the probable encoding of a file or
|
29
|
+
list of strings.
|
30
|
+
|
31
|
+
:param lines: The lines to get the encoding of.
|
32
|
+
:type lines: Iterable of bytes
|
33
|
+
:param name: Name of file or collection of lines
|
34
|
+
:type name: str
|
35
|
+
"""
|
36
|
+
u = UniversalDetector()
|
37
|
+
for line in lines:
|
38
|
+
u.feed(line)
|
39
|
+
u.close()
|
40
|
+
result = u.result
|
41
|
+
if result['encoding']:
|
42
|
+
return '{0}: {1} with confidence {2}'.format(name, result['encoding'],
|
43
|
+
result['confidence'])
|
44
|
+
else:
|
45
|
+
return '{0}: no result'.format(name)
|
46
|
+
|
47
|
+
|
48
|
+
def main(argv=None):
|
49
|
+
'''
|
50
|
+
Handles command line arguments and gets things started.
|
51
|
+
|
52
|
+
:param argv: List of arguments, as if specified on the command-line.
|
53
|
+
If None, ``sys.argv[1:]`` is used instead.
|
54
|
+
:type argv: list of str
|
55
|
+
'''
|
56
|
+
# Get command line arguments
|
57
|
+
parser = argparse.ArgumentParser(
|
58
|
+
description="Takes one or more file paths and reports their detected \
|
59
|
+
encodings",
|
60
|
+
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
61
|
+
conflict_handler='resolve')
|
62
|
+
parser.add_argument('input',
|
63
|
+
help='File whose encoding we would like to determine.',
|
64
|
+
type=argparse.FileType('rb'), nargs='*',
|
65
|
+
default=[sys.stdin])
|
66
|
+
parser.add_argument('--version', action='version',
|
67
|
+
version='%(prog)s {0}'.format(__version__))
|
68
|
+
args = parser.parse_args(argv)
|
69
|
+
|
70
|
+
for f in args.input:
|
71
|
+
if f.isatty():
|
72
|
+
print("You are running chardetect interactively. Press " +
|
73
|
+
"CTRL-D twice at the start of a blank line to signal the " +
|
74
|
+
"end of your input. If you want help, run chardetect " +
|
75
|
+
"--help\n", file=sys.stderr)
|
76
|
+
print(description_of(f, f.name))
|
77
|
+
|
78
|
+
|
79
|
+
if __name__ == '__main__':
|
80
|
+
main()
|
Binary file
|
@@ -0,0 +1,231 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is Mozilla Communicator client code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
#
|
12
|
+
# This library is free software; you can redistribute it and/or
|
13
|
+
# modify it under the terms of the GNU Lesser General Public
|
14
|
+
# License as published by the Free Software Foundation; either
|
15
|
+
# version 2.1 of the License, or (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
20
|
+
# Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public
|
23
|
+
# License along with this library; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
25
|
+
# 02110-1301 USA
|
26
|
+
######################### END LICENSE BLOCK #########################
|
27
|
+
|
28
|
+
from .euctwfreq import (EUCTWCharToFreqOrder, EUCTW_TABLE_SIZE,
|
29
|
+
EUCTW_TYPICAL_DISTRIBUTION_RATIO)
|
30
|
+
from .euckrfreq import (EUCKRCharToFreqOrder, EUCKR_TABLE_SIZE,
|
31
|
+
EUCKR_TYPICAL_DISTRIBUTION_RATIO)
|
32
|
+
from .gb2312freq import (GB2312CharToFreqOrder, GB2312_TABLE_SIZE,
|
33
|
+
GB2312_TYPICAL_DISTRIBUTION_RATIO)
|
34
|
+
from .big5freq import (Big5CharToFreqOrder, BIG5_TABLE_SIZE,
|
35
|
+
BIG5_TYPICAL_DISTRIBUTION_RATIO)
|
36
|
+
from .jisfreq import (JISCharToFreqOrder, JIS_TABLE_SIZE,
|
37
|
+
JIS_TYPICAL_DISTRIBUTION_RATIO)
|
38
|
+
from .compat import wrap_ord
|
39
|
+
|
40
|
+
ENOUGH_DATA_THRESHOLD = 1024
|
41
|
+
SURE_YES = 0.99
|
42
|
+
SURE_NO = 0.01
|
43
|
+
MINIMUM_DATA_THRESHOLD = 3
|
44
|
+
|
45
|
+
|
46
|
+
class CharDistributionAnalysis:
|
47
|
+
def __init__(self):
|
48
|
+
# Mapping table to get frequency order from char order (get from
|
49
|
+
# GetOrder())
|
50
|
+
self._mCharToFreqOrder = None
|
51
|
+
self._mTableSize = None # Size of above table
|
52
|
+
# This is a constant value which varies from language to language,
|
53
|
+
# used in calculating confidence. See
|
54
|
+
# http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html
|
55
|
+
# for further detail.
|
56
|
+
self._mTypicalDistributionRatio = None
|
57
|
+
self.reset()
|
58
|
+
|
59
|
+
def reset(self):
|
60
|
+
"""reset analyser, clear any state"""
|
61
|
+
# If this flag is set to True, detection is done and conclusion has
|
62
|
+
# been made
|
63
|
+
self._mDone = False
|
64
|
+
self._mTotalChars = 0 # Total characters encountered
|
65
|
+
# The number of characters whose frequency order is less than 512
|
66
|
+
self._mFreqChars = 0
|
67
|
+
|
68
|
+
def feed(self, aBuf, aCharLen):
|
69
|
+
"""feed a character with known length"""
|
70
|
+
if aCharLen == 2:
|
71
|
+
# we only care about 2-bytes character in our distribution analysis
|
72
|
+
order = self.get_order(aBuf)
|
73
|
+
else:
|
74
|
+
order = -1
|
75
|
+
if order >= 0:
|
76
|
+
self._mTotalChars += 1
|
77
|
+
# order is valid
|
78
|
+
if order < self._mTableSize:
|
79
|
+
if 512 > self._mCharToFreqOrder[order]:
|
80
|
+
self._mFreqChars += 1
|
81
|
+
|
82
|
+
def get_confidence(self):
|
83
|
+
"""return confidence based on existing data"""
|
84
|
+
# if we didn't receive any character in our consideration range,
|
85
|
+
# return negative answer
|
86
|
+
if self._mTotalChars <= 0 or self._mFreqChars <= MINIMUM_DATA_THRESHOLD:
|
87
|
+
return SURE_NO
|
88
|
+
|
89
|
+
if self._mTotalChars != self._mFreqChars:
|
90
|
+
r = (self._mFreqChars / ((self._mTotalChars - self._mFreqChars)
|
91
|
+
* self._mTypicalDistributionRatio))
|
92
|
+
if r < SURE_YES:
|
93
|
+
return r
|
94
|
+
|
95
|
+
# normalize confidence (we don't want to be 100% sure)
|
96
|
+
return SURE_YES
|
97
|
+
|
98
|
+
def got_enough_data(self):
|
99
|
+
# It is not necessary to receive all data to draw conclusion.
|
100
|
+
# For charset detection, certain amount of data is enough
|
101
|
+
return self._mTotalChars > ENOUGH_DATA_THRESHOLD
|
102
|
+
|
103
|
+
def get_order(self, aBuf):
|
104
|
+
# We do not handle characters based on the original encoding string,
|
105
|
+
# but convert this encoding string to a number, here called order.
|
106
|
+
# This allows multiple encodings of a language to share one frequency
|
107
|
+
# table.
|
108
|
+
return -1
|
109
|
+
|
110
|
+
|
111
|
+
class EUCTWDistributionAnalysis(CharDistributionAnalysis):
|
112
|
+
def __init__(self):
|
113
|
+
CharDistributionAnalysis.__init__(self)
|
114
|
+
self._mCharToFreqOrder = EUCTWCharToFreqOrder
|
115
|
+
self._mTableSize = EUCTW_TABLE_SIZE
|
116
|
+
self._mTypicalDistributionRatio = EUCTW_TYPICAL_DISTRIBUTION_RATIO
|
117
|
+
|
118
|
+
def get_order(self, aBuf):
|
119
|
+
# for euc-TW encoding, we are interested
|
120
|
+
# first byte range: 0xc4 -- 0xfe
|
121
|
+
# second byte range: 0xa1 -- 0xfe
|
122
|
+
# no validation needed here. State machine has done that
|
123
|
+
first_char = wrap_ord(aBuf[0])
|
124
|
+
if first_char >= 0xC4:
|
125
|
+
return 94 * (first_char - 0xC4) + wrap_ord(aBuf[1]) - 0xA1
|
126
|
+
else:
|
127
|
+
return -1
|
128
|
+
|
129
|
+
|
130
|
+
class EUCKRDistributionAnalysis(CharDistributionAnalysis):
|
131
|
+
def __init__(self):
|
132
|
+
CharDistributionAnalysis.__init__(self)
|
133
|
+
self._mCharToFreqOrder = EUCKRCharToFreqOrder
|
134
|
+
self._mTableSize = EUCKR_TABLE_SIZE
|
135
|
+
self._mTypicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO
|
136
|
+
|
137
|
+
def get_order(self, aBuf):
|
138
|
+
# for euc-KR encoding, we are interested
|
139
|
+
# first byte range: 0xb0 -- 0xfe
|
140
|
+
# second byte range: 0xa1 -- 0xfe
|
141
|
+
# no validation needed here. State machine has done that
|
142
|
+
first_char = wrap_ord(aBuf[0])
|
143
|
+
if first_char >= 0xB0:
|
144
|
+
return 94 * (first_char - 0xB0) + wrap_ord(aBuf[1]) - 0xA1
|
145
|
+
else:
|
146
|
+
return -1
|
147
|
+
|
148
|
+
|
149
|
+
class GB2312DistributionAnalysis(CharDistributionAnalysis):
|
150
|
+
def __init__(self):
|
151
|
+
CharDistributionAnalysis.__init__(self)
|
152
|
+
self._mCharToFreqOrder = GB2312CharToFreqOrder
|
153
|
+
self._mTableSize = GB2312_TABLE_SIZE
|
154
|
+
self._mTypicalDistributionRatio = GB2312_TYPICAL_DISTRIBUTION_RATIO
|
155
|
+
|
156
|
+
def get_order(self, aBuf):
|
157
|
+
# for GB2312 encoding, we are interested
|
158
|
+
# first byte range: 0xb0 -- 0xfe
|
159
|
+
# second byte range: 0xa1 -- 0xfe
|
160
|
+
# no validation needed here. State machine has done that
|
161
|
+
first_char, second_char = wrap_ord(aBuf[0]), wrap_ord(aBuf[1])
|
162
|
+
if (first_char >= 0xB0) and (second_char >= 0xA1):
|
163
|
+
return 94 * (first_char - 0xB0) + second_char - 0xA1
|
164
|
+
else:
|
165
|
+
return -1
|
166
|
+
|
167
|
+
|
168
|
+
class Big5DistributionAnalysis(CharDistributionAnalysis):
|
169
|
+
def __init__(self):
|
170
|
+
CharDistributionAnalysis.__init__(self)
|
171
|
+
self._mCharToFreqOrder = Big5CharToFreqOrder
|
172
|
+
self._mTableSize = BIG5_TABLE_SIZE
|
173
|
+
self._mTypicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO
|
174
|
+
|
175
|
+
def get_order(self, aBuf):
|
176
|
+
# for big5 encoding, we are interested
|
177
|
+
# first byte range: 0xa4 -- 0xfe
|
178
|
+
# second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe
|
179
|
+
# no validation needed here. State machine has done that
|
180
|
+
first_char, second_char = wrap_ord(aBuf[0]), wrap_ord(aBuf[1])
|
181
|
+
if first_char >= 0xA4:
|
182
|
+
if second_char >= 0xA1:
|
183
|
+
return 157 * (first_char - 0xA4) + second_char - 0xA1 + 63
|
184
|
+
else:
|
185
|
+
return 157 * (first_char - 0xA4) + second_char - 0x40
|
186
|
+
else:
|
187
|
+
return -1
|
188
|
+
|
189
|
+
|
190
|
+
class SJISDistributionAnalysis(CharDistributionAnalysis):
|
191
|
+
def __init__(self):
|
192
|
+
CharDistributionAnalysis.__init__(self)
|
193
|
+
self._mCharToFreqOrder = JISCharToFreqOrder
|
194
|
+
self._mTableSize = JIS_TABLE_SIZE
|
195
|
+
self._mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO
|
196
|
+
|
197
|
+
def get_order(self, aBuf):
|
198
|
+
# for sjis encoding, we are interested
|
199
|
+
# first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
|
200
|
+
# second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
|
201
|
+
# no validation needed here. State machine has done that
|
202
|
+
first_char, second_char = wrap_ord(aBuf[0]), wrap_ord(aBuf[1])
|
203
|
+
if (first_char >= 0x81) and (first_char <= 0x9F):
|
204
|
+
order = 188 * (first_char - 0x81)
|
205
|
+
elif (first_char >= 0xE0) and (first_char <= 0xEF):
|
206
|
+
order = 188 * (first_char - 0xE0 + 31)
|
207
|
+
else:
|
208
|
+
return -1
|
209
|
+
order = order + second_char - 0x40
|
210
|
+
if second_char > 0x7F:
|
211
|
+
order = -1
|
212
|
+
return order
|
213
|
+
|
214
|
+
|
215
|
+
class EUCJPDistributionAnalysis(CharDistributionAnalysis):
|
216
|
+
def __init__(self):
|
217
|
+
CharDistributionAnalysis.__init__(self)
|
218
|
+
self._mCharToFreqOrder = JISCharToFreqOrder
|
219
|
+
self._mTableSize = JIS_TABLE_SIZE
|
220
|
+
self._mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO
|
221
|
+
|
222
|
+
def get_order(self, aBuf):
|
223
|
+
# for euc-JP encoding, we are interested
|
224
|
+
# first byte range: 0xa0 -- 0xfe
|
225
|
+
# second byte range: 0xa1 -- 0xfe
|
226
|
+
# no validation needed here. State machine has done that
|
227
|
+
char = wrap_ord(aBuf[0])
|
228
|
+
if char >= 0xA0:
|
229
|
+
return 94 * (char - 0xA1) + wrap_ord(aBuf[1]) - 0xa1
|
230
|
+
else:
|
231
|
+
return -1
|
Binary file
|
@@ -0,0 +1,106 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is Mozilla Communicator client code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
#
|
12
|
+
# This library is free software; you can redistribute it and/or
|
13
|
+
# modify it under the terms of the GNU Lesser General Public
|
14
|
+
# License as published by the Free Software Foundation; either
|
15
|
+
# version 2.1 of the License, or (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
20
|
+
# Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public
|
23
|
+
# License along with this library; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
25
|
+
# 02110-1301 USA
|
26
|
+
######################### END LICENSE BLOCK #########################
|
27
|
+
|
28
|
+
from . import constants
|
29
|
+
import sys
|
30
|
+
from .charsetprober import CharSetProber
|
31
|
+
|
32
|
+
|
33
|
+
class CharSetGroupProber(CharSetProber):
|
34
|
+
def __init__(self):
|
35
|
+
CharSetProber.__init__(self)
|
36
|
+
self._mActiveNum = 0
|
37
|
+
self._mProbers = []
|
38
|
+
self._mBestGuessProber = None
|
39
|
+
|
40
|
+
def reset(self):
|
41
|
+
CharSetProber.reset(self)
|
42
|
+
self._mActiveNum = 0
|
43
|
+
for prober in self._mProbers:
|
44
|
+
if prober:
|
45
|
+
prober.reset()
|
46
|
+
prober.active = True
|
47
|
+
self._mActiveNum += 1
|
48
|
+
self._mBestGuessProber = None
|
49
|
+
|
50
|
+
def get_charset_name(self):
|
51
|
+
if not self._mBestGuessProber:
|
52
|
+
self.get_confidence()
|
53
|
+
if not self._mBestGuessProber:
|
54
|
+
return None
|
55
|
+
# self._mBestGuessProber = self._mProbers[0]
|
56
|
+
return self._mBestGuessProber.get_charset_name()
|
57
|
+
|
58
|
+
def feed(self, aBuf):
|
59
|
+
for prober in self._mProbers:
|
60
|
+
if not prober:
|
61
|
+
continue
|
62
|
+
if not prober.active:
|
63
|
+
continue
|
64
|
+
st = prober.feed(aBuf)
|
65
|
+
if not st:
|
66
|
+
continue
|
67
|
+
if st == constants.eFoundIt:
|
68
|
+
self._mBestGuessProber = prober
|
69
|
+
return self.get_state()
|
70
|
+
elif st == constants.eNotMe:
|
71
|
+
prober.active = False
|
72
|
+
self._mActiveNum -= 1
|
73
|
+
if self._mActiveNum <= 0:
|
74
|
+
self._mState = constants.eNotMe
|
75
|
+
return self.get_state()
|
76
|
+
return self.get_state()
|
77
|
+
|
78
|
+
def get_confidence(self):
|
79
|
+
st = self.get_state()
|
80
|
+
if st == constants.eFoundIt:
|
81
|
+
return 0.99
|
82
|
+
elif st == constants.eNotMe:
|
83
|
+
return 0.01
|
84
|
+
bestConf = 0.0
|
85
|
+
self._mBestGuessProber = None
|
86
|
+
for prober in self._mProbers:
|
87
|
+
if not prober:
|
88
|
+
continue
|
89
|
+
if not prober.active:
|
90
|
+
if constants._debug:
|
91
|
+
sys.stderr.write(prober.get_charset_name()
|
92
|
+
+ ' not active\n')
|
93
|
+
continue
|
94
|
+
cf = prober.get_confidence()
|
95
|
+
if constants._debug:
|
96
|
+
sys.stderr.write('%s confidence = %s\n' %
|
97
|
+
(prober.get_charset_name(), cf))
|
98
|
+
if bestConf < cf:
|
99
|
+
bestConf = cf
|
100
|
+
self._mBestGuessProber = prober
|
101
|
+
if not self._mBestGuessProber:
|
102
|
+
return 0.0
|
103
|
+
return bestConf
|
104
|
+
# else:
|
105
|
+
# self._mBestGuessProber = self._mProbers[0]
|
106
|
+
# return self._mBestGuessProber.get_confidence()
|
Binary file
|
@@ -0,0 +1,62 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is Mozilla Universal charset detector code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
# Shy Shalom - original C code
|
12
|
+
#
|
13
|
+
# This library is free software; you can redistribute it and/or
|
14
|
+
# modify it under the terms of the GNU Lesser General Public
|
15
|
+
# License as published by the Free Software Foundation; either
|
16
|
+
# version 2.1 of the License, or (at your option) any later version.
|
17
|
+
#
|
18
|
+
# This library is distributed in the hope that it will be useful,
|
19
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
# Lesser General Public License for more details.
|
22
|
+
#
|
23
|
+
# You should have received a copy of the GNU Lesser General Public
|
24
|
+
# License along with this library; if not, write to the Free Software
|
25
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
26
|
+
# 02110-1301 USA
|
27
|
+
######################### END LICENSE BLOCK #########################
|
28
|
+
|
29
|
+
from . import constants
|
30
|
+
import re
|
31
|
+
|
32
|
+
|
33
|
+
class CharSetProber:
|
34
|
+
def __init__(self):
|
35
|
+
pass
|
36
|
+
|
37
|
+
def reset(self):
|
38
|
+
self._mState = constants.eDetecting
|
39
|
+
|
40
|
+
def get_charset_name(self):
|
41
|
+
return None
|
42
|
+
|
43
|
+
def feed(self, aBuf):
|
44
|
+
pass
|
45
|
+
|
46
|
+
def get_state(self):
|
47
|
+
return self._mState
|
48
|
+
|
49
|
+
def get_confidence(self):
|
50
|
+
return 0.0
|
51
|
+
|
52
|
+
def filter_high_bit_only(self, aBuf):
|
53
|
+
aBuf = re.sub(b'([\x00-\x7F])+', b' ', aBuf)
|
54
|
+
return aBuf
|
55
|
+
|
56
|
+
def filter_without_english_letters(self, aBuf):
|
57
|
+
aBuf = re.sub(b'([A-Za-z])+', b' ', aBuf)
|
58
|
+
return aBuf
|
59
|
+
|
60
|
+
def filter_with_english_letters(self, aBuf):
|
61
|
+
# TODO
|
62
|
+
return aBuf
|
Binary file
|
@@ -0,0 +1,61 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is mozilla.org code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 1998
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
#
|
12
|
+
# This library is free software; you can redistribute it and/or
|
13
|
+
# modify it under the terms of the GNU Lesser General Public
|
14
|
+
# License as published by the Free Software Foundation; either
|
15
|
+
# version 2.1 of the License, or (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This library is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
20
|
+
# Lesser General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU Lesser General Public
|
23
|
+
# License along with this library; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
25
|
+
# 02110-1301 USA
|
26
|
+
######################### END LICENSE BLOCK #########################
|
27
|
+
|
28
|
+
from .constants import eStart
|
29
|
+
from .compat import wrap_ord
|
30
|
+
|
31
|
+
|
32
|
+
class CodingStateMachine:
|
33
|
+
def __init__(self, sm):
|
34
|
+
self._mModel = sm
|
35
|
+
self._mCurrentBytePos = 0
|
36
|
+
self._mCurrentCharLen = 0
|
37
|
+
self.reset()
|
38
|
+
|
39
|
+
def reset(self):
|
40
|
+
self._mCurrentState = eStart
|
41
|
+
|
42
|
+
def next_state(self, c):
|
43
|
+
# for each byte we get its class
|
44
|
+
# if it is first byte, we also get byte length
|
45
|
+
# PY3K: aBuf is a byte stream, so c is an int, not a byte
|
46
|
+
byteCls = self._mModel['classTable'][wrap_ord(c)]
|
47
|
+
if self._mCurrentState == eStart:
|
48
|
+
self._mCurrentBytePos = 0
|
49
|
+
self._mCurrentCharLen = self._mModel['charLenTable'][byteCls]
|
50
|
+
# from byte's class and stateTable, we get its next state
|
51
|
+
curr_state = (self._mCurrentState * self._mModel['classFactor']
|
52
|
+
+ byteCls)
|
53
|
+
self._mCurrentState = self._mModel['stateTable'][curr_state]
|
54
|
+
self._mCurrentBytePos += 1
|
55
|
+
return self._mCurrentState
|
56
|
+
|
57
|
+
def get_current_charlen(self):
|
58
|
+
return self._mCurrentCharLen
|
59
|
+
|
60
|
+
def get_coding_state_machine(self):
|
61
|
+
return self._mModel['name']
|
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# Contributor(s):
|
3
|
+
# Ian Cordasco - port to Python
|
4
|
+
#
|
5
|
+
# This library is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
7
|
+
# License as published by the Free Software Foundation; either
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
# Lesser General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
16
|
+
# License along with this library; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
18
|
+
# 02110-1301 USA
|
19
|
+
######################### END LICENSE BLOCK #########################
|
20
|
+
|
21
|
+
import sys
|
22
|
+
|
23
|
+
|
24
|
+
if sys.version_info < (3, 0):
|
25
|
+
base_str = (str, unicode)
|
26
|
+
else:
|
27
|
+
base_str = (bytes, str)
|
28
|
+
|
29
|
+
|
30
|
+
def wrap_ord(a):
|
31
|
+
if sys.version_info < (3, 0) and isinstance(a, base_str):
|
32
|
+
return ord(a)
|
33
|
+
else:
|
34
|
+
return a
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
######################## BEGIN LICENSE BLOCK ########################
|
2
|
+
# The Original Code is Mozilla Universal charset detector code.
|
3
|
+
#
|
4
|
+
# The Initial Developer of the Original Code is
|
5
|
+
# Netscape Communications Corporation.
|
6
|
+
# Portions created by the Initial Developer are Copyright (C) 2001
|
7
|
+
# the Initial Developer. All Rights Reserved.
|
8
|
+
#
|
9
|
+
# Contributor(s):
|
10
|
+
# Mark Pilgrim - port to Python
|
11
|
+
# Shy Shalom - original C code
|
12
|
+
#
|
13
|
+
# This library is free software; you can redistribute it and/or
|
14
|
+
# modify it under the terms of the GNU Lesser General Public
|
15
|
+
# License as published by the Free Software Foundation; either
|
16
|
+
# version 2.1 of the License, or (at your option) any later version.
|
17
|
+
#
|
18
|
+
# This library is distributed in the hope that it will be useful,
|
19
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
21
|
+
# Lesser General Public License for more details.
|
22
|
+
#
|
23
|
+
# You should have received a copy of the GNU Lesser General Public
|
24
|
+
# License along with this library; if not, write to the Free Software
|
25
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
26
|
+
# 02110-1301 USA
|
27
|
+
######################### END LICENSE BLOCK #########################
|
28
|
+
|
29
|
+
_debug = 0
|
30
|
+
|
31
|
+
eDetecting = 0
|
32
|
+
eFoundIt = 1
|
33
|
+
eNotMe = 2
|
34
|
+
|
35
|
+
eStart = 0
|
36
|
+
eError = 1
|
37
|
+
eItsMe = 2
|
38
|
+
|
39
|
+
SHORTCUT_THRESHOLD = 0.95
|
Binary file
|