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
@@ -0,0 +1,190 @@
|
|
1
|
+
# This module contains abstractions for the input stream. You don't have to
|
2
|
+
# looks further, there are no pretty code.
|
3
|
+
#
|
4
|
+
# We define two classes here.
|
5
|
+
#
|
6
|
+
# Mark(source, line, column)
|
7
|
+
# It's just a record and its only use is producing nice error messages.
|
8
|
+
# Parser does not use it for any other purposes.
|
9
|
+
#
|
10
|
+
# Reader(source, data)
|
11
|
+
# Reader determines the encoding of `data` and converts it to unicode.
|
12
|
+
# Reader provides the following methods and attributes:
|
13
|
+
# reader.peek(length=1) - return the next `length` characters
|
14
|
+
# reader.forward(length=1) - move the current position to `length` characters.
|
15
|
+
# reader.index - the number of the current character.
|
16
|
+
# reader.line, stream.column - the line and the column of the current character.
|
17
|
+
|
18
|
+
__all__ = ['Reader', 'ReaderError']
|
19
|
+
|
20
|
+
from error import YAMLError, Mark
|
21
|
+
|
22
|
+
import codecs, re
|
23
|
+
|
24
|
+
class ReaderError(YAMLError):
|
25
|
+
|
26
|
+
def __init__(self, name, position, character, encoding, reason):
|
27
|
+
self.name = name
|
28
|
+
self.character = character
|
29
|
+
self.position = position
|
30
|
+
self.encoding = encoding
|
31
|
+
self.reason = reason
|
32
|
+
|
33
|
+
def __str__(self):
|
34
|
+
if isinstance(self.character, str):
|
35
|
+
return "'%s' codec can't decode byte #x%02x: %s\n" \
|
36
|
+
" in \"%s\", position %d" \
|
37
|
+
% (self.encoding, ord(self.character), self.reason,
|
38
|
+
self.name, self.position)
|
39
|
+
else:
|
40
|
+
return "unacceptable character #x%04x: %s\n" \
|
41
|
+
" in \"%s\", position %d" \
|
42
|
+
% (self.character, self.reason,
|
43
|
+
self.name, self.position)
|
44
|
+
|
45
|
+
class Reader(object):
|
46
|
+
# Reader:
|
47
|
+
# - determines the data encoding and converts it to unicode,
|
48
|
+
# - checks if characters are in allowed range,
|
49
|
+
# - adds '\0' to the end.
|
50
|
+
|
51
|
+
# Reader accepts
|
52
|
+
# - a `str` object,
|
53
|
+
# - a `unicode` object,
|
54
|
+
# - a file-like object with its `read` method returning `str`,
|
55
|
+
# - a file-like object with its `read` method returning `unicode`.
|
56
|
+
|
57
|
+
# Yeah, it's ugly and slow.
|
58
|
+
|
59
|
+
def __init__(self, stream):
|
60
|
+
self.name = None
|
61
|
+
self.stream = None
|
62
|
+
self.stream_pointer = 0
|
63
|
+
self.eof = True
|
64
|
+
self.buffer = u''
|
65
|
+
self.pointer = 0
|
66
|
+
self.raw_buffer = None
|
67
|
+
self.raw_decode = None
|
68
|
+
self.encoding = None
|
69
|
+
self.index = 0
|
70
|
+
self.line = 0
|
71
|
+
self.column = 0
|
72
|
+
if isinstance(stream, unicode):
|
73
|
+
self.name = "<unicode string>"
|
74
|
+
self.check_printable(stream)
|
75
|
+
self.buffer = stream+u'\0'
|
76
|
+
elif isinstance(stream, str):
|
77
|
+
self.name = "<string>"
|
78
|
+
self.raw_buffer = stream
|
79
|
+
self.determine_encoding()
|
80
|
+
else:
|
81
|
+
self.stream = stream
|
82
|
+
self.name = getattr(stream, 'name', "<file>")
|
83
|
+
self.eof = False
|
84
|
+
self.raw_buffer = ''
|
85
|
+
self.determine_encoding()
|
86
|
+
|
87
|
+
def peek(self, index=0):
|
88
|
+
try:
|
89
|
+
return self.buffer[self.pointer+index]
|
90
|
+
except IndexError:
|
91
|
+
self.update(index+1)
|
92
|
+
return self.buffer[self.pointer+index]
|
93
|
+
|
94
|
+
def prefix(self, length=1):
|
95
|
+
if self.pointer+length >= len(self.buffer):
|
96
|
+
self.update(length)
|
97
|
+
return self.buffer[self.pointer:self.pointer+length]
|
98
|
+
|
99
|
+
def forward(self, length=1):
|
100
|
+
if self.pointer+length+1 >= len(self.buffer):
|
101
|
+
self.update(length+1)
|
102
|
+
while length:
|
103
|
+
ch = self.buffer[self.pointer]
|
104
|
+
self.pointer += 1
|
105
|
+
self.index += 1
|
106
|
+
if ch in u'\n\x85\u2028\u2029' \
|
107
|
+
or (ch == u'\r' and self.buffer[self.pointer] != u'\n'):
|
108
|
+
self.line += 1
|
109
|
+
self.column = 0
|
110
|
+
elif ch != u'\uFEFF':
|
111
|
+
self.column += 1
|
112
|
+
length -= 1
|
113
|
+
|
114
|
+
def get_mark(self):
|
115
|
+
if self.stream is None:
|
116
|
+
return Mark(self.name, self.index, self.line, self.column,
|
117
|
+
self.buffer, self.pointer)
|
118
|
+
else:
|
119
|
+
return Mark(self.name, self.index, self.line, self.column,
|
120
|
+
None, None)
|
121
|
+
|
122
|
+
def determine_encoding(self):
|
123
|
+
while not self.eof and len(self.raw_buffer) < 2:
|
124
|
+
self.update_raw()
|
125
|
+
if not isinstance(self.raw_buffer, unicode):
|
126
|
+
if self.raw_buffer.startswith(codecs.BOM_UTF16_LE):
|
127
|
+
self.raw_decode = codecs.utf_16_le_decode
|
128
|
+
self.encoding = 'utf-16-le'
|
129
|
+
elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE):
|
130
|
+
self.raw_decode = codecs.utf_16_be_decode
|
131
|
+
self.encoding = 'utf-16-be'
|
132
|
+
else:
|
133
|
+
self.raw_decode = codecs.utf_8_decode
|
134
|
+
self.encoding = 'utf-8'
|
135
|
+
self.update(1)
|
136
|
+
|
137
|
+
NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')
|
138
|
+
def check_printable(self, data):
|
139
|
+
match = self.NON_PRINTABLE.search(data)
|
140
|
+
if match:
|
141
|
+
character = match.group()
|
142
|
+
position = self.index+(len(self.buffer)-self.pointer)+match.start()
|
143
|
+
raise ReaderError(self.name, position, ord(character),
|
144
|
+
'unicode', "special characters are not allowed")
|
145
|
+
|
146
|
+
def update(self, length):
|
147
|
+
if self.raw_buffer is None:
|
148
|
+
return
|
149
|
+
self.buffer = self.buffer[self.pointer:]
|
150
|
+
self.pointer = 0
|
151
|
+
while len(self.buffer) < length:
|
152
|
+
if not self.eof:
|
153
|
+
self.update_raw()
|
154
|
+
if self.raw_decode is not None:
|
155
|
+
try:
|
156
|
+
data, converted = self.raw_decode(self.raw_buffer,
|
157
|
+
'strict', self.eof)
|
158
|
+
except UnicodeDecodeError, exc:
|
159
|
+
character = exc.object[exc.start]
|
160
|
+
if self.stream is not None:
|
161
|
+
position = self.stream_pointer-len(self.raw_buffer)+exc.start
|
162
|
+
else:
|
163
|
+
position = exc.start
|
164
|
+
raise ReaderError(self.name, position, character,
|
165
|
+
exc.encoding, exc.reason)
|
166
|
+
else:
|
167
|
+
data = self.raw_buffer
|
168
|
+
converted = len(data)
|
169
|
+
self.check_printable(data)
|
170
|
+
self.buffer += data
|
171
|
+
self.raw_buffer = self.raw_buffer[converted:]
|
172
|
+
if self.eof:
|
173
|
+
self.buffer += u'\0'
|
174
|
+
self.raw_buffer = None
|
175
|
+
break
|
176
|
+
|
177
|
+
def update_raw(self, size=1024):
|
178
|
+
data = self.stream.read(size)
|
179
|
+
if data:
|
180
|
+
self.raw_buffer += data
|
181
|
+
self.stream_pointer += len(data)
|
182
|
+
else:
|
183
|
+
self.eof = True
|
184
|
+
|
185
|
+
#try:
|
186
|
+
# import psyco
|
187
|
+
# psyco.bind(Reader)
|
188
|
+
#except ImportError:
|
189
|
+
# pass
|
190
|
+
|
Binary file
|
@@ -0,0 +1,486 @@
|
|
1
|
+
|
2
|
+
__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer',
|
3
|
+
'RepresenterError']
|
4
|
+
|
5
|
+
from error import *
|
6
|
+
from nodes import *
|
7
|
+
|
8
|
+
import datetime
|
9
|
+
|
10
|
+
import sys, copy_reg, types
|
11
|
+
|
12
|
+
class RepresenterError(YAMLError):
|
13
|
+
pass
|
14
|
+
|
15
|
+
class BaseRepresenter(object):
|
16
|
+
|
17
|
+
yaml_representers = {}
|
18
|
+
yaml_multi_representers = {}
|
19
|
+
|
20
|
+
def __init__(self, default_style=None, default_flow_style=None):
|
21
|
+
self.default_style = default_style
|
22
|
+
self.default_flow_style = default_flow_style
|
23
|
+
self.represented_objects = {}
|
24
|
+
self.object_keeper = []
|
25
|
+
self.alias_key = None
|
26
|
+
|
27
|
+
def represent(self, data):
|
28
|
+
node = self.represent_data(data)
|
29
|
+
self.serialize(node)
|
30
|
+
self.represented_objects = {}
|
31
|
+
self.object_keeper = []
|
32
|
+
self.alias_key = None
|
33
|
+
|
34
|
+
def get_classobj_bases(self, cls):
|
35
|
+
bases = [cls]
|
36
|
+
for base in cls.__bases__:
|
37
|
+
bases.extend(self.get_classobj_bases(base))
|
38
|
+
return bases
|
39
|
+
|
40
|
+
def represent_data(self, data):
|
41
|
+
if self.ignore_aliases(data):
|
42
|
+
self.alias_key = None
|
43
|
+
else:
|
44
|
+
self.alias_key = id(data)
|
45
|
+
if self.alias_key is not None:
|
46
|
+
if self.alias_key in self.represented_objects:
|
47
|
+
node = self.represented_objects[self.alias_key]
|
48
|
+
#if node is None:
|
49
|
+
# raise RepresenterError("recursive objects are not allowed: %r" % data)
|
50
|
+
return node
|
51
|
+
#self.represented_objects[alias_key] = None
|
52
|
+
self.object_keeper.append(data)
|
53
|
+
data_types = type(data).__mro__
|
54
|
+
if type(data) is types.InstanceType:
|
55
|
+
data_types = self.get_classobj_bases(data.__class__)+list(data_types)
|
56
|
+
if data_types[0] in self.yaml_representers:
|
57
|
+
node = self.yaml_representers[data_types[0]](self, data)
|
58
|
+
else:
|
59
|
+
for data_type in data_types:
|
60
|
+
if data_type in self.yaml_multi_representers:
|
61
|
+
node = self.yaml_multi_representers[data_type](self, data)
|
62
|
+
break
|
63
|
+
else:
|
64
|
+
if None in self.yaml_multi_representers:
|
65
|
+
node = self.yaml_multi_representers[None](self, data)
|
66
|
+
elif None in self.yaml_representers:
|
67
|
+
node = self.yaml_representers[None](self, data)
|
68
|
+
else:
|
69
|
+
node = ScalarNode(None, unicode(data))
|
70
|
+
#if alias_key is not None:
|
71
|
+
# self.represented_objects[alias_key] = node
|
72
|
+
return node
|
73
|
+
|
74
|
+
def add_representer(cls, data_type, representer):
|
75
|
+
if not 'yaml_representers' in cls.__dict__:
|
76
|
+
cls.yaml_representers = cls.yaml_representers.copy()
|
77
|
+
cls.yaml_representers[data_type] = representer
|
78
|
+
add_representer = classmethod(add_representer)
|
79
|
+
|
80
|
+
def add_multi_representer(cls, data_type, representer):
|
81
|
+
if not 'yaml_multi_representers' in cls.__dict__:
|
82
|
+
cls.yaml_multi_representers = cls.yaml_multi_representers.copy()
|
83
|
+
cls.yaml_multi_representers[data_type] = representer
|
84
|
+
add_multi_representer = classmethod(add_multi_representer)
|
85
|
+
|
86
|
+
def represent_scalar(self, tag, value, style=None):
|
87
|
+
if style is None:
|
88
|
+
style = self.default_style
|
89
|
+
node = ScalarNode(tag, value, style=style)
|
90
|
+
if self.alias_key is not None:
|
91
|
+
self.represented_objects[self.alias_key] = node
|
92
|
+
return node
|
93
|
+
|
94
|
+
def represent_sequence(self, tag, sequence, flow_style=None):
|
95
|
+
value = []
|
96
|
+
node = SequenceNode(tag, value, flow_style=flow_style)
|
97
|
+
if self.alias_key is not None:
|
98
|
+
self.represented_objects[self.alias_key] = node
|
99
|
+
best_style = True
|
100
|
+
for item in sequence:
|
101
|
+
node_item = self.represent_data(item)
|
102
|
+
if not (isinstance(node_item, ScalarNode) and not node_item.style):
|
103
|
+
best_style = False
|
104
|
+
value.append(node_item)
|
105
|
+
if flow_style is None:
|
106
|
+
if self.default_flow_style is not None:
|
107
|
+
node.flow_style = self.default_flow_style
|
108
|
+
else:
|
109
|
+
node.flow_style = best_style
|
110
|
+
return node
|
111
|
+
|
112
|
+
def represent_mapping(self, tag, mapping, flow_style=None):
|
113
|
+
value = []
|
114
|
+
node = MappingNode(tag, value, flow_style=flow_style)
|
115
|
+
if self.alias_key is not None:
|
116
|
+
self.represented_objects[self.alias_key] = node
|
117
|
+
best_style = True
|
118
|
+
if hasattr(mapping, 'items'):
|
119
|
+
mapping = mapping.items()
|
120
|
+
mapping.sort()
|
121
|
+
for item_key, item_value in mapping:
|
122
|
+
node_key = self.represent_data(item_key)
|
123
|
+
node_value = self.represent_data(item_value)
|
124
|
+
if not (isinstance(node_key, ScalarNode) and not node_key.style):
|
125
|
+
best_style = False
|
126
|
+
if not (isinstance(node_value, ScalarNode) and not node_value.style):
|
127
|
+
best_style = False
|
128
|
+
value.append((node_key, node_value))
|
129
|
+
if flow_style is None:
|
130
|
+
if self.default_flow_style is not None:
|
131
|
+
node.flow_style = self.default_flow_style
|
132
|
+
else:
|
133
|
+
node.flow_style = best_style
|
134
|
+
return node
|
135
|
+
|
136
|
+
def ignore_aliases(self, data):
|
137
|
+
return False
|
138
|
+
|
139
|
+
class SafeRepresenter(BaseRepresenter):
|
140
|
+
|
141
|
+
def ignore_aliases(self, data):
|
142
|
+
if data is None:
|
143
|
+
return True
|
144
|
+
if isinstance(data, tuple) and data == ():
|
145
|
+
return True
|
146
|
+
if isinstance(data, (str, unicode, bool, int, float)):
|
147
|
+
return True
|
148
|
+
|
149
|
+
def represent_none(self, data):
|
150
|
+
return self.represent_scalar(u'tag:yaml.org,2002:null',
|
151
|
+
u'null')
|
152
|
+
|
153
|
+
def represent_str(self, data):
|
154
|
+
tag = None
|
155
|
+
style = None
|
156
|
+
try:
|
157
|
+
data = unicode(data, 'ascii')
|
158
|
+
tag = u'tag:yaml.org,2002:str'
|
159
|
+
except UnicodeDecodeError:
|
160
|
+
try:
|
161
|
+
data = unicode(data, 'utf-8')
|
162
|
+
tag = u'tag:yaml.org,2002:str'
|
163
|
+
except UnicodeDecodeError:
|
164
|
+
data = data.encode('base64')
|
165
|
+
tag = u'tag:yaml.org,2002:binary'
|
166
|
+
style = '|'
|
167
|
+
return self.represent_scalar(tag, data, style=style)
|
168
|
+
|
169
|
+
def represent_unicode(self, data):
|
170
|
+
return self.represent_scalar(u'tag:yaml.org,2002:str', data)
|
171
|
+
|
172
|
+
def represent_bool(self, data):
|
173
|
+
if data:
|
174
|
+
value = u'true'
|
175
|
+
else:
|
176
|
+
value = u'false'
|
177
|
+
return self.represent_scalar(u'tag:yaml.org,2002:bool', value)
|
178
|
+
|
179
|
+
def represent_int(self, data):
|
180
|
+
return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))
|
181
|
+
|
182
|
+
def represent_long(self, data):
|
183
|
+
return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))
|
184
|
+
|
185
|
+
inf_value = 1e300
|
186
|
+
while repr(inf_value) != repr(inf_value*inf_value):
|
187
|
+
inf_value *= inf_value
|
188
|
+
|
189
|
+
def represent_float(self, data):
|
190
|
+
if data != data or (data == 0.0 and data == 1.0):
|
191
|
+
value = u'.nan'
|
192
|
+
elif data == self.inf_value:
|
193
|
+
value = u'.inf'
|
194
|
+
elif data == -self.inf_value:
|
195
|
+
value = u'-.inf'
|
196
|
+
else:
|
197
|
+
value = unicode(repr(data)).lower()
|
198
|
+
# Note that in some cases `repr(data)` represents a float number
|
199
|
+
# without the decimal parts. For instance:
|
200
|
+
# >>> repr(1e17)
|
201
|
+
# '1e17'
|
202
|
+
# Unfortunately, this is not a valid float representation according
|
203
|
+
# to the definition of the `!!float` tag. We fix this by adding
|
204
|
+
# '.0' before the 'e' symbol.
|
205
|
+
if u'.' not in value and u'e' in value:
|
206
|
+
value = value.replace(u'e', u'.0e', 1)
|
207
|
+
return self.represent_scalar(u'tag:yaml.org,2002:float', value)
|
208
|
+
|
209
|
+
def represent_list(self, data):
|
210
|
+
#pairs = (len(data) > 0 and isinstance(data, list))
|
211
|
+
#if pairs:
|
212
|
+
# for item in data:
|
213
|
+
# if not isinstance(item, tuple) or len(item) != 2:
|
214
|
+
# pairs = False
|
215
|
+
# break
|
216
|
+
#if not pairs:
|
217
|
+
return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
|
218
|
+
#value = []
|
219
|
+
#for item_key, item_value in data:
|
220
|
+
# value.append(self.represent_mapping(u'tag:yaml.org,2002:map',
|
221
|
+
# [(item_key, item_value)]))
|
222
|
+
#return SequenceNode(u'tag:yaml.org,2002:pairs', value)
|
223
|
+
|
224
|
+
def represent_dict(self, data):
|
225
|
+
return self.represent_mapping(u'tag:yaml.org,2002:map', data)
|
226
|
+
|
227
|
+
def represent_set(self, data):
|
228
|
+
value = {}
|
229
|
+
for key in data:
|
230
|
+
value[key] = None
|
231
|
+
return self.represent_mapping(u'tag:yaml.org,2002:set', value)
|
232
|
+
|
233
|
+
def represent_date(self, data):
|
234
|
+
value = unicode(data.isoformat())
|
235
|
+
return self.represent_scalar(u'tag:yaml.org,2002:timestamp', value)
|
236
|
+
|
237
|
+
def represent_datetime(self, data):
|
238
|
+
value = unicode(data.isoformat(' '))
|
239
|
+
return self.represent_scalar(u'tag:yaml.org,2002:timestamp', value)
|
240
|
+
|
241
|
+
def represent_yaml_object(self, tag, data, cls, flow_style=None):
|
242
|
+
if hasattr(data, '__getstate__'):
|
243
|
+
state = data.__getstate__()
|
244
|
+
else:
|
245
|
+
state = data.__dict__.copy()
|
246
|
+
return self.represent_mapping(tag, state, flow_style=flow_style)
|
247
|
+
|
248
|
+
def represent_undefined(self, data):
|
249
|
+
raise RepresenterError("cannot represent an object: %s" % data)
|
250
|
+
|
251
|
+
SafeRepresenter.add_representer(type(None),
|
252
|
+
SafeRepresenter.represent_none)
|
253
|
+
|
254
|
+
SafeRepresenter.add_representer(str,
|
255
|
+
SafeRepresenter.represent_str)
|
256
|
+
|
257
|
+
SafeRepresenter.add_representer(unicode,
|
258
|
+
SafeRepresenter.represent_unicode)
|
259
|
+
|
260
|
+
SafeRepresenter.add_representer(bool,
|
261
|
+
SafeRepresenter.represent_bool)
|
262
|
+
|
263
|
+
SafeRepresenter.add_representer(int,
|
264
|
+
SafeRepresenter.represent_int)
|
265
|
+
|
266
|
+
SafeRepresenter.add_representer(long,
|
267
|
+
SafeRepresenter.represent_long)
|
268
|
+
|
269
|
+
SafeRepresenter.add_representer(float,
|
270
|
+
SafeRepresenter.represent_float)
|
271
|
+
|
272
|
+
SafeRepresenter.add_representer(list,
|
273
|
+
SafeRepresenter.represent_list)
|
274
|
+
|
275
|
+
SafeRepresenter.add_representer(tuple,
|
276
|
+
SafeRepresenter.represent_list)
|
277
|
+
|
278
|
+
SafeRepresenter.add_representer(dict,
|
279
|
+
SafeRepresenter.represent_dict)
|
280
|
+
|
281
|
+
SafeRepresenter.add_representer(set,
|
282
|
+
SafeRepresenter.represent_set)
|
283
|
+
|
284
|
+
SafeRepresenter.add_representer(datetime.date,
|
285
|
+
SafeRepresenter.represent_date)
|
286
|
+
|
287
|
+
SafeRepresenter.add_representer(datetime.datetime,
|
288
|
+
SafeRepresenter.represent_datetime)
|
289
|
+
|
290
|
+
SafeRepresenter.add_representer(None,
|
291
|
+
SafeRepresenter.represent_undefined)
|
292
|
+
|
293
|
+
class Representer(SafeRepresenter):
|
294
|
+
|
295
|
+
def represent_str(self, data):
|
296
|
+
tag = None
|
297
|
+
style = None
|
298
|
+
try:
|
299
|
+
data = unicode(data, 'ascii')
|
300
|
+
tag = u'tag:yaml.org,2002:str'
|
301
|
+
except UnicodeDecodeError:
|
302
|
+
try:
|
303
|
+
data = unicode(data, 'utf-8')
|
304
|
+
tag = u'tag:yaml.org,2002:python/str'
|
305
|
+
except UnicodeDecodeError:
|
306
|
+
data = data.encode('base64')
|
307
|
+
tag = u'tag:yaml.org,2002:binary'
|
308
|
+
style = '|'
|
309
|
+
return self.represent_scalar(tag, data, style=style)
|
310
|
+
|
311
|
+
def represent_unicode(self, data):
|
312
|
+
tag = None
|
313
|
+
try:
|
314
|
+
data.encode('ascii')
|
315
|
+
tag = u'tag:yaml.org,2002:python/unicode'
|
316
|
+
except UnicodeEncodeError:
|
317
|
+
tag = u'tag:yaml.org,2002:str'
|
318
|
+
return self.represent_scalar(tag, data)
|
319
|
+
|
320
|
+
def represent_long(self, data):
|
321
|
+
tag = u'tag:yaml.org,2002:int'
|
322
|
+
if int(data) is not data:
|
323
|
+
tag = u'tag:yaml.org,2002:python/long'
|
324
|
+
return self.represent_scalar(tag, unicode(data))
|
325
|
+
|
326
|
+
def represent_complex(self, data):
|
327
|
+
if data.imag == 0.0:
|
328
|
+
data = u'%r' % data.real
|
329
|
+
elif data.real == 0.0:
|
330
|
+
data = u'%rj' % data.imag
|
331
|
+
elif data.imag > 0:
|
332
|
+
data = u'%r+%rj' % (data.real, data.imag)
|
333
|
+
else:
|
334
|
+
data = u'%r%rj' % (data.real, data.imag)
|
335
|
+
return self.represent_scalar(u'tag:yaml.org,2002:python/complex', data)
|
336
|
+
|
337
|
+
def represent_tuple(self, data):
|
338
|
+
return self.represent_sequence(u'tag:yaml.org,2002:python/tuple', data)
|
339
|
+
|
340
|
+
def represent_name(self, data):
|
341
|
+
name = u'%s.%s' % (data.__module__, data.__name__)
|
342
|
+
return self.represent_scalar(u'tag:yaml.org,2002:python/name:'+name, u'')
|
343
|
+
|
344
|
+
def represent_module(self, data):
|
345
|
+
return self.represent_scalar(
|
346
|
+
u'tag:yaml.org,2002:python/module:'+data.__name__, u'')
|
347
|
+
|
348
|
+
def represent_instance(self, data):
|
349
|
+
# For instances of classic classes, we use __getinitargs__ and
|
350
|
+
# __getstate__ to serialize the data.
|
351
|
+
|
352
|
+
# If data.__getinitargs__ exists, the object must be reconstructed by
|
353
|
+
# calling cls(**args), where args is a tuple returned by
|
354
|
+
# __getinitargs__. Otherwise, the cls.__init__ method should never be
|
355
|
+
# called and the class instance is created by instantiating a trivial
|
356
|
+
# class and assigning to the instance's __class__ variable.
|
357
|
+
|
358
|
+
# If data.__getstate__ exists, it returns the state of the object.
|
359
|
+
# Otherwise, the state of the object is data.__dict__.
|
360
|
+
|
361
|
+
# We produce either a !!python/object or !!python/object/new node.
|
362
|
+
# If data.__getinitargs__ does not exist and state is a dictionary, we
|
363
|
+
# produce a !!python/object node . Otherwise we produce a
|
364
|
+
# !!python/object/new node.
|
365
|
+
|
366
|
+
cls = data.__class__
|
367
|
+
class_name = u'%s.%s' % (cls.__module__, cls.__name__)
|
368
|
+
args = None
|
369
|
+
state = None
|
370
|
+
if hasattr(data, '__getinitargs__'):
|
371
|
+
args = list(data.__getinitargs__())
|
372
|
+
if hasattr(data, '__getstate__'):
|
373
|
+
state = data.__getstate__()
|
374
|
+
else:
|
375
|
+
state = data.__dict__
|
376
|
+
if args is None and isinstance(state, dict):
|
377
|
+
return self.represent_mapping(
|
378
|
+
u'tag:yaml.org,2002:python/object:'+class_name, state)
|
379
|
+
if isinstance(state, dict) and not state:
|
380
|
+
return self.represent_sequence(
|
381
|
+
u'tag:yaml.org,2002:python/object/new:'+class_name, args)
|
382
|
+
value = {}
|
383
|
+
if args:
|
384
|
+
value['args'] = args
|
385
|
+
value['state'] = state
|
386
|
+
return self.represent_mapping(
|
387
|
+
u'tag:yaml.org,2002:python/object/new:'+class_name, value)
|
388
|
+
|
389
|
+
def represent_object(self, data):
|
390
|
+
# We use __reduce__ API to save the data. data.__reduce__ returns
|
391
|
+
# a tuple of length 2-5:
|
392
|
+
# (function, args, state, listitems, dictitems)
|
393
|
+
|
394
|
+
# For reconstructing, we calls function(*args), then set its state,
|
395
|
+
# listitems, and dictitems if they are not None.
|
396
|
+
|
397
|
+
# A special case is when function.__name__ == '__newobj__'. In this
|
398
|
+
# case we create the object with args[0].__new__(*args).
|
399
|
+
|
400
|
+
# Another special case is when __reduce__ returns a string - we don't
|
401
|
+
# support it.
|
402
|
+
|
403
|
+
# We produce a !!python/object, !!python/object/new or
|
404
|
+
# !!python/object/apply node.
|
405
|
+
|
406
|
+
cls = type(data)
|
407
|
+
if cls in copy_reg.dispatch_table:
|
408
|
+
reduce = copy_reg.dispatch_table[cls](data)
|
409
|
+
elif hasattr(data, '__reduce_ex__'):
|
410
|
+
reduce = data.__reduce_ex__(2)
|
411
|
+
elif hasattr(data, '__reduce__'):
|
412
|
+
reduce = data.__reduce__()
|
413
|
+
else:
|
414
|
+
raise RepresenterError("cannot represent object: %r" % data)
|
415
|
+
reduce = (list(reduce)+[None]*5)[:5]
|
416
|
+
function, args, state, listitems, dictitems = reduce
|
417
|
+
args = list(args)
|
418
|
+
if state is None:
|
419
|
+
state = {}
|
420
|
+
if listitems is not None:
|
421
|
+
listitems = list(listitems)
|
422
|
+
if dictitems is not None:
|
423
|
+
dictitems = dict(dictitems)
|
424
|
+
if function.__name__ == '__newobj__':
|
425
|
+
function = args[0]
|
426
|
+
args = args[1:]
|
427
|
+
tag = u'tag:yaml.org,2002:python/object/new:'
|
428
|
+
newobj = True
|
429
|
+
else:
|
430
|
+
tag = u'tag:yaml.org,2002:python/object/apply:'
|
431
|
+
newobj = False
|
432
|
+
function_name = u'%s.%s' % (function.__module__, function.__name__)
|
433
|
+
if not args and not listitems and not dictitems \
|
434
|
+
and isinstance(state, dict) and newobj:
|
435
|
+
return self.represent_mapping(
|
436
|
+
u'tag:yaml.org,2002:python/object:'+function_name, state)
|
437
|
+
if not listitems and not dictitems \
|
438
|
+
and isinstance(state, dict) and not state:
|
439
|
+
return self.represent_sequence(tag+function_name, args)
|
440
|
+
value = {}
|
441
|
+
if args:
|
442
|
+
value['args'] = args
|
443
|
+
if state or not isinstance(state, dict):
|
444
|
+
value['state'] = state
|
445
|
+
if listitems:
|
446
|
+
value['listitems'] = listitems
|
447
|
+
if dictitems:
|
448
|
+
value['dictitems'] = dictitems
|
449
|
+
return self.represent_mapping(tag+function_name, value)
|
450
|
+
|
451
|
+
Representer.add_representer(str,
|
452
|
+
Representer.represent_str)
|
453
|
+
|
454
|
+
Representer.add_representer(unicode,
|
455
|
+
Representer.represent_unicode)
|
456
|
+
|
457
|
+
Representer.add_representer(long,
|
458
|
+
Representer.represent_long)
|
459
|
+
|
460
|
+
Representer.add_representer(complex,
|
461
|
+
Representer.represent_complex)
|
462
|
+
|
463
|
+
Representer.add_representer(tuple,
|
464
|
+
Representer.represent_tuple)
|
465
|
+
|
466
|
+
Representer.add_representer(type,
|
467
|
+
Representer.represent_name)
|
468
|
+
|
469
|
+
Representer.add_representer(types.ClassType,
|
470
|
+
Representer.represent_name)
|
471
|
+
|
472
|
+
Representer.add_representer(types.FunctionType,
|
473
|
+
Representer.represent_name)
|
474
|
+
|
475
|
+
Representer.add_representer(types.BuiltinFunctionType,
|
476
|
+
Representer.represent_name)
|
477
|
+
|
478
|
+
Representer.add_representer(types.ModuleType,
|
479
|
+
Representer.represent_module)
|
480
|
+
|
481
|
+
Representer.add_multi_representer(types.InstanceType,
|
482
|
+
Representer.represent_instance)
|
483
|
+
|
484
|
+
Representer.add_multi_representer(object,
|
485
|
+
Representer.represent_object)
|
486
|
+
|
Binary file
|